aokolnychyi commented on code in PR #6163:
URL: https://github.com/apache/iceberg/pull/6163#discussion_r1019735287


##########
core/src/test/java/org/apache/iceberg/TestPartitioning.java:
##########
@@ -43,6 +43,12 @@ public class TestPartitioning {
           required(1, "id", Types.IntegerType.get()),
           required(2, "data", Types.StringType.get()),
           required(3, "category", Types.StringType.get()));
+  private static final PartitionSpec BY_DATA_SPEC =
+      PartitionSpec.builderFor(SCHEMA).identity("data").build();
+  private static final PartitionSpec BY_CATEGORY_DATA_SPEC =
+      
PartitionSpec.builderFor(SCHEMA).identity("category").identity("data").build();
+  private static final PartitionSpec BY_DATA_CATEGORY_BUCKET_SPEC =
+      PartitionSpec.builderFor(SCHEMA).identity("data").bucket("category", 
8).build();
 

Review Comment:
   There are some slight differences in how other tests behave for different 
format versions. We can cover that with assumes and v1 and v2 checks. Since it 
is an existing class, though, I'd consider refactoring in a separate PR.



##########
core/src/main/java/org/apache/iceberg/Partitioning.java:
##########
@@ -298,4 +324,33 @@ private static boolean compatibleTransforms(Transform<?, 
?> t1, Transform<?, ?>
         || t1.equals(Transforms.alwaysNull())
         || t2.equals(Transforms.alwaysNull());
   }
+
+  private static Set<Integer> 
commonPartitionFieldIds(Collection<PartitionSpec> specs) {
+    Set<Integer> commonFieldIds = Sets.newHashSet();
+
+    int specIndex = 0;
+    for (PartitionSpec spec : specs) {
+      if (specIndex == 0) {
+        commonFieldIds.addAll(activeFieldIds(spec));
+      } else {
+        commonFieldIds.retainAll(activeFieldIds(spec));
+      }
+
+      specIndex++;
+    }
+
+    ValidationException.check(
+        commonFieldIds.size() > 0 || specs.size() == 1,
+        "Specs do not have any common fields: %s",

Review Comment:
   Correct.



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