HaoYang670 commented on code in PR #2756:
URL: https://github.com/apache/arrow-rs/pull/2756#discussion_r977143368
##########
arrow/src/compute/kernels/arithmetic.rs:
##########
@@ -1075,18 +1075,18 @@ pub fn modulus<T>(
) -> Result<PrimitiveArray<T>>
where
T: ArrowNumericType,
- T::Native: Rem<Output = T::Native> + Zero + One,
+ T::Native: ArrowNativeTypeOp + One,
{
#[cfg(feature = "simd")]
return simd_checked_divide_op(&left, &right, simd_checked_modulus::<T>,
|a, b| {
- a % b
+ a.mod_wrapping(b)
});
Review Comment:
`a % b` will panic at `overflow`, but `a.wrapping_rem(b)` won't:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6d04230ac4454c895c2fe9e417c13938
If we don't want `simd_checked_divide_op` to panic, I guess we should use
`mod_wrapping`?
--
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]