Co-authored-by: hugoluo <hugoluo@tencent.com>
This commit is contained in:
@ -49,6 +49,8 @@ public interface CatalogIf<T extends DatabaseIf> {
|
||||
|
||||
List<String> getDbNames();
|
||||
|
||||
// Will be used when querying the information_schema table
|
||||
// Unable to get db for uninitialized catalog to avoid query timeout
|
||||
default List<String> getDbNamesOrEmpty() {
|
||||
try {
|
||||
return getDbNames();
|
||||
|
||||
@ -240,6 +240,20 @@ public abstract class ExternalCatalog implements CatalogIf<ExternalDatabase>, Wr
|
||||
return listDatabaseNames(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDbNamesOrEmpty() {
|
||||
if (initialized) {
|
||||
try {
|
||||
return getDbNames();
|
||||
} catch (Exception e) {
|
||||
LOG.warn("failed to get db names in catalog {}", getName(), e);
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
} else {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResource() {
|
||||
return catalogProperty.getResource();
|
||||
|
||||
Reference in New Issue
Block a user