rdblue commented on a change in pull request #2204:
URL: https://github.com/apache/iceberg/pull/2204#discussion_r572258979



##########
File path: core/src/main/java/org/apache/iceberg/SchemaUpdate.java
##########
@@ -138,12 +138,13 @@ private void internalAddColumn(String parent, String 
name, boolean isOptional, T
       parentId = parentField.fieldId();
       Preconditions.checkArgument(!deletes.contains(parentId),
           "Cannot add to a column that will be deleted: %s", parent);
-      Preconditions.checkArgument(schema.findField(parent + "." + name) == 
null,
-          "Cannot add column, name already exists: %s.%s", parent, name);
+      Preconditions.checkArgument(schema.findField(parent + "." + name) == 
null ||
+                      deletes.contains(schema.findField(parent + "." + 
name).fieldId()),
+          "Cannot add column, name already exists and is not being deleted: 
%s.%s", parent, name);

Review comment:
       I don't think the error message needs to change. It isn't helpful in 
most cases to add the "and is not being deleted". That makes it harder to 
understand when adding a deleted column is a rare case.




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

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