findepi commented on code in PR #6090:
URL: https://github.com/apache/iceberg/pull/6090#discussion_r1013923155


##########
core/src/main/java/org/apache/iceberg/FileCleanupStrategy.java:
##########
@@ -79,4 +80,15 @@ protected void deleteFiles(Set<String> pathsToDelete, String 
fileType) {
             (file, thrown) -> LOG.warn("Delete failed for {} file: {}", 
fileType, file, thrown))
         .run(deleteFunc::accept);
   }
+
+  protected Set<String> expiredStatisticsFilesLocations(
+      TableMetadata beforeExpiration, Set<Long> expiredIds) {
+    Set<String> expiredStatisticsFilesLocations = Sets.newHashSet();
+    for (StatisticsFile statisticsFile : beforeExpiration.statisticsFiles()) {
+      if (expiredIds.contains(statisticsFile.snapshotId())) {
+        expiredStatisticsFilesLocations.add(statisticsFile.path());

Review Comment:
   - `statisticsFile.snapshotId()` is "ID of the Iceberg table's snapshot the 
statistics were computed from",  it's not "ID of the snapshot the file is 
attached to"
   - The spec allows one Puffin file to be attached to multiple snapshots. For 
example, rewrite_files / optimize will produce a new snapshot, but could carry 
forward some/all table-level stats.
     - So, the fact that the snapshot is being forgotten doesn't imply the 
stats file can be safely deleted.



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