You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@amoro.apache.org by "klion26 (via GitHub)" <gi...@apache.org> on 2024/11/21 06:43:07 UTC
Re: [PR] [AMORO-3330] Reducing redundant 'databaseExists' in 'CommonUnifiedCatalog' [amoro]
klion26 commented on code in PR #3339:
URL: https://github.com/apache/amoro/pull/3339#discussion_r1851445388
##########
amoro-format-hudi/src/main/java/org/apache/amoro/formats/hudi/HudiHadoopCatalog.java:
##########
@@ -155,6 +156,9 @@ public List<String> listTables(String database) {
() -> {
FileSystem fs = fs();
Path databasePath = new Path(warehouse, database);
+ if (!fs.exists(databasePath)) {
Review Comment:
As the Javadoc of `FormatCatalog#listTables` says that it will throw `NoSuchDatabaseException` when the database does not exist, I think adding this here is fine.
Can we use the following `fs.listStatus()` to check if the file exists?
##########
amoro-format-iceberg/src/main/java/org/apache/amoro/formats/mixed/MixedCatalog.java:
##########
@@ -76,9 +77,13 @@ public AmoroTable<?> loadTable(String database, String table) {
@Override
public List<String> listTables(String database) {
- return catalog.listTables(database).stream()
- .map(TableIdentifier::getTableName)
- .collect(Collectors.toList());
+ try {
+ return catalog.listTables(database).stream()
+ .map(TableIdentifier::getTableName)
+ .collect(Collectors.toList());
+ } catch (NoSuchDatabaseException e) {
+ throw new NoSuchDatabaseException(e, database);
Review Comment:
Why do we catch and retry the original exception here
--
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: commits-unsubscribe@amoro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org