aokolnychyi commented on a change in pull request #2956:
URL: https://github.com/apache/iceberg/pull/2956#discussion_r685669960



##########
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:
       **Attention**: I had to use the exact name to reuse the partition spec. 
It looks like the partition field name generation is different during the 
initial table creation and during spec evolution. 
   
   For example, if I create a table partitioned by `bucket("data", 16)`, the 
name is `data_bucket`. If I add such a partition field, the assigned name will 
be `data_bucket_16`.




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

Reply via email to