You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "xicm (via GitHub)" <gi...@apache.org> on 2025/01/21 10:02:07 UTC
[I] Question about hash of BucketInteger [iceberg]
xicm opened a new issue, #12015:
URL: https://github.com/apache/iceberg/issues/12015
### Query engine
_No response_
### Question
```
private static class BucketInteger extends Bucket<Integer>
implements SerializableFunction<Integer, Integer> {
private BucketInteger(int numBuckets) {
super(numBuckets);
}
@Override
protected int hash(Integer value) {
return BucketUtil.hash(value);
}
}
```
Why do we use Murmur3 instead of the int value itself?
test code
```
Bucket bucket = Bucket.get(Types.IntegerType.get(), 10);
List<Integer> list = new ArrayList<>();
List<Integer> randomList = new ArrayList<>();
Random rand = new Random();
for (int i = 0; i < 10000000; i++) {
int num = rand.nextInt(10000);
randomList.add(bucket.apply(num));
list.add(bucket.apply(i));
}
System.out.println("natural list");
list.stream()
.collect(Collectors.groupingBy(item -> item, Collectors.counting()))
.forEach((key, value) -> System.out.println(key + ": " + value));
System.out.println("random list");
randomList.stream()
.collect(Collectors.groupingBy(item -> item, Collectors.counting()))
.forEach((key, value) -> System.out.println(key + ": " + value));
```
result with Murmur3
```
natural list
0: 1000996
1: 999922
2: 1000005
3: 1000139
4: 1001529
5: 998785
6: 999291
7: 999777
8: 999204
9: 1000352
random list
0: 998404
1: 1005602
2: 1021090
3: 1021668
4: 996615
5: 1046078
6: 1023192
7: 997321
8: 923906
9: 966124
```
result of the origin value
```
natural list
0: 1000000
1: 1000000
2: 1000000
3: 1000000
4: 1000000
5: 1000000
6: 1000000
7: 1000000
8: 1000000
9: 1000000
random list
0: 1001911
1: 997982
2: 999024
3: 1000518
4: 999166
5: 999954
6: 1001863
7: 1000033
8: 997981
9: 1001568
```
--
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: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Question about hash of BucketInteger [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #12015:
URL: https://github.com/apache/iceberg/issues/12015#issuecomment-3094926009
This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Question about hash of BucketInteger [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #12015: Question about hash of BucketInteger
URL: https://github.com/apache/iceberg/issues/12015
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Question about hash of BucketInteger [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #12015:
URL: https://github.com/apache/iceberg/issues/12015#issuecomment-3148806001
This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org