rdblue commented on code in PR #5009:
URL: https://github.com/apache/iceberg/pull/5009#discussion_r910194993


##########
core/src/main/java/org/apache/iceberg/SnapshotSummary.java:
##########
@@ -186,7 +187,13 @@ public Map<String, String> build() {
 
       metrics.addTo(builder);
       setIf(deletedDuplicateFiles > 0, builder, DELETED_DUPLICATE_FILES, 
deletedDuplicateFiles);
-      Set<String> changedPartitions = partitionMetrics.keySet();
+      // Exclude the key that corresponds to PartitionSpec.unpartitioned().
+      // We might want to keep it if and only if the table has had its 
partition spec updated over time and the
+      // write hit two specs (unpartitioned / VOID and an actual bound 
partition spec).
+      Set<String> changedPartitions = partitionMetrics.keySet()
+          .stream()
+          .filter(partKey -> partKey != null && !partKey.isEmpty())
+          .collect(Collectors.toSet());

Review Comment:
   Why not just add a check on the line that adds partition summaries?
   
   ```java
     if (trustPartitionMetrics && isPartitioned && changedPartitions.size() <= 
maxChangedPartitionsForSummaries) {
       ...
     }
   ```
   
   I think that's a cleaner way to do this.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to