shanielh commented on code in PR #10737: URL: https://github.com/apache/iceberg/pull/10737#discussion_r1698579700
########## core/src/main/java/org/apache/iceberg/BaseUpdatePartitionSpec.java: ########## @@ -66,20 +66,36 @@ class BaseUpdatePartitionSpec implements UpdatePartitionSpec { this.caseSensitive = true; this.base = ops.current(); this.formatVersion = base.formatVersion(); - this.spec = base.spec(); + fromSpec(base.spec()); + } + + @Override + public UpdatePartitionSpec fromSpec(PartitionSpec partitionSpec) { + // Clear all changes Review Comment: > I'm also wondering if we may have issues here with re-adding a transform that already exists in another spec. I think currently that's handled by re-using the existing transform. > > Example > > ``` > Add Identity (x) > Remove Identity (x) > Add Identity (x) > ``` > > In the current code there would only ever be one Identity(x) transform. Would we be able to maintain that if we did > > ``` > Add Identity(x) > From(Unpartitioned) > Add Identity(x) > ``` > > The above code should be a noop right? I've added more specs, I hope that would answer your question. Calling Add Identity(X), and then Remove Identity(X) within the same UpdatePartitionSpec throws an exception: ``` Cannot delete newly added field: 1001: id: identity(1) java.lang.IllegalArgumentException: Cannot delete newly added field: 1001: id: identity(1) at org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkArgument(Preconditions.java:220) at org.apache.iceberg.BaseUpdatePartitionSpec.removeField(BaseUpdatePartitionSpec.java:247) ``` -- 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