mbutrovich commented on code in PR #7690:
URL: https://github.com/apache/datafusion-comet/pull/7690#discussion_r4635724482
##########
native/shuffle/src/comet_partitioning.rs:
##########
@@ -124,7 +124,8 @@ pub(crate) fn pmod(hash: u32, n: usize) -> usize {
let hash = hash as i32;
let n = n as i32;
let r = hash % n;
- let result = if r < 0 { (r + n) % n } else { r };
+ // A negative `r` is in `(-n, 0)`, so `r + n` is already in `(0, n)`.
+ let result = if r < 0 { r + n } else { r };
Review Comment:
Thanks, switched to `rem_euclid`. On x86-64-v3 the loop body matches the
previous version apart from register names, with the `abs` hoisted out of the
loop as on aarch64.
https://github.com/apache/datafusion-comet/pull/7690#discussion_r4634484373
Thanks, moved it next to `pmod`. Both `multi_partition.rs` sites call it,
and `bench_support` re-exports it.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]