Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.PatternMatcher;
import org.apache.doris.common.PatternMatcherWrapper;
import org.apache.doris.datasource.InternalCatalog;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.nereids.trees.plans.PlanType;
import org.apache.doris.nereids.trees.plans.commands.info.AliasInfo;
Expand Down Expand Up @@ -174,6 +175,23 @@ public ShowResultSet doRun(ConnectContext ctx, StmtExecutor executor) throws Exc
Preconditions.checkArgument(table.get().getType().equals(TableIf.TableType.STREAM));
rows.add(Lists.newArrayList(table.get().getName()));
}
} else if (!(dbIf.getCatalog() instanceof InternalCatalog)
Comment thread
Baymine marked this conversation as resolved.
&& !isVerbose && type.equals(PlanType.SHOW_TABLES)) {
// Non-verbose SHOW TABLES on an external catalog: list names directly
// instead of dbIf.getTables(), which loads every table via the meta
// cache (one remote metadata load per table). The per-table SHOW priv
// filter below must be kept (name-based, needs no table load).
for (String tableName : dbIf.getTableNamesOrEmptyWithLock()) {
if (matcher != null && !matcher.match(tableName)) {
continue;
}
if (!Env.getCurrentEnv().getAccessManager()
.checkTblPriv(ConnectContext.get(), catalog, dbIf.getFullName(), tableName,
PrivPredicate.SHOW)) {
continue;
}
rows.add(Lists.newArrayList(tableName));
}
} else {
for (TableIf tbl : dbIf.getTables()) {
if (type.equals(PlanType.SHOW_VIEWS) && (tbl.getEngine() == null
Expand Down
Loading