rdblue commented on a change in pull request #3632:
URL: https://github.com/apache/iceberg/pull/3632#discussion_r767336651
##########
File path: core/src/main/java/org/apache/iceberg/BaseUpdatePartitionSpec.java
##########
@@ -151,13 +151,17 @@ public BaseUpdatePartitionSpec addField(String name, Term
term) {
transformToAddedField.put(validationKey, newField);
PartitionField existingField = nameToField.get(newField.name());
- if (existingField != null) {
+
+ if (existingField != null && !deletes.contains(existingField.fieldId())) {
if (isVoidTransform(existingField)) {
// rename the old deleted field that is being replaced by the new field
renameField(existingField.name(), existingField.name() + "_" +
existingField.fieldId());
} else {
throw new IllegalArgumentException(String.format("Cannot add duplicate
partition field name: %s", name));
}
+ } else if (existingField != null &&
deletes.contains(existingField.fieldId())) {
+ renameFieldInternal(existingField.name(), existingField.name() + "_" +
existingField.fieldId(),
+ true);
Review comment:
It would be better to wrap all the arguments on a single line rather
than have just the last one on its own.
```java
renameFieldInternal(
existingField.name(), existingField.name() + "_" +
existingField.fieldId(), true);
```
Also, indentation is incorrect here. Continuing indentation should be 4
spaces.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]