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


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1102,6 +1121,22 @@ public Builder setDefaultPartitionSpec(int specId) {
       return this;
     }
 
+    private Builder removePartitionSpec(PartitionSpec spec) {
+      Preconditions.checkArgument(
+          changes.isEmpty(), "Cannot remove partition spec with other metadata 
update");
+      Preconditions.checkArgument(
+          spec.specId() != defaultSpecId, "Cannot remove default partition 
spec");
+      PartitionSpec toBeRemoved = specsById.remove(spec.specId());
+      Preconditions.checkArgument(
+          toBeRemoved != null && toBeRemoved.equals(spec),
+          "Cannot remove an unknown spec, spec id: %s",
+          spec.specId());
+      this.specs =

Review Comment:
   > Should we be validating that all the specs we are trying to remove exist?
   
   I think so, and L1129 - L1133 indeed ensures the spec to be removed are 
existed in current table metadata.
   
   > I think this may be fine, just thinking about commit conflicts
   
   If you are talking about concurrent `RemovedUnusedSpecs`, I think it's fine 
and reasonable to have only one attempt succeeded once at time. For other 
concurrent commit, there's no conflict and retrying should do the trick.



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