HaoYang670 commented on code in PR #2740:
URL: https://github.com/apache/arrow-rs/pull/2740#discussion_r973526783


##########
arrow/src/compute/kernels/arithmetic.rs:
##########
@@ -78,6 +80,30 @@ where
     Ok(binary(left, right, op))
 }
 
+/// This is similar to `math_op` as it performs given operation between two 
input primitive arrays.
+/// But the given operation can return `Err` if overflow is detected. For the 
case, this function
+/// returns an `Err`.
+fn math_checked_op<LT, RT, F>(
+    left: &PrimitiveArray<LT>,
+    right: &PrimitiveArray<RT>,
+    op: F,
+) -> Result<PrimitiveArray<LT>>
+where
+    LT: ArrowNumericType,
+    RT: ArrowNumericType,
+    F: Fn(LT::Native, RT::Native) -> Result<LT::Native>,
+    LT::Native: ArrowNativeTypeOp,
+    RT::Native: ArrowNativeTypeOp,
+{
+    if left.len() != right.len() {

Review Comment:
   As `try_binary` is a super set of `math_checked_op`, any usage of 
`math_checked_op` could be replaced by `try_binary` theoretically. 
   Also, as `math_checked_op` is a private helper function, I guess we don't 
need more strict type bound here.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to