[minor](stats) Fix potential npe when loading stats (#27200)

Besides, lower down the log level of loading stats from warning to debug, since it doesn't such matter for workflow.
This commit is contained in:
AKIRA
2023-11-23 16:37:58 +09:00
committed by GitHub
parent b457856bd2
commit 5d9c555dcf
2 changed files with 16 additions and 20 deletions

View File

@ -50,11 +50,10 @@ public class ColumnStatisticsCacheLoader extends StatisticsCacheLoader<Optional<
}
// Load from data source metadata
try {
TableIf table = Env.getCurrentEnv().getCatalogMgr().getCatalog(key.catalogId)
.getDbOrMetaException(key.dbId).getTableOrMetaException(key.tableId);
TableIf table = StatisticsUtil.findTable(key.catalogId, key.dbId, key.tableId);
columnStatistic = table.getColumnStatistic(key.colName);
} catch (Exception e) {
LOG.warn(String.format("Exception to get column statistics by metadata. [Catalog:%d, DB:%d, Table:%d]",
LOG.debug(String.format("Exception to get column statistics by metadata. [Catalog:%d, DB:%d, Table:%d]",
key.catalogId, key.dbId, key.tableId), e);
}
return columnStatistic;