TheR1sing3un commented on code in PR #13189:
URL: https://github.com/apache/hudi/pull/13189#discussion_r2053224319


##########
hudi-common/src/main/java/org/apache/hudi/common/util/hash/BucketIndexUtil.java:
##########
@@ -37,9 +38,12 @@ public class BucketIndexUtil {
    */
   public static Functions.Function3<Integer, String, Integer, Integer> 
getPartitionIndexFunc(int parallelism) {
     return (bucketNum, partition, curBucket) -> {
-      int partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) % 
parallelism * bucketNum;
-      int globalIndex = partitionIndex + curBucket;
-      return globalIndex % parallelism;
+      long partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) % 
parallelism * (long) bucketNum;
+      long globalIndex = partitionIndex + curBucket;
+      int partitionId = (int) (globalIndex % parallelism);

Review Comment:
   > Is this long to int causing anything unexpected?
   
   I think not. Because according to the calculation logic, the step of `% 
parallelism ` will ensure that the calculated result is smaller than 
`parallelism `, and `parallelism ` is a variable of `int` type. So even if we 
force cast the result from `long` to `int`, no accident will occur



-- 
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]

Reply via email to