szehon-ho commented on a change in pull request #4261:
URL: https://github.com/apache/iceberg/pull/4261#discussion_r819129979
##########
File path:
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
##########
@@ -271,29 +273,32 @@ protected void doCommit(TableMetadata base, TableMetadata
metadata) {
try {
persistTable(tbl, updateHiveTable);
commitStatus = CommitStatus.SUCCESS;
- } catch (Throwable persistFailure) {
+ } catch (org.apache.hadoop.hive.metastore.api.AlreadyExistsException e) {
+ throw new AlreadyExistsException(e, "Table already exists: %s.%s",
database, tableName);
+
+ } catch (InvalidObjectException e) {
+ throw new ValidationException(e, "Invalid table name for %s.%s",
database, tableName);
Review comment:
For the behaviors of the future , the public HiveMetaStore API contract
exposes the following specific exception types :
- InvalidObjectException
- NoSuchObjectException
- AlreadyExistsException.
Its unfortunately not documented (should really be a javadoc there) but in
Hive code these mean respectively that:
- you try to make an HMS object that is invalid
- You try to find an HMS object that is not there
- You try to make an HMS object that is already there
The other exceptions (MetaException, TException) are more generic.
Obviously it is up to discretion of future Hive authors whether this remains
true, though I really doubt this will change given how long it's been.
--
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]