Copilot commented on code in PR #50443:
URL: https://github.com/apache/arrow/pull/50443#discussion_r3550029848
##########
ruby/red-arrow-format/lib/arrow-format/array.rb:
##########
@@ -192,6 +192,7 @@ def initialize(*args)
expected_n_args = "1 or 3"
else
type = args.shift
+ type = self.class.type_class.try_convert(type) || type
expected_n_args = "2 or 4"
end
Review Comment:
`PrimitiveArray#initialize` now unconditionally calls
`self.class.type_class.try_convert(type)`, which will raise `NoMethodError` for
array classes that don’t define `type_class` (e.g., Interval/Duration arrays)
and also for `TimestampArray` because `TimestampType` doesn’t define
`.try_convert`. This breaks existing `*.new(type, ...)` call paths. Guard the
conversion so it only runs when both `type_class` and `.try_convert` are
available (and otherwise leave `type` unchanged).
--
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]