nastra commented on code in PR #10755:
URL: https://github.com/apache/iceberg/pull/10755#discussion_r1856450913


##########
core/src/main/java/org/apache/iceberg/UpdateRequirements.java:
##########
@@ -173,6 +175,27 @@ private void update(MetadataUpdate.SetDefaultSortOrder 
unused) {
       }
     }
 
+    private void update(MetadataUpdate.RemovePartitionSpecs unused) {
+      // require that the default partition spec has not changed
+      if (!setSpecId) {
+        if (base != null && !isReplace) {
+          require(new 
UpdateRequirement.AssertDefaultSpecID(base.defaultSpecId()));
+        }
+        this.setSpecId = true;
+      }
+
+      // require that no branches have changed, so that old specs won't be 
written.
+      if (base != null && !isReplace) {
+        base.refs()
+            .forEach(
+                (name, ref) -> {
+                  if (ref.isBranch() && !name.equals(SnapshotRef.MAIN_BRANCH)) 
{
+                    require(new UpdateRequirement.AssertRefSnapshotID(name, 
ref.snapshotId()));

Review Comment:
   in addition to this, `CatalogTests` currently only tests the happy path, but 
not the exceptions that are either thrown by `AssertDefaultSpecID` or 
`AssertRefSnapshotID`. We need to test both cases in `CatalogTests`



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to