singhpk234 commented on code in PR #14502:
URL: https://github.com/apache/iceberg/pull/14502#discussion_r2700372686


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -343,11 +343,15 @@ public String toString() {
     // changes are carried through until metadata is read from a file
     this.changes = changes;
 
-    this.snapshotsById = indexAndValidateSnapshots(snapshots, 
lastSequenceNumber);
+    this.snapshotsById =
+        this.snapshots != null
+            ? indexAndValidateSnapshots(this.snapshots, lastSequenceNumber)
+            : ImmutableMap.of();

Review Comment:
   Agree, this is not needed for this pr at all this is mostly for case when 
snapshot is null and we call indexAndValidateSnapshots which fails with an NPE 
here 
   ```
     private static Map<Long, Snapshot> indexAndValidateSnapshots(
         List<Snapshot> snapshots, long lastSequenceNumber) {
       for (Snapshot snap : snapshots) {
         ....
       }
       return builder.build();
     }
   ```
   
   Happy to remove it or create a seperate pr for fixing this, caught this 
while testing projection



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