Skip to content

Commit

Permalink
[cherry-pick](branch-3.0)[Bug] test suite test_table_options may caus…
Browse files Browse the repository at this point in the history
…e NPE in FE (#39509)(#39742)



backport #39509
  • Loading branch information
Vallishp authored Aug 22, 2024
1 parent 65dd86a commit ad6a413
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,15 @@ private static TFetchSchemaTableDataResult tableOptionsMetadataResult(TSchemaTab
String clg = params.getCatalog();
CatalogIf catalog = Env.getCurrentEnv().getCatalogMgr().getCatalog(clg);
DatabaseIf database = catalog.getDbNullable(dbId);
if (database == null) {
// BE gets the database id list from FE and then invokes this interface
// per database. there is a chance that in between database can be dropped.
// so need to handle database not exist case and return ok so that BE continue the
// loop with next database.
result.setDataBatch(dataBatch);
result.setStatus(new TStatus(TStatusCode.OK));
return result;
}
List<TableIf> tables = database.getTables();
if (catalog instanceof InternalCatalog) {
tableOptionsForInternalCatalog(currentUserIdentity, catalog, database, tables, dataBatch);
Expand Down Expand Up @@ -1222,6 +1231,15 @@ private static TFetchSchemaTableDataResult tablePropertiesMetadataResult(TSchema
CatalogIf catalog = Env.getCurrentEnv().getCatalogMgr().getCatalog(clg);
List<TRow> dataBatch = Lists.newArrayList();
DatabaseIf database = catalog.getDbNullable(dbId);
if (database == null) {
// BE gets the database id list from FE and then invokes this interface
// per database. there is a chance that in between database can be dropped.
// so need to handle database not exist case and return ok so that BE continue the
// loop with next database.
result.setDataBatch(dataBatch);
result.setStatus(new TStatus(TStatusCode.OK));
return result;
}
List<TableIf> tables = database.getTables();
if (catalog instanceof InternalCatalog) {
tablePropertiesForInternalCatalog(currentUserIdentity, catalog, database, tables, dataBatch);
Expand Down

0 comments on commit ad6a413

Please sign in to comment.