GH-50434: [Ruby] Add ArrowFormat::Date{32,64}.new(values)#50442
Merged
Conversation
|
|
Contributor
There was a problem hiding this comment.
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_templateimplementations forDate32TypeandDate64TypesoDate{32,64}Array.new(values)can build value buffers. - Add new unit tests for
Date32ArrayandDate64Arrayinitialization 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. |
Member
Author
|
+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
ArrowFormat::Date{32,64}.new(values)#50434