Make sure external table fetched dbId before call getRowCount. (#31379)
This commit is contained in:
@ -297,6 +297,14 @@ public class ExternalTable implements TableIf, Writable, GsonPostProcessable {
|
||||
|
||||
@Override
|
||||
public long getRowCount() {
|
||||
// Return 0 if makeSureInitialized throw exception.
|
||||
// For example, init hive table may throw NotSupportedException.
|
||||
try {
|
||||
makeSureInitialized();
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Failed to initialize table {}.{}.{}", catalog.name, dbName, name, e);
|
||||
return 0;
|
||||
}
|
||||
// All external table should get external row count from cache.
|
||||
return Env.getCurrentEnv().getExtMetaCacheMgr().getRowCountCache().getCachedRowCount(catalog.getId(), dbId, id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user