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 2021/02/01 05:28:08 UTC

[GitHub] [iceberg] PiyushHurpadeDremio commented on a change in pull request #2182: Support for PartitionStatsFile in each snapshot

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:
users@infra.apache.org



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