Copilot commented on code in PR #50443:
URL: https://github.com/apache/arrow/pull/50443#discussion_r3550249727


##########
ruby/red-arrow-format/lib/arrow-format/array.rb:
##########
@@ -192,6 +192,9 @@ def initialize(*args)
         expected_n_args = "1 or 3"
       else
         type = args.shift
+        unless type.is_a?(Type)
+          type = self.class.type_class.try_convert(type) || type
+        end

Review Comment:
   `PrimitiveArray#initialize` unconditionally calls 
`self.class.type_class.try_convert(...)` when the first arg isn’t a `Type`. 
This will raise `NoMethodError` for any `type_class` that doesn’t implement 
`try_convert` (e.g., `TimestampArray` now defines `type_class` but 
`TimestampType` has no `try_convert`). Guard the call so conversion is only 
attempted when both `type_class` and `try_convert` are available (or add 
`try_convert` to all `type_class`es).



-- 
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]

Reply via email to