COLDMANYU opened a new pull request, #11409:
URL: https://github.com/apache/paimon/pull/11409
### Purpose
Fixes #11408
`HiveCatalog.dropTable` fails with a `RuntimeException` when the table's
database does not exist, even with `ignoreIfNotExists=true`:
```
java.lang.RuntimeException: Can not get table
Identifier{database='missing_db', object='t'} from metastore.
Caused by: NoSuchObjectException(message:missing_db)
```
Since #8130, `AbstractCatalog.dropTable` starts with `tableExists`. When the
table is not in HMS, `HiveCatalog.tableExists` falls back to the file system
check, and `getTableLocation` resolves the table path from the database
location, which throws when the database is missing.
This PR makes `HiveCatalog.tableExists` return `false` when the database
does not exist, before the file system check. A table in a missing database
does not exist, so `dropTable` throws `TableNotExistException`, or returns when
`ignoreIfNotExists` is true, as it did before 2.0 and as `getTable` does. A
table that is in HMS is still found first, so the case fixed by #8130 (table in
HMS, directory missing) is not affected. Other callers of `getTableLocation`
are not changed.
### Tests
`HiveCatalogTest#testDropTableWhenDatabaseMissing`: `dropTable` on a table
in a missing database throws `TableNotExistException` with
`ignoreIfNotExists=false` and returns with `ignoreIfNotExists=true`. Without
the fix, both calls fail with the `RuntimeException` above.
--
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]