bryanck commented on code in PR #5235:
URL: https://github.com/apache/iceberg/pull/5235#discussion_r917440086


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -985,10 +1012,12 @@ public Builder addSnapshot(Snapshot snapshot) {
         return this;
       }
 
+      ValidationException.check(!schemas.isEmpty(), "Attempting to add a 
snapshot before a schema is added");
+      ValidationException.check(!specs.isEmpty(), "Attempting to add a 
snapshot before a partition spec is added");
+      ValidationException.check(!sortOrders.isEmpty(), "Attempting to add a 
snapshot before a sort order is added");

Review Comment:
   When building metadata from empty, the table specs aren't initialized. These 
assertions ensure they are set before adding files, so files added during a 
transaction line up with the table specs.



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