vinson0526 commented on a change in pull request #2691:
URL: https://github.com/apache/iceberg/pull/2691#discussion_r649020719



##########
File path: core/src/main/java/org/apache/iceberg/BaseUpdatePartitionSpec.java
##########
@@ -223,7 +223,9 @@ public PartitionSpec apply() {
         // field IDs were not required for v1 and were assigned sequentially 
in each partition spec starting at 1,000.
         // to maintain consistent field ids across partition specs in v1 
tables, any partition field that is removed
         // must be replaced with a null transform. null values are always 
allowed in partition data.
-        builder.add(field.sourceId(), field.fieldId(), field.name(), 
Transforms.alwaysNull());
+        // To avoid name conflict when add and remove same partition transform 
multiple times, field name will be
+        // replaced by field name append with field id.
+        builder.add(field.sourceId(), field.fieldId(), field.name() + "_" + 
field.fieldId(), Transforms.alwaysNull());

Review comment:
       we cannot use constant name for removed field, because partition spec 
field name must be unique.
   Since removed field is not really used, we need to change it name to some 
that not conflict with new field.
   UUID cannot ensure generate unique.
   field.fieldId() is unique, because we generate it from 1000 and 
auto-increment for new field.
   Maybe field.name() + field.fieldId() + UUID is better?




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