Copilot commented on code in PR #50452:
URL: https://github.com/apache/arrow/pull/50452#discussion_r3553270672
##########
ruby/red-arrow-format/lib/arrow-format/array.rb:
##########
@@ -537,7 +537,17 @@ class DurationArray < TemporalArray
end
class VariableSizeBinaryArray < Array
- def initialize(size, validity_buffer, offsets_buffer, values_buffer)
+ include BufferAlignable
+ def initialize(*args)
+ if args.size == 1
+ args = build_data(args.first)
+ elsif args.size != 4
+ raise ArgumentError,
+ "wrong number of arguments (given #{args.size}, expected 1 or 4)"
+ end
Review Comment:
The new 1-argument constructor path (`BinaryArray.new(values)` /
`UTF8Array.new(values)`) isn’t covered by the existing IPC writer/reader
roundtrip tests. Without a roundtrip, issues in buffer sizing/alignment
(especially for offsets/values buffers) could slip through even though
`to_a`/`==` pass.
Consider adding a writer/reader roundtrip test that constructs an
`ArrowFormat::BinaryArray`/`ArrowFormat::UTF8Array` via `.new(values)`, writes
a record batch, reads it back, and asserts the values match (including a sliced
case).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]