rdblue commented on code in PR #5601:
URL: https://github.com/apache/iceberg/pull/5601#discussion_r953082918
##########
api/src/main/java/org/apache/iceberg/transforms/Bucket.java:
##########
@@ -159,111 +172,53 @@ public Type getResultType(Type sourceType) {
return Types.IntegerType.get();
}
- private static class BucketInteger extends Bucket<Integer> {
+ private static class BucketInteger extends Bucket<Integer> implements
Function<Integer, Integer> {
private BucketInteger(int numBuckets) {
super(numBuckets);
}
@Override
- public int hash(Integer value) {
+ protected int hash(Integer value) {
return BucketUtil.hash(value);
}
-
- @Override
- public boolean canTransform(Type type) {
- return type.typeId() == TypeID.INTEGER || type.typeId() == TypeID.DATE;
- }
}
- private static class BucketLong extends Bucket<Long> {
+ private static class BucketLong extends Bucket<Long> implements
Function<Long, Integer> {
Review Comment:
We should decide this. There are places where we do serialize them, instead
of `Transform`. `Transform` must be `Serializable` because `PartitionSpec` is.
Just replacing `Transform` with `Function` caused some places to fail if I used
a lambda (not serializable) so I made everything `Serializable`. But we could
choose to send the transform and lazily get the `Function`.
I think it's probably best to make everything `Serializable` just in case,
though.
--
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]