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


##########
arrow/src/compute/kernels/arithmetic.rs:
##########
@@ -671,6 +741,28 @@ where
     math_dict_op!(left, right, op, PrimitiveArray<T>)
 }
 
+/// Helper function for operations where a valid `0` on the right array should
+/// result in an [ArrowError::DivideByZero], namely the division and modulo 
operations
+///
+/// # Errors
+///
+/// This function errors if:
+/// * the arrays have different lengths
+/// * there is an element where both left and right values are valid and the 
right value is `0`
+fn math_divide_checked_op_dict<K, T, F>(
+    left: &DictionaryArray<K>,
+    right: &DictionaryArray<K>,
+    op: F,
+) -> Result<PrimitiveArray<T>>
+where
+    K: ArrowNumericType,
+    T: ArrowNumericType,
+    T::Native: One + Zero,
+    F: Fn(T::Native, T::Native) -> T::Native,
+{
+    math_dict_divide_checked_op!(left, right, op, PrimitiveArray<T>)

Review Comment:
   okay, inlined it.



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