rdblue commented on a change in pull request #1495:
URL: https://github.com/apache/iceberg/pull/1495#discussion_r497037018
##########
File path:
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
##########
@@ -142,16 +146,22 @@ protected void doCommit(TableMetadata base, TableMetadata
metadata) {
String newMetadataLocation = writeNewMetadata(metadata, currentVersion() +
1);
boolean threw = true;
+ boolean updateHiveTable = false;
Optional<Long> lockId = Optional.empty();
try {
lockId = Optional.of(acquireLock());
// TODO add lock heart beating for cases where default lock timeout is
too low.
Table tbl;
- if (base != null) {
- LOG.debug("Committing existing table: {}", fullName);
+ try {
tbl = metaClients.run(client -> client.getTable(database, tableName));
+ if (base == null && tbl.getParameters().get(TABLE_CREATION_FROM_HIVE)
== null) {
+ throw new AlreadyExistsException("Table already exists: %s.%s",
database, tableName);
+ }
+ updateHiveTable = true;
+ LOG.debug("Committing existing table: {}", fullName);
tbl.setSd(storageDescriptor(metadata)); // set to pickup any schema
changes
- } else {
+ } catch (NoSuchObjectException nte) {
+ LOG.trace("Table not found {}", fullName, nte);
Review comment:
Can we remove this? If the debug log shows that this path was taken,
then it is redundant.
----------------------------------------------------------------
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]