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 2019/12/23 21:12:58 UTC

[GitHub] [incubator-iceberg] rdblue commented on a change in pull request #716: [ISSUE #714] Add alterTable testUtil And Fix partition error message

rdblue commented on a change in pull request #716: [ISSUE #714] Add alterTable testUtil And Fix partition error message
URL: https://github.com/apache/incubator-iceberg/pull/716#discussion_r361003204
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
 ##########
 @@ -589,4 +590,20 @@ private static PartitionSpec freshSpec(int specId, Schema schema, PartitionSpec
     }
     return builder.build();
   }
+
+  public void checkCompatibility(Schema newSchema) {
+    for (PartitionField field : spec().fields()) {
+      Type sourceType = newSchema.findType(field.sourceId());
+      if (sourceType == null) {
+        throw new UnsupportedOperationException("Cannot support drop the partition column: " + field.name());
+      }
+      if (!sourceType.isPrimitiveType()) {
+        throw new UnsupportedOperationException("Cannot partition by non-primitive source field: " + field.name());
+      }
+      if (!field.transform().canTransform(sourceType)) {
 
 Review comment:
   Please add newlines between these if statements.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org