aokolnychyi commented on a change in pull request #2956:
URL: https://github.com/apache/iceberg/pull/2956#discussion_r685670522
##########
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))
+ .commit();
+
+ // in v1, the spec will contain 2 fields as we replace fields with void
transforms
+ PartitionSpec v1Expected = PartitionSpec.builderFor(table.schema())
Review comment:
This test illustrates the difference between v1 and v2 behavior. In v1,
we have two partition columns.
--
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]