szehon-ho commented on code in PR #13167:
URL: https://github.com/apache/iceberg/pull/13167#discussion_r2118088454


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/functions/BucketFunction.java:
##########
@@ -128,6 +133,23 @@ public String name() {
     public DataType resultType() {
       return DataTypes.IntegerType;
     }
+
+    public int gcd(int num1, int num2) {

Review Comment:
   nit: a, b for brevity?  Not sure if num1, num2 carries any more extra 
information



##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/functions/BucketFunction.java:
##########
@@ -128,6 +133,23 @@ public String name() {
     public DataType resultType() {
       return DataTypes.IntegerType;
     }
+
+    public int gcd(int num1, int num2) {
+      return 
BigInteger.valueOf(num1).gcd(BigInteger.valueOf(num2)).intValueExact();

Review Comment:
   there seems no need for intValueExact?



##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/functions/BucketFunction.java:
##########
@@ -128,6 +133,23 @@ public String name() {
     public DataType resultType() {
       return DataTypes.IntegerType;
     }
+
+    public int gcd(int num1, int num2) {

Review Comment:
   no need for public here



##########
spark/v4.0/spark/src/test/java/org/apache/iceberg/spark/sql/TestStoragePartitionedJoins.java:
##########
@@ -549,6 +555,88 @@ public void testJoinsWithMismatchingPartitionKeys() {
         tableName(OTHER_TABLE_NAME));
   }
 
+  @TestTemplate
+  public void testJoinsCompatibleBucketNumbers() {
+    sql(
+        "CREATE TABLE %s (id BIGINT, int_col INT, dep STRING)"
+            + "USING iceberg "
+            + "PARTITIONED BY (bucket(4, id))"
+            + "TBLPROPERTIES (%s)",
+        tableName, tablePropsAsString(TABLE_PROPERTIES));
+
+    sql("INSERT INTO %s VALUES (1L, 100, 'software')", tableName);

Review Comment:
   can we run these in one single statement to save test time?  (same for the 
other inserts below)



-- 
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-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to