Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fix show keys from support external catalog #52977

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion fe/fe-core/src/main/java/com/starrocks/qe/ShowExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,11 @@ public ShowResultSet visitShowDynamicPartitionStatement(ShowDynamicPartitionStmt
@Override
public ShowResultSet visitShowIndexStatement(ShowIndexStmt statement, ConnectContext context) {
List<List<String>> rows = Lists.newArrayList();
Database db = context.getGlobalStateMgr().getLocalMetastore().getDb(statement.getDbName());
String catalogName = statement.getTableName().getCatalog();
if (catalogName == null) {
catalogName = context.getCurrentCatalog();
}
Database db = GlobalStateMgr.getCurrentState().getMetadataMgr().getDb(catalogName, statement.getDbName());
MetaUtils.checkDbNullAndReport(db, statement.getDbName());
Table table = MetaUtils.getSessionAwareTable(context, db, statement.getTableName());
if (table == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
import com.starrocks.sql.ast.ShowDbStmt;
import com.starrocks.sql.ast.ShowEnginesStmt;
import com.starrocks.sql.ast.ShowGrantsStmt;
import com.starrocks.sql.ast.ShowIndexStmt;
import com.starrocks.sql.ast.ShowMaterializedViewsStmt;
import com.starrocks.sql.ast.ShowPartitionsStmt;
import com.starrocks.sql.ast.ShowProcedureStmt;
Expand Down Expand Up @@ -1173,6 +1174,14 @@ public Table getTable(String catalogName, String dbName, String tblName) {
resultSet.getResultRows().get(0).get(1));
}

@Test
public void testShowKeysFromTable() {
ShowIndexStmt stmt = new ShowIndexStmt("test_db",
new TableName(null, "test_db", "test_table"));
ShowResultSet resultSet = ShowExecutor.execute(stmt, ctx);
Assert.assertEquals(0, resultSet.getResultRows().size());
}

@Test
public void testShowCreateExternalCatalog() throws AnalysisException, DdlException {
new MockUp<CatalogMgr>() {
Expand Down
Loading