viirya commented on code in PR #2710:
URL: https://github.com/apache/arrow-rs/pull/2710#discussion_r970071197
##########
arrow/src/compute/kernels/arithmetic.rs:
##########
@@ -1118,6 +1118,32 @@ where
return math_checked_divide_op(left, right, |a, b| a.div_checked(b));
}
+/// Perform `left / right` operation on two arrays. If either left or right
value is null
+/// then the result is also null.
+///
+/// If any right hand value is zero, the operation value will be replaced with
null in the
+/// result.
+///
+/// Unlike `divide` or `divide_checked`, division by zero will get a null
value instead
+/// returning an `Err`, this also doesn't check overflowing, overflowing will
just wrap
+/// the result around.
+pub fn divide_opt<T>(
Review Comment:
As a note for other reviewer even post-review, we need such divide kernel
which doesn't return Error on overflow (wrapping) or division by zero (getting
null instead). We may consider to change `divide`'s division by zero behavior
but it will downgrade `divide` performance. So currently the best option seems
to have this separate kernel.
--
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]