findepi opened a new issue #2837:
URL: https://github.com/apache/iceberg/issues/2837


   For example, when bucketing string into 32 buckets, the value 
`"\uD83D\uDCB0"` (`"💰"`) gets assigned a wrong bucket
   
   ### Expected bucket: 12
   
   
   Per specification, string hash is `hashBytes(utf8Bytes(v))`
   
   ```
   int hash = 
Hashing.murmur3_32().hashBytes("\uD83D\uDCB0".getBytes(StandardCharsets.UTF_8)).asInt()
 & Integer.MAX_VALUE;
   int bucket = hash % 32;
   System.out.println("hash = " + hash); // 661122892
   System.out.println("bucket = " + bucket); // 12
   ```
   
   ### Actual bucket: 4
   
   ```
   Integer bucket = new 
org.apache.iceberg.transforms.Bucket.BucketString(32).apply("\uD83D\uDCB0");
   System.out.println("bucket = " + bucket); // 4
   ```
   
   ### Assumed root cause
   
   `BucketString` code:
   
https://github.com/apache/iceberg/blob/0c50b2074cd5dad59bbcb4b4599ec3ae11a34b49/api/src/main/java/org/apache/iceberg/transforms/Bucket.java#L239
   
   is affected by https://github.com/google/guava/issues/5648


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

Reply via email to