viirya commented on code in PR #2740: URL: https://github.com/apache/arrow-rs/pull/2740#discussion_r973525783
########## 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: `math_checked_op` basically is necessary for the type bound. -- 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