shanielh commented on code in PR #10737:
URL: https://github.com/apache/iceberg/pull/10737#discussion_r1703549673


##########
core/src/test/java/org/apache/iceberg/TestTableUpdatePartitionSpec.java:
##########
@@ -90,6 +90,46 @@ public void testCommitUpdatedSpec() {
     assertThat(table.spec().lastAssignedFieldId()).isEqualTo(1002);
   }
 
+  @TestTemplate
+  public void testCommitFromSpec() {
+    table.updateSpec().addField(bucket("id", 8)).commit();
+
+    // Evolve the spec
+    PartitionSpec evolvedSpec =
+        PartitionSpec.builderFor(table.schema())
+            .withSpecId(1)
+            .bucket("data", 16)
+            .bucket("id", 8, "id_bucket_8")
+            .build();
+    assertThat(table.spec())
+        .as("Should append a partition field to the spec")
+        .isEqualTo(evolvedSpec);
+    assertThat(table.spec().lastAssignedFieldId()).isEqualTo(1001);
+
+    // Restart the spec
+    table
+        .updateSpec()
+        .fromSpec(PartitionSpec.builderFor(table.schema()).build())

Review Comment:
   This won't work as `PartitionSpec.unpartitioned()` has an empty schema, and 
the line after (`.addField(bucket("data", 16))`) would throw: `Cannot find 
field 'data' in struct: struct<>`



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