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


##########
ruby/red-arrow-format/lib/arrow-format/type.rb:
##########
@@ -548,6 +548,23 @@ def build_array(...)
   end
 
   class TimestampType < TemporalType
+    class << self
+      def try_convert(value)
+        case value
+        when Symbol
+          unit = value
+          new(unit, nil)
+        when ::Array
+          unit, time_zone = value
+          new(unit, time_zone)
+        when self

Review Comment:
   `TimestampType.try_convert` currently treats any `Array` as `[unit, 
time_zone]`, which means inputs like `[]` or `[:second, "UTC", :extra]` 
silently produce a `TimestampType` with `unit=nil` / ignored trailing elements. 
This makes it easy to create invalid timestamp types and can hide caller bugs. 
Consider validating the array shape and element types before constructing the 
type, and returning `nil` for unsupported inputs.



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