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


##########
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:
   I prefer not to support such usages, it's too complicated and seldom used. 
This check aims to prevent such usages early:
   ```
   update.rename("a", "b").rename("c", "b")
   ```



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