CTTY commented on code in PR #11608:
URL: https://github.com/apache/hudi/pull/11608#discussion_r1673121749
##########
hudi-common/src/main/java/org/apache/hudi/common/util/hash/BucketIndexUtil.java:
##########
@@ -36,26 +36,10 @@ public class BucketIndexUtil {
* @return The partition index of this bucket.
*/
public static Functions.Function2<String, Integer, Integer>
getPartitionIndexFunc(int bucketNum, int parallelism) {
- if (parallelism < bucketNum) {
- return (partition, curBucket) -> {
- int partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) /
parallelism * bucketNum;
- int globalIndex = partitionIndex + curBucket;
- return globalIndex % parallelism;
- };
- } else {
- if (parallelism % bucketNum == 0) {
- return (partition, curBucket) -> {
- int partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) /
(parallelism / bucketNum) * bucketNum;
- int globalIndex = partitionIndex + curBucket;
- return globalIndex % parallelism;
- };
- } else {
- return (partition, curBucket) -> {
- int partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) /
(parallelism / bucketNum + 1) * bucketNum;
- int globalIndex = partitionIndex + curBucket;
- return globalIndex % parallelism;
- };
- }
- }
+ return (partition, curBucket) -> {
+ int partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) %
parallelism * bucketNum;
+ int globalIndex = partitionIndex + curBucket;
+ return globalIndex % parallelism;
+ };
Review Comment:
nit: Can we update the comment to reflect the logic of this new algorithm
--
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]