From 9f27405c5bfa375bdf6f8b6dfc2a8834474c287b Mon Sep 17 00:00:00 2001 From: Rijesh Kunhi Parambattu Date: Mon, 9 Dec 2024 08:27:27 +0530 Subject: [PATCH] Test --- .../nereids/parser/LogicalPlanBuilder.java | 26 +++++++++++++++++++ .../test_nereids_show_table_status.groovy | 1 + 2 files changed, 27 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java index 0c04502cd47248a..ff1ceda0aa8a014 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java @@ -5047,6 +5047,32 @@ public LogicalPlan visitShowTableStatus(ShowTableStatusContext ctx) { wild = stripQuotes(ctx.wildWhere().STRING_LITERAL().getText()); } } + + if (ctx.wildWhere() != null) { + if (ctx.wildWhere().LIKE() != null) { + wild = stripQuotes(ctx.wildWhere().STRING_LITERAL().getText()); + } else { + StringBuilder sb = new StringBuilder(); + sb.append("SELECT 'TABLE_NAME' AS 'Name', 'ENGINE' AS 'Engine', 'VERSION' as 'Version'," + + " 'ROW_FORMAT' AS 'Row_Format' "); + if (ctlName != null) { + sb.append("FROM "); + sb.append("`").append(ctlName).append("`"); + sb.append("."); + if (databaseName != null) { + sb.append("`").append(databaseName).append("`"); + } + } else { + if (databaseName != null) { + sb.append("FROM "); + sb.append("`").append(databaseName).append("`"); + } + } + sb.append(" "); + sb.append(getOriginSql(ctx.wildWhere())); + return new NereidsParser().parseSingle(sb.toString()); + } + } return new ShowTableStatusCommand(ctlName, databaseName, wild); } } diff --git a/regression-test/suites/nereids_p0/show/test_nereids_show_table_status.groovy b/regression-test/suites/nereids_p0/show/test_nereids_show_table_status.groovy index 16374356febda16..e660e112532ed5c 100644 --- a/regression-test/suites/nereids_p0/show/test_nereids_show_table_status.groovy +++ b/regression-test/suites/nereids_p0/show/test_nereids_show_table_status.groovy @@ -47,5 +47,6 @@ suite("test_nereids_show_table_status") { checkNereidsExecute("show table status") checkNereidsExecute("show table status from ${dbName}") checkNereidsExecute("show table status from ${dbName} like '%${table}%'") + checkNereidsExecute("show table status from ${dbName} where name='${table}'") }