singhpk234 commented on code in PR #4660:
URL: https://github.com/apache/iceberg/pull/4660#discussion_r860907845


##########
core/src/main/java/org/apache/iceberg/SnapshotSummary.java:
##########
@@ -181,14 +181,14 @@ public Map<String, String> build() {
       builder.putAll(properties);
 
       metrics.addTo(builder);
-      setIf(deletedDuplicateFiles > 0, builder, DELETED_DUPLICATE_FILES, 
deletedDuplicateFiles);
+      SnapshotSummary.set(builder, DELETED_DUPLICATE_FILES, 
deletedDuplicateFiles);
       Set<String> changedPartitions = partitionMetrics.keySet();
-      setIf(trustPartitionMetrics, builder, CHANGED_PARTITION_COUNT_PROP, 
changedPartitions.size());
+      SnapshotSummary.set(builder, CHANGED_PARTITION_COUNT_PROP, 
changedPartitions.size());
 
       if (trustPartitionMetrics && changedPartitions.size() <= 
maxChangedPartitionsForSummaries) {
-        setIf(changedPartitions.size() > 0, builder, PARTITION_SUMMARY_PROP, 
"true");
+        SnapshotSummary.set(builder, PARTITION_SUMMARY_PROP, "true");
         for (String key : changedPartitions) {
-          setIf(key != null, builder, CHANGED_PARTITION_PREFIX + key, 
partitionSummary(partitionMetrics.get(key)));
+          SnapshotSummary.set(builder, CHANGED_PARTITION_PREFIX + key, 
partitionSummary(partitionMetrics.get(key)));

Review Comment:
   [minor] Looks like we are skipping `key != null` check here, is it worth 
re-adding ?



##########
core/src/main/java/org/apache/iceberg/SnapshotSummary.java:
##########
@@ -181,14 +181,14 @@ public Map<String, String> build() {
       builder.putAll(properties);
 
       metrics.addTo(builder);
-      setIf(deletedDuplicateFiles > 0, builder, DELETED_DUPLICATE_FILES, 
deletedDuplicateFiles);
+      SnapshotSummary.set(builder, DELETED_DUPLICATE_FILES, 
deletedDuplicateFiles);
       Set<String> changedPartitions = partitionMetrics.keySet();
-      setIf(trustPartitionMetrics, builder, CHANGED_PARTITION_COUNT_PROP, 
changedPartitions.size());
+      SnapshotSummary.set(builder, CHANGED_PARTITION_COUNT_PROP, 
changedPartitions.size());
 
       if (trustPartitionMetrics && changedPartitions.size() <= 
maxChangedPartitionsForSummaries) {
-        setIf(changedPartitions.size() > 0, builder, PARTITION_SUMMARY_PROP, 
"true");
+        SnapshotSummary.set(builder, PARTITION_SUMMARY_PROP, "true");

Review Comment:
    I believe we need this check back, as if `changedPartitions` is empty we 
should not add  `PARTITION_SUMMARY_PROP` prop (may be we can club this 
requirement with L#188 above).
   
   Otherwise it could give an impression we have partition summary but it's 
empty (which though actually is). Your thoughts ?



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