You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/06/29 16:49:10 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #5009: [CORE] - Fix snapshot summary generating partition summary metrics for unpartitioned tables

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) {
       ...
     }
   ```



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org