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


##########
core/src/main/java/org/apache/iceberg/SchemaUpdate.java:
##########
@@ -201,6 +204,8 @@ public UpdateSchema renameColumn(String name, String 
newName) {
     Types.NestedField field = findField(name);
     Preconditions.checkArgument(field != null, "Cannot rename missing column: 
%s", name);
     Preconditions.checkArgument(newName != null, "Cannot rename a column to 
null");
+    Preconditions.checkArgument(
+        !renamedNameToId.containsKey(newName), "Cannot rename columns to same 
name: %s", newName);

Review Comment:
   Isn't this really just can't rename to an already existing column? Is the 
issue that we do this check at "commit()" time and we need to fail earlier here 
because we are tracking name -> id?



##########
core/src/main/java/org/apache/iceberg/SchemaUpdate.java:
##########
@@ -201,6 +204,8 @@ public UpdateSchema renameColumn(String name, String 
newName) {
     Types.NestedField field = findField(name);
     Preconditions.checkArgument(field != null, "Cannot rename missing column: 
%s", name);
     Preconditions.checkArgument(newName != null, "Cannot rename a column to 
null");
+    Preconditions.checkArgument(
+        !renamedNameToId.containsKey(newName), "Cannot rename columns to same 
name: %s", newName);

Review Comment:
   Isn't this really just can't rename to an already existing column? Is the 
issue that we do this check at "commit()" time and we need to fail earlier here 
because we are tracking rename -> id?



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