pvary commented on a change in pull request #4261:
URL: https://github.com/apache/iceberg/pull/4261#discussion_r819573765
##########
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:
Hive error handling is not something I would be proud of. There are
plenty of inconsistencies around the code, and the last time I have tried to
clean this up, I have faced serious resistance. The reasoning behind it was
that the users of HMS are plenty and they might build above this haphazard
error handling.
That said:
- InvalidObjectException is generally used for any error in the provided
objects:
- `You must specify a path for the catalog`
- `BLABLA is not a valid catalog name`
- `Invalid type name`
- `Invalid column ...`
- The error could signal missing objects as well - typically when storing
related objects:
- `No such catalog BLABLA`
- `Unable to add partition because table or database do not exist`
- `Database BLABLA doesn't exist`
So I would definitely opt for a more general error message, maybe mentioning
that the most common error is the wrong table name. All that said, I think the
`ValidationException` seems ok, since there is some validation error happened
when we tried to store the table.
--
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]