rdblue commented on a change in pull request #1495:
URL: https://github.com/apache/iceberg/pull/1495#discussion_r494603827
##########
File path:
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
##########
@@ -139,6 +140,8 @@ protected void doRefresh() {
@Override
protected void doCommit(TableMetadata base, TableMetadata metadata) {
+ boolean updateTable = base != null ||
metadata.propertyAsBoolean(TABLE_FROM_HIVE, false);
Review comment:
Okay, thanks for the context.
I think we may be able to catch this case within `HiveTableOperations`. When
creating a table, we will create a new `TableOperations` and that will attempt
to load the current metadata. Normally, [that will
fail](https://github.com/apache/iceberg/blob/master/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java#L125)
and because the `currentMetadataLocation` was `null`, the failure is caught
and metadata is set to null because the table doesn't exist. If the table
exists but doesn't have a metadata location, then we will get a table from
Hive, but the location property won't exist. We can detect that the location
property doesn't exist and set a flag, `updateToCreate`.
That avoids the need for a table property because we detect the state of the
Hive MetaStore, and it doesn't incur extra thrift calls.
----------------------------------------------------------------
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]