GH-50434: [Ruby] Add ArrowFormat::Date{32,64}.new(values)#50442
Conversation
|
|
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. |
|
+1 |
|
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 32513fe. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them. |
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