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


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -980,11 +980,15 @@ public Builder addSortOrder(SortOrder order) {
     }
 
     public Builder addSnapshot(Snapshot snapshot) {
-      if (snapshot == null || 
snapshotsById.containsKey(snapshot.snapshotId())) {
+      if (snapshot == null) {
         // change is a noop
         return this;
       }
 
+      
ValidationException.check(!snapshotsById.containsKey(snapshot.snapshotId()),
+          "Snapshot already exist for the id: %s",
+          snapshot.snapshotId());

Review Comment:
   @RussellSpitzer, what do you think about this? Any situations where you 
think this would cause an issue because we add the same snapshot and rely on 
the operation being idempotent?



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