You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/09/02 16:24:05 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #5601: API: Remove source type from Transform

rdblue commented on code in PR #5601:
URL: https://github.com/apache/iceberg/pull/5601#discussion_r961841039


##########
api/src/main/java/org/apache/iceberg/transforms/Bucket.java:
##########
@@ -18,52 +18,53 @@
  */
 package org.apache.iceberg.transforms;
 
-import static org.apache.iceberg.types.Type.TypeID;
-
+import java.io.Serializable;
 import java.math.BigDecimal;
 import java.nio.ByteBuffer;
-import java.util.Set;
 import java.util.UUID;
+import java.util.function.Function;
 import org.apache.iceberg.expressions.BoundPredicate;
 import org.apache.iceberg.expressions.BoundTransform;
 import org.apache.iceberg.expressions.Expression;
 import org.apache.iceberg.expressions.Expressions;
 import org.apache.iceberg.expressions.UnboundPredicate;
-import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting;
 import org.apache.iceberg.relocated.com.google.common.base.Objects;
 import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
-import org.apache.iceberg.relocated.com.google.common.collect.Sets;
-import org.apache.iceberg.relocated.com.google.common.hash.HashFunction;
-import org.apache.iceberg.relocated.com.google.common.hash.Hashing;
 import org.apache.iceberg.types.Type;
 import org.apache.iceberg.types.Types;
 import org.apache.iceberg.util.BucketUtil;
+import org.apache.iceberg.util.SerializableFunction;
 
-abstract class Bucket<T> implements Transform<T, Integer> {
-  private static final HashFunction MURMUR3 = Hashing.murmur3_32_fixed();
+class Bucket<T> implements Transform<T, Integer>, Serializable {
+  static <T> Bucket<T> get(int numBuckets) {
+    Preconditions.checkArgument(
+        numBuckets > 0, "Invalid number of buckets: %s (must be > 0)", numBuckets);
+    return new Bucket<>(numBuckets);
+  }
 
   @SuppressWarnings("unchecked")
-  static <T> Bucket<T> get(Type type, int numBuckets) {
+  static <T, B extends Bucket<T> & SerializableFunction<T, Integer>> B get(

Review Comment:
   No, this is internal so we don't need to. Deprecating it now would just add warnings that we don't need.



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