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/03 23:19:52 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #3664: Add table metadata builder

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



##########
File path: api/src/main/java/org/apache/iceberg/PartitionSpec.java
##########
@@ -499,10 +499,14 @@ Builder add(int sourceId, int fieldId, String name, Transform<?, ?> transform) {
     }
 
     public PartitionSpec build() {
-      PartitionSpec spec = new PartitionSpec(schema, specId, fields, lastAssignedFieldId.get());
+      PartitionSpec spec = buildUnchecked();
       checkCompatibility(spec, schema);
       return spec;
     }
+
+    PartitionSpec buildUnchecked() {
+      return new PartitionSpec(schema, specId, fields, lastAssignedFieldId.get());
+    }

Review comment:
       This is needed for table replacement. Previously, building the replacement table metadata carried through partition specs and sort orders unchanged. Now that replace table goes through the same method to update the schema, `setCurrentSchema`, the specs and orders are now rebuilt to reference the current schema.
   
   When replacing a table, its schema, partition spec, and sort order only need to be consistent with one another, not the older specs and sort orders. This relaxes the check so that tests that have incompatible changes don't fail.
   
   Relaxing checks is the correct thing to do because consistency is now checked in the `build` method. It allows the current schema, spec, and order to be changed as long as they are consistent with one another. Older specs and orders are still kept because they may be referenced by data files in existing manifests.




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