LinMingQiang commented on code in PR #5590:
URL: https://github.com/apache/hudi/pull/5590#discussion_r873411817
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/BucketIndexPartitioner.java:
##########
@@ -39,8 +40,9 @@ public BucketIndexPartitioner(int bucketNum, String
indexKeyFields) {
}
@Override
- public int partition(String key, int numPartitions) {
+ public int partition(HoodieKey key, int numPartitions) {
int curBucket = BucketIdentifier.getBucketId(key, indexKeyFields,
bucketNum);
- return BucketIdentifier.mod(curBucket, numPartitions);
+ int globalHash = (key.getPartitionPath() + curBucket).hashCode();
Review Comment:
The result returned here may be negative, which may lead to the error
'java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -27'.
int globalHash = (key.getPartitionPath() + curBucket).hashCode() &
Integer.MAX_VALUE' should be here.
--
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]