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


##########
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:
   Ah, I see that this is because `TableMetadataProjection` inherits from 
`TableMetadata`. I think that pattern would cause problems as I mentioned above 
because `TableMetadataProjection` is a perfectly valid `TableMetadata`.
   
   Is this really needed? If the idea is to transform snapshots when they are 
returned by accessors, you may not need to change this class at all.



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