RussellSpitzer commented on code in PR #10737:
URL: https://github.com/apache/iceberg/pull/10737#discussion_r1703559470


##########
core/src/main/java/org/apache/iceberg/BaseUpdatePartitionSpec.java:
##########
@@ -62,15 +62,20 @@ class BaseUpdatePartitionSpec implements 
UpdatePartitionSpec {
   private int lastAssignedPartitionId;
 
   BaseUpdatePartitionSpec(TableOperations ops) {
+    this(ops, ops.current().spec());
+  }
+
+  BaseUpdatePartitionSpec(TableOperations ops, PartitionSpec spec) {
     this.ops = ops;
     this.caseSensitive = true;
     this.base = ops.current();
     this.formatVersion = base.formatVersion();
-    this.spec = base.spec();
+    this.spec = spec;
     this.schema = spec.schema();
     this.nameToField = indexSpecByName(spec);
     this.transformToField = indexSpecByTransform(spec);
-    this.lastAssignedPartitionId = base.lastAssignedPartitionId();
+    this.lastAssignedPartitionId =

Review Comment:
   I'm not sure I follow and I don't think this is correct. I think if 
base.lastMetadataAssigned doesn't work then the logic in the code is incorrect 
for using this value/ re-using existing fields. 
   
   In V1 and V2 it should be the same. 
   
   
   V1:
   ```
   Add a transform identity(x) and get 1000 as the id
   Spec 1 = (1000: Identity(x))
   Remove identity(x), the transform is changed to void(x) in the new spec. 
   Spec 2 = (1000: Void())
   Add identity(x) 
   This should reset current spec to Spec 1
   Add identity (y)
   Spec 3 = (1000: Identity (x), 1001: Identity(y))
   ```
   
   V2
   ```
   Add a transform identity(x) and get 1000 as the id
   Spec 1 = (1000: Identity(x))
   Remove identity(x), the transform is changed to void(x) in the new spec. 
   Spec 2 = ()
   Add identity(x) 
   This should reset current spec to Spec 1
   Add identity(y)
   Spec 3 = (1000: Identity(x), 1001: identity (y))
   ```
   



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