Skip to content

GH-50571: [Ruby] Add schema-aware ArrowFormat::RecordBatch construction - #51214

Merged
kou merged 3 commits into
apache:mainfrom
emecii:feat/ruby-arrow-format-record-batch-schema
Sep 8, 2026
Merged

kou merged 3 commits into
apache:mainfrom
emecii:feat/ruby-arrow-format-record-batch-schema

Conversation

@emecii

@emecii emecii commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Rationale for this change

ArrowFormat::RecordBatch.new(values) infers a schema from Ruby values. This adds the corresponding schema-aware constructor so callers can preserve intended Arrow types while building from Ruby rows or columns.

What changes are included in this PR?

  • Add ArrowFormat::RecordBatch.new(schema, values) for row- and column-oriented Ruby values.
  • Build each column through its schema field type and preserve null values.
  • Cover type preservation, supported value forms, inconsistent column lengths, and invalid extra values.

Are these changes tested?

Yes. The red-arrow-format suite passes locally (690 tests, 693 assertions), including the focused record-batch tests. The existing red-arrow record-batch suite also passes (21 tests, 21 assertions).

Are there any user-facing changes?

Yes.

AI assistance

AI assistance drafted the implementation and tests. The final scope was checked against the existing two-argument Arrow::RecordBatch.new contract and the one-argument ArrowFormat::RecordBatch API; the validation commands above were run locally.

Comment thread ruby/red-arrow-format/lib/arrow-format/record-batch.rb Outdated
Comment thread ruby/red-arrow-format/lib/arrow-format/record-batch.rb Outdated
Comment thread ruby/red-arrow-format/lib/arrow-format/record-batch.rb Outdated
Comment thread ruby/red-arrow-format/lib/arrow-format/record-batch.rb
@emecii
emecii force-pushed the feat/ruby-arrow-format-record-batch-schema branch from 9199203 to 3f5fb39 Compare September 8, 2026 05:19
@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Sep 8, 2026
Comment thread ruby/red-arrow-format/lib/arrow-format/record-batch.rb Outdated
Comment thread ruby/red-arrow-format/lib/arrow-format/record-batch.rb Outdated
Comment thread ruby/red-arrow-format/test/test-record-batch.rb Outdated
Comment thread ruby/red-arrow-format/test/test-record-batch.rb Outdated

@kou kou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@kou
kou merged commit 9136394 into apache:main Sep 8, 2026
38 checks passed
@kou kou removed the awaiting committer review Awaiting committer review label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants