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


##########
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",
+        specs);
+
+    return commonFieldIds;
+  }
+
+  private static List<Integer> activeFieldIds(PartitionSpec spec) {
+    return spec.fields().stream()

Review Comment:
   Yep, 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