rdblue commented on a change in pull request #2284:
URL: https://github.com/apache/iceberg/pull/2284#discussion_r603679451



##########
File path: core/src/test/java/org/apache/iceberg/TestTableMetadata.java
##########
@@ -587,6 +587,62 @@ public void testInvalidUpdatePartitionSpecForV1Table() 
throws Exception {
         () -> metadata.updatePartitionSpec(spec));
   }
 
+  @Test
+  public void testUpdatePartitionSpecForV1Table() {
+    Schema schema = new Schema(
+        Types.NestedField.required(1, "x", Types.LongType.get()),
+        Types.NestedField.required(2, "y", Types.LongType.get())
+    );
+
+    PartitionSpec spec = PartitionSpec.builderFor(schema).withSpecId(0)
+        .bucket("x", 8)
+        .build();
+    String location = "file://tmp/db/table";
+
+    TableMetadata metadata = TableMetadata.newTableMetadata(
+        schema, spec, SortOrder.unsorted(), location, ImmutableMap.of(), 1);
+    TableMetadata updated = metadata.updatePartitionSpec(spec);
+    Assert.assertEquals(spec, updated.spec());
+
+    spec = PartitionSpec.builderFor(schema).withSpecId(1)

Review comment:
       This violates v1 requirements because the partition field ID for 
`bucket(8, x)` is reassigned. It is 1000 in the first spec and 1001 in the 
second spec.




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

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