rdsarvar commented on code in PR #11368:
URL: https://github.com/apache/iceberg/pull/11368#discussion_r1812745126


##########
api/src/main/java/org/apache/iceberg/UpdatePartitionSpec.java:
##########
@@ -133,4 +133,16 @@ default UpdatePartitionSpec addNonDefaultSpec() {
     throw new UnsupportedOperationException(
         this.getClass().getName() + " doesn't implement addNonDefaultSpec()");
   }
+
+  /**
+   * Explicitly providing the partition spec that we would like to use. When a 
spec has been
+   * provided then modifications should not be done afterwards through this 
class.
+   *
+   * @param newSpec partition spec to override the builder use during commit
+   * @return this for method chaining names.
+   */
+  default UpdatePartitionSpec useSpec(PartitionSpec newSpec) {

Review Comment:
   > We probably want to walk diff the specs and make the necessary updates.
   
   Are you thinking something simple like:
   
   - Iterate through existing partition spec and removeField all fields
   - Iterate through new spec and addField all fields
   
   Or were you thinking something like:
   
   - Run 'old DIFF new' to find the fields to `removeField` against
   - Iterate through the 'new' spec and check if the current spec has the 
field, if not then add it
   
   Though this approach wouldn't guarantee the partition ordering of terms, 
right? If I was the end user I'd expect the spec being added matches the 
ordering I provided exactly.
   
   ^ This last statement is mostly why I was thinking having a 'replace' 
functionality would make a bit more sense than an 'update' but I don't think 
I'm ramped up enough yet on the repo and historical decisions 😄 
   
   What are your thoughts on it?



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