nastra commented on code in PR #11323:
URL: https://github.com/apache/iceberg/pull/11323#discussion_r1801684210


##########
core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java:
##########
@@ -138,20 +138,16 @@ protected boolean isCaseSensitive() {
   }
 
   protected PartitionSpec dataSpec() {
-    Set<PartitionSpec> specs = dataSpecs();
+    Set<PartitionSpec> specs =
+        
newDataFilesBySpec.keySet().stream().map(this::spec).collect(ImmutableSet.toImmutableSet());
+    Preconditions.checkState(
+        !specs.isEmpty(), "Cannot determine partition specs: no data files 
have been added");
     Preconditions.checkState(
         specs.size() == 1,
         "Cannot return a single partition spec: data files with different 
partition specs have been added");
     return specs.iterator().next();
   }
 
-  protected Set<PartitionSpec> dataSpecs() {

Review Comment:
   this method hasn't been used anywhere else, so I think it's fine to inline it



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