Skip to content

Navigation Menu

Sign in
Sign up

GH-51273: [Ruby] Add FixedSizeListArray values constructor - #51274

Open
emecii wants to merge 1 commit into
apache:main from
emecii:gh-51273-fixed-size-list
Open

GH-51273: [Ruby] Add FixedSizeListArray values constructor #51274
emecii wants to merge 1 commit into
apache:main from
emecii:gh-51273-fixed-size-list

Conversation

@emecii

@emecii emecii commented Sep 10, 2026
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

Rationale for this change

GH-50382 requests explicit value constructors for all existing ArrowFormat::Type subclasses before the broader builder API is exposed. Fixed-size lists still require callers to manually construct the parent validity buffer and flattened child array.

This is the focused fixed-size-list prerequisite requested in the GH-50382 maintainer discussion. It is distinct from variable-size ListArray support in GH-51262.

What changes are included in this PR?

  • Add ArrowFormat::FixedSizeListArray.new(type, values) while preserving the existing low-level four-argument constructor.
  • Build the parent validity bitmap and the child array from nested Ruby values.
  • Preserve exactly type.size child slots for null parent lists.
  • Reject non-null lists whose size differs from the declared fixed size.
  • Delegate child construction to the declared child field type.
  • Add focused coverage for typed construction, parent and child nulls, invalid sizes, empty input, and the low-level constructor.

Are these changes tested?

Yes.

RUBYLIB=/opt/homebrew/lib/ruby/gems/4.0.0/gems/red-arrow-25.0.1/lib GI_TYPELIB_PATH=/opt/homebrew/lib/girepository-1.0 bundle exec ruby test/run.rb test-fixed-size-list-array.rb
# 6 tests, 12 assertions, 0 failures, 0 errors
RUBYLIB=/opt/homebrew/lib/ruby/gems/4.0.0/gems/red-arrow-25.0.1/lib GI_TYPELIB_PATH=/opt/homebrew/lib/girepository-1.0 bundle exec rake test
# 696 tests, 705 assertions, 0 failures, 0 errors

I also wrote an Arrow IPC file containing [[1, 2], nil, [3, nil]] with the new constructor and loaded it with the native Arrow reader; the values round-tripped unchanged.

The tests use the current red-arrow-format sources with the locally installed Arrow 25.0.1 native extension. Upstream CI remains authoritative for the matching main-branch native runtime.

Are there any user-facing changes?

Yes. ArrowFormat::FixedSizeListArray gains a two-argument values constructor. The existing low-level constructor remains supported.

AI assistance disclosure

OpenAI Codex assisted with issue research, implementation, test generation, validation commands, and drafting this pull request. The submitted behavior is supported by the focused regression, full package suite, and IPC round-trip results above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kou kou Awaiting requested review from kou kou is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /