KnightChess commented on PR #13265:
URL: https://github.com/apache/hudi/pull/13265#issuecomment-2868294830

   @danny0405 I think one improved approach is to modify the following line of 
code for local algorithm. However, this would still result in an excessively 
large number of reduce tasks and fail to completely resolve the issue of 
partition key conflicts. If there is no centralized allocation of partition 
IDs, it is indeed impossible to fully handle the issue of partition key 
conflicts.
   `int partitionId = (int) (globalIndex % parallelism); `
   -> `int partitionId = globalIndex;`
   use globalindex
   ```
   public static Functions.Function3<Integer, String, Integer, Integer> 
getPartitionIndexFunc(int parallelism) {
       return (bucketNum, partition, curBucket) -> {
         long partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) % 
parallelism * (long) bucketNum;
         long globalIndex = partitionIndex + curBucket;
         int partitionId = (int) (globalIndex % parallelism);
         ValidationUtils.checkArgument(partitionId >= 0 && partitionId < 
parallelism,
             () -> "Partition id should be in range [0, " + parallelism + "), 
but got " + partitionId);
         return partitionId;
       };
     }
   ```


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