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



##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -429,11 +429,16 @@ public TableMetadata updatePartitionSpec(PartitionSpec 
newPartitionSpec) {
       }
     }
 
-    Preconditions.checkArgument(defaultSpecId != newDefaultSpecId,
-        "Cannot set default partition spec to the current default");
+    // Always setting default partition spec to the new partition spec
+    ImmutableList.Builder<PartitionSpec> builder = ImmutableList.builder();
+    for (PartitionSpec spec : specs) {
+      if (spec.specId() == newDefaultSpecId) {
+        builder.add(freshSpec(newDefaultSpecId, schema, newPartitionSpec));
+      } else {
+        builder.add(spec);
+      }
+    }

Review comment:
       I'm not sure that this is the right change. I think it's a good idea to 
allow calling this method with the same spec, but that should be detected and 
should return the exact same TableMetadata. That way, the commit will appear to 
succeed, but won't actually change the table (no-op commits are used elsewhere, 
too).




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