zhangbutao commented on code in PR #4341:
URL: https://github.com/apache/hive/pull/4341#discussion_r1211874878
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java:
##########
@@ -171,6 +172,16 @@ public void
preCreateTable(org.apache.hadoop.hive.metastore.api.Table hmsTable)
hmsTable.getParameters().put(BaseMetastoreTableOperations.TABLE_TYPE_PROP,
BaseMetastoreTableOperations.ICEBERG_TABLE_TYPE_VALUE.toUpperCase());
+ // Make sure the created iceberg table location on external warehouse
location
+ if (Catalogs.hiveCatalog(conf, catalogProperties) &&
hmsTable.getSd().getLocation() == null &&
+ !TableType.EXTERNAL_TABLE.equals(hmsTable.getTableType())) {
+ Map<String, String> params =
Optional.ofNullable(hmsTable.getParameters()).orElse(Maps.newHashMap());
+ params.put("EXTERNAL", "TRUE");
+ params.put(MetaStoreUtils.EXTERNAL_TABLE_PURGE, "TRUE");
+ hmsTable.setParameters(params);
+ hmsTable.setTableType(TableType.EXTERNAL_TABLE.toString());
Review Comment:
@ayushtkn
The code block is responsible for transforming created iceberg table which
has no `external` keyword to external table, and then the iceberg location
will always go to external WH location.
The change is in line with
`MetastoreDefaultTransformer::transformCreateTable`:
https://github.com/apache/hive/blob/7bfc54ffc8baf5f3e7de326b750fe9355b11132b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetastoreDefaultTransformer.java#L651-L658
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]