laserninja commented on code in PR #14354:
URL: https://github.com/apache/iceberg/pull/14354#discussion_r2441581725


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -282,4 +309,113 @@ private ExpireSnapshots.Result 
deleteFiles(Iterator<FileInfo> files) {
         .deletedStatisticsFilesCount(summary.statisticsFilesCount())
         .build();
   }
+
+  /**
+   * Logs which snapshots will be expired and the reasons for expiration. This 
helps debug issues
+   * where more files than expected were deleted.
+   */
+  private void logSnapshotExpirationReasons(TableMetadata metadata) {
+    LOG.info("=== Snapshot Expiration Analysis ===");
+
+    // Determine snapshots that will be kept for retain_last calculation
+    Set<Long> snapshotsToKeep = Sets.newHashSet();
+    if (retainLastValue != null) {
+      List<Snapshot> sortedSnapshots =
+          metadata.snapshots().stream()

Review Comment:
   What happens when metadata.snapshot() returns null? Will it fail?



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