rdblue commented on a change in pull request #2956:
URL: https://github.com/apache/iceberg/pull/2956#discussion_r686114248
##########
File path: core/src/test/java/org/apache/iceberg/TestUpdatePartitionSpec.java
##########
@@ -424,6 +424,38 @@ public void testAddDeletedName() {
V2Assert.assertEquals("Should match expected spec", v2Expected, updated);
}
+ @Test
+ public void testAddDeletedPartitionBack() {
+ PartitionSpec initialExpectedSpec =
PartitionSpec.builderFor(table.schema())
+ .withSpecId(TableMetadata.INITIAL_SPEC_ID)
+ .bucket("data", 16)
+ .build();
+
+ Assert.assertEquals("Initial spec must match", initialExpectedSpec,
table.spec());
+
+ // remove an existing partition column
+ table.updateSpec()
+ .removeField(bucket("data", 16))
+ .commit();
+
+ // add the same partition column back
+ table.updateSpec()
+ .addField("data_bucket", bucket("data", 16))
Review comment:
This is correct. We changed how name generation was happening was to
avoid conflicts between bucket partition names. For example, if you were moving
from `bucket[16]` to `bucket[32]` and both used `data_bucket` then we would
generate a conflicting name instead, evolution will produce `data_bucket_32`.
--
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]