PiyushHurpadeDremio commented on a change in pull request #2182:
URL: https://github.com/apache/iceberg/pull/2182#discussion_r567571695



##########
File path: core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java
##########
@@ -494,6 +499,48 @@ private ManifestFile newDeleteFilesAsManifest() {
     return cachedNewDeleteManifest;
   }
 
+  @Override
+  protected Map<Integer, String> updatePartitionStats() {
+    Map<Integer, String> newPartitionStatsLocations = new HashMap<>();
+
+    int currentSpecID = ops.current().spec().specId();
+
+    /**
+     *  Update Partition Stats for Delete operation
+     */
+    PartitionStatsMap deletePartitionStatsMap = 
filterManager.getPartitionStatsMap();
+    deletePartitionStatsMap.getAllUpdatedPartitionSpec().forEach(
+        specId -> {
+          if (specId != currentSpecID) {
+            List<PartitionStatsEntry> statsEntries = 
getOldPartitionStatsBySpec(specId);
+            PartitionsTable.PartitionMap parMap = 
deletePartitionStatsMap.getPartitionMap(specId);
+            parMap.subtractFromPartitionStatsEntries(statsEntries);
+            OutputFile outputFile = newPartitionStatsFile(specId);
+            newPartitionStatsLocations.put(specId, outputFile.location());
+            writePartitionStatsEntries(parMap.getAllPartitionStatsEntries(), 
outputFile, specId);

Review comment:
       We are re-using partition stats from the previous snapshot only. this 
loop iterate over only specifications that got updated as a part of 
deleteFile(CharSequence path), deleteFile(DataFile file), 
deleteFromRowFilter(Expression expr) operation.  
deletePartitionStatsMap.getAllUpdatedPartitionSpec() this will return only 
partition specifications that got updated.




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

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