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



##########
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);
       fullName = schema.findColumnName(parentId) + "." + name;
     } else {
-      Preconditions.checkArgument(schema.findField(name) == null,
-          "Cannot add column, name already exists: %s", name);
+      Preconditions.checkArgument(schema.findField(name) == null || 
deletes.contains(schema.findField(name).fieldId()),
+          "Cannot add column, name already exists and is not being deleted: 
%s", name);

Review comment:
       Similar comments here about the error message and new variable.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to