You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/12/07 00:02:22 UTC

[GitHub] [iceberg] CodingCat commented on a change in pull request #3632: Core: Allow deleting and adding the same column

CodingCat commented on a change in pull request #3632:
URL: https://github.com/apache/iceberg/pull/3632#discussion_r763511976



##########
File path: core/src/test/java/org/apache/iceberg/TestUpdatePartitionSpec.java
##########
@@ -614,6 +605,65 @@ public void testRemoveAndAddMultiTimes() {
     V2Assert.assertEquals("Should match expected spec", v2Expected, updated);
   }
 
+  @Test
+  public void testRemoveAndUpdateWithIdentity() {
+    PartitionSpec expected = PartitionSpec.builderFor(SCHEMA)
+            .identity("ts")
+            .build();
+    PartitionSpec updated = new BaseUpdatePartitionSpec(formatVersion, expected)
+            .removeField("ts")
+            .addField("ts")
+            .apply();
+
+    if (formatVersion == 1) {
+      Assert.assertEquals("Should match expected spec field size", 2, updated.fields().size());
+      Assert.assertEquals("Should match expected field name", "ts",
+              updated.fields().get(0).name());
+      Assert.assertEquals("Should match expected field name", "ts",
+              updated.fields().get(1).name());

Review comment:
       thanks for the review @rdblue ! I tried to rename the field, however the test was failed due to the limitation that we cannot delete and rename a partition col (https://github.com/apache/iceberg/blob/619603c443a200f687284c01d13e5961a920c036/core/src/main/java/org/apache/iceberg/BaseUpdatePartitionSpec.java#L221-L222), 
   
   so I end up adding a hashset in partition set to store the fields being transformed with Void, 
   
   please let me know if it sounds good to you, thanks!




-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org