Skip to content

GH-50434: [Ruby] Add ArrowFormat::Date{32,64}.new(values)#50442

Merged
kou merged 1 commit into
apache:mainfrom
kou:ruby-date-array-new
Jul 9, 2026
Merged

GH-50434: [Ruby] Add ArrowFormat::Date{32,64}.new(values)#50442
kou merged 1 commit into
apache:mainfrom
kou:ruby-date-array-new

Conversation

@kou

@kou kou commented Jul 9, 2026

Copy link
Copy Markdown
Member

Rationale for this change

Building a date{32,64} Arrow array from Ruby objects is convenient.

What changes are included in this PR?

Accept ArrowFormat::Date{32,64}.new(values).

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes.

Copilot AI review requested due to automatic review settings July 9, 2026 07:07
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

⚠️ GitHub issue #50434 has been automatically assigned in GitHub to PR creator.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables constructing ArrowFormat::Date32Array and ArrowFormat::Date64Array directly from Ruby value arrays (including nils) by providing the missing packing templates needed for buffer construction, and adds targeted tests for the new behavior.

Changes:

  • Add pack_template implementations for Date32Type and Date64Type so Date{32,64}Array.new(values) can build value buffers.
  • Add new unit tests for Date32Array and Date64Array initialization and equality/slicing behavior.
  • Minor test refactor across several numeric array tests to use array splat ([0, *values, 0]) instead of concatenation.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ruby/red-arrow-format/lib/arrow-format/type.rb Provide pack_template for Date32/Date64 types to support array construction from Ruby values.
ruby/red-arrow-format/test/test-date32-array.rb New tests covering Date32Array.new(values) and equality/slicing behavior.
ruby/red-arrow-format/test/test-date64-array.rb New tests covering Date64Array.new(values) and equality/slicing behavior.
ruby/red-arrow-format/test/test-int8-array.rb Use splat-based array construction in slice-related tests.
ruby/red-arrow-format/test/test-int16-array.rb Use splat-based array construction in slice-related tests.
ruby/red-arrow-format/test/test-int32-array.rb Use splat-based array construction in slice-related tests.
ruby/red-arrow-format/test/test-int64-array.rb Use splat-based array construction in slice-related tests.
ruby/red-arrow-format/test/test-uint8-array.rb Use splat-based array construction in slice-related tests.
ruby/red-arrow-format/test/test-uint16-array.rb Use splat-based array construction in slice-related tests.
ruby/red-arrow-format/test/test-uint32-array.rb Use splat-based array construction in slice-related tests.
ruby/red-arrow-format/test/test-uint64-array.rb Use splat-based array construction in slice-related tests.
ruby/red-arrow-format/test/test-float32-array.rb Use splat-based array construction in slice-related tests.
ruby/red-arrow-format/test/test-float64-array.rb Use splat-based array construction in slice-related tests.

@kou

kou commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

+1

@kou kou merged commit 32513fe into apache:main Jul 9, 2026
33 checks passed
@kou kou deleted the ruby-date-array-new branch July 9, 2026 07:38
@kou kou removed the awaiting committer review Awaiting committer review label Jul 9, 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