This is an automated email from the ASF dual-hosted git repository.

stevenzwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/main by this push:
     new 29d21c2b73 Core: Handle null snapshot summary during incremental 
cleanup (#18624)
29d21c2b73 is described below

commit 29d21c2b73c2fb910cd7fa513dc2229327037846
Author: Prathamesh Kulkarni <[email protected]>
AuthorDate: Wed Oct 28 22:52:42 2026 -0700

    Core: Handle null snapshot summary during incremental cleanup (#18624)
---
 .../org/apache/iceberg/IncrementalFileCleanup.java   | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/core/src/main/java/org/apache/iceberg/IncrementalFileCleanup.java 
b/core/src/main/java/org/apache/iceberg/IncrementalFileCleanup.java
index 73a1e4584f..2117cb1a6d 100644
--- a/core/src/main/java/org/apache/iceberg/IncrementalFileCleanup.java
+++ b/core/src/main/java/org/apache/iceberg/IncrementalFileCleanup.java
@@ -97,14 +97,15 @@ class IncrementalFileCleanup extends FileCleanupStrategy {
 
     Set<Long> pickedAncestorSnapshotIds = Sets.newHashSet();
     for (long snapshotId : ancestorIds) {
-      String sourceSnapshotId =
-          beforeExpiration
-              .snapshot(snapshotId)
-              .summary()
-              .get(SnapshotSummary.SOURCE_SNAPSHOT_ID_PROP);
+      Map<String, String> summary = 
beforeExpiration.snapshot(snapshotId).summary();
+      Long sourceSnapshotId =
+          summary != null
+              ? PropertyUtil.propertyAsNullableLong(
+                  summary, SnapshotSummary.SOURCE_SNAPSHOT_ID_PROP)
+              : null;
       if (sourceSnapshotId != null) {
         // protect any snapshot that was cherry-picked into the current table 
state
-        pickedAncestorSnapshotIds.add(Long.parseLong(sourceSnapshotId));
+        pickedAncestorSnapshotIds.add(sourceSnapshotId);
       }
     }
 
@@ -192,9 +193,12 @@ class IncrementalFileCleanup extends FileCleanupStrategy {
                   return;
                 }
 
+                Map<String, String> summary = snapshot.summary();
                 long sourceSnapshotId =
-                    PropertyUtil.propertyAsLong(
-                        snapshot.summary(), 
SnapshotSummary.SOURCE_SNAPSHOT_ID_PROP, -1);
+                    summary != null
+                        ? PropertyUtil.propertyAsLong(
+                            summary, SnapshotSummary.SOURCE_SNAPSHOT_ID_PROP, 
-1)
+                        : -1;
                 if (ancestorIds.contains(sourceSnapshotId)) {
                   // this commit was cherry-picked from a commit that is in 
the current table state.
                   // do not clean up its changes because it would revert data 
file additions that

Reply via email to