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


##########
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:
   Normally as the op is provided by users, I suppose that users know 
dictionary value is same type as the scalar. But it is good to return a 
meaningful Err instead of runtime panic. I will do it in a follow-up.



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