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 2022/01/07 22:12:21 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #3845: Partition Metadata table breaks with a partition column named 'partition'

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



##########
File path: api/src/main/java/org/apache/iceberg/PartitionSpec.java
##########
@@ -336,17 +338,24 @@ private void checkAndAddPartitionName(String name) {
       checkAndAddPartitionName(name, null);
     }
 
+    Builder checkConflicts(boolean check) {
+      checkConflicts = check;
+      return this;
+    }
+
     private void checkAndAddPartitionName(String name, Integer sourceColumnId) {
       Types.NestedField schemaField = schema.findField(name);
-      if (sourceColumnId != null) {
-        // for identity transform case we allow  conflicts between partition and schema field name as
-        //   long as they are sourced from the same schema field
-        Preconditions.checkArgument(schemaField == null || schemaField.fieldId() == sourceColumnId,
-            "Cannot create identity partition sourced from different field in schema: %s", name);
-      } else {
-        // for all other transforms we don't allow conflicts between partition name and schema field name
-        Preconditions.checkArgument(schemaField == null,
-            "Cannot create partition from name that exists in schema: %s", name);
+      if (checkConflicts) {

Review comment:
       Looks like there's no other way around this (even using `add` directly) so I think this is the cleanest way to fix it. Thanks, @huaxingao!




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