sunchao commented on code in PR #2713:
URL: https://github.com/apache/arrow-rs/pull/2713#discussion_r971322647


##########
arrow/src/compute/kernels/arity.rs:
##########
@@ -162,6 +177,30 @@ where
     }
 }
 
+/// Applies a fallible unary function to an array with primitive values.
+pub fn try_unary_dyn<F, T>(array: &dyn Array, op: F) -> Result<ArrayRef>
+where
+    T: ArrowPrimitiveType,
+    F: Fn(T::Native) -> Result<T::Native>,
+{
+    downcast_dictionary_array! {
+        array => try_unary_dict::<_, F, T>(array, op),

Review Comment:
   Follow up sounds fine to me. Perhaps we can just check the type here:
   ```rust
       downcast_dictionary_array! {
           array => if array.values().data_type() == &T::DATA_TYPE {
               try_unary_dict::<_, F, T>(array, op)
           } else {
               // throw error
           },
           t => {
   ```



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