aokolnychyi commented on code in PR #6163: URL: https://github.com/apache/iceberg/pull/6163#discussion_r1023102332
########## core/src/main/java/org/apache/iceberg/Partitioning.java: ########## @@ -298,4 +331,37 @@ private static boolean compatibleTransforms(Transform<?, ?> t1, Transform<?, ?> || t1.equals(Transforms.alwaysNull()) || t2.equals(Transforms.alwaysNull()); } + + // collects IDs of all partition field used across specs + private static Set<Integer> allFieldIds(Collection<PartitionSpec> specs) { + return FluentIterable.from(specs) + .transformAndConcat(PartitionSpec::fields) + .transform(PartitionField::fieldId) + .toSet(); + } + + // collects IDs of partition fields with non-void transforms that are present in each spec + private static Set<Integer> commonActiveFieldIds(Collection<PartitionSpec> specs) { + Set<Integer> commonActiveFieldIds = Sets.newHashSet(); + + int specIndex = 0; + for (PartitionSpec spec : specs) { + if (specIndex == 0) { + commonActiveFieldIds.addAll(activeFieldIds(spec)); + } else { + commonActiveFieldIds.retainAll(activeFieldIds(spec)); Review Comment: There is a very very limited chance the ID is not unique in v1 tables but that should be covered by a check above. I have a test that checks we throw an exception in that case. -- 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