pvary commented on a change in pull request #1612:
URL: https://github.com/apache/iceberg/pull/1612#discussion_r526683067



##########
File path: mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
##########
@@ -80,6 +81,10 @@ public void 
preCreateTable(org.apache.hadoop.hive.metastore.api.Table hmsTable)
         
Preconditions.checkArgument(catalogProperties.getProperty(InputFormatConfig.PARTITION_SPEC)
 == null,
             "Iceberg table already created - can not use provided partition 
specification");
 
+        Schema hmsSchema = HiveSchemaUtil.schema(hmsTable.getSd().getCols());
+        Preconditions.checkArgument(HiveSchemaUtil.compatible(hmsSchema, 
icebergTable.schema()),
+            "Iceberg table already created - with different specification");

Review comment:
       After discussing offline with @marton-bod we agreed that we should have 
stricter mapping. See: 
https://github.com/apache/iceberg/pull/1612#discussion_r526065544
   
   There is still one remaining important use-case:
   - The table is created before trying to access from Hive and the Catalog is 
HadoopTable/HadoopCatalog/CustomCatalog. When the user wants to create the Hive 
table it wants to use only a few columns from the table. Either because it has 
too many columns and wants to have a simplified table in Hive, or the Iceberg 
table contains columns which are not supported by Hive, like `time` or `fixed`.




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