liukun4515 commented on code in PR #2666:
URL: https://github.com/apache/arrow-rs/pull/2666#discussion_r963791320


##########
arrow/src/compute/kernels/arithmetic.rs:
##########
@@ -122,85 +95,11 @@ where
         ));
     }
 
-    let left_iter = ArrayIter::new(left);
-    let right_iter = ArrayIter::new(right);
-
-    let values: Result<Vec<Option<<LT as ArrowPrimitiveType>::Native>>> = 
left_iter
-        .into_iter()
-        .zip(right_iter.into_iter())
-        .map(|(l, r)| {
-            if let (Some(l), Some(r)) = (l, r) {
-                let result = op(l, r);
-                if let Some(r) = result {
-                    Ok(Some(r))
-                } else {
-                    // Overflow
-                    Err(ArrowError::ComputeError(format!(
-                        "Overflow happened on: {:?}, {:?}",
-                        l, r
-                    )))
-                }
-            } else {
-                Ok(None)
-            }
+    try_binary(left, right, |a, b| {
+        op(a, b).ok_or_else(|| {
+            ArrowError::ComputeError(format!("Overflow happened on: {:?}, 
{:?}", a, b))

Review Comment:
   Can we point out the `op` which cause the overflow?



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