From cdcb9786a4aef1a12d8acadac2a321ef6a287032 Mon Sep 17 00:00:00 2001 From: Sridhar R Manikarnike Date: Tue, 3 Dec 2024 13:58:34 +0530 Subject: [PATCH] [Enhancement] (nereids)implement adminDiagnoseTabletCommand in nereids (#44744) Issue Number: close #42848 --- .../main/antlr4/org/apache/doris/nereids/DorisParser.g4 | 2 +- .../apache/doris/nereids/parser/LogicalPlanBuilder.java | 7 +++++++ .../nereids_p0/show/test_show_diagnose_tablet.groovy | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 index eac4c661de920d..b51b342e24b895 100644 --- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 +++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 @@ -486,6 +486,7 @@ unsupportedCancelStatement supportedAdminStatement : ADMIN SHOW REPLICA DISTRIBUTION FROM baseTableRef #adminShowReplicaDistribution + | ADMIN DIAGNOSE TABLET tabletId=INTEGER_VALUE #adminDiagnoseTablet ; supportedRecoverStatement @@ -514,7 +515,6 @@ unsupportedAdminStatement (COMMA backends+=STRING_LITERAL) RIGHT_PAREN)? #adminCleanTrash | ADMIN SET TABLE name=multipartIdentifier PARTITION VERSION properties=propertyClause? #adminSetPartitionVersion - | ADMIN DIAGNOSE TABLET tabletId=INTEGER_VALUE #adminDiagnoseTablet | ADMIN SHOW TABLET STORAGE FORMAT VERBOSE? #adminShowTabletStorageFormat | ADMIN COPY TABLET tabletId=INTEGER_VALUE properties=propertyClause? #adminCopyTablet | ADMIN SET TABLE name=multipartIdentifier STATUS properties=propertyClause? #adminSetTableStatus 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 401d18775af106..7804959aa79f9e 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 @@ -50,6 +50,7 @@ import org.apache.doris.mtmv.MTMVRefreshTriggerInfo; import org.apache.doris.nereids.DorisParser; import org.apache.doris.nereids.DorisParser.AddConstraintContext; +import org.apache.doris.nereids.DorisParser.AdminDiagnoseTabletContext; import org.apache.doris.nereids.DorisParser.AdminShowReplicaDistributionContext; import org.apache.doris.nereids.DorisParser.AggClauseContext; import org.apache.doris.nereids.DorisParser.AggStateDataTypeContext; @@ -4654,6 +4655,12 @@ public LogicalPlan visitShowDiagnoseTablet(ShowDiagnoseTabletContext ctx) { return new ShowDiagnoseTabletCommand(tabletId); } + @Override + public LogicalPlan visitAdminDiagnoseTablet(AdminDiagnoseTabletContext ctx) { + long tabletId = Long.parseLong(ctx.INTEGER_VALUE().getText()); + return new ShowDiagnoseTabletCommand(tabletId); + } + @Override public LogicalPlan visitShowCreateTable(ShowCreateTableContext ctx) { List nameParts = visitMultipartIdentifier(ctx.name); diff --git a/regression-test/suites/nereids_p0/show/test_show_diagnose_tablet.groovy b/regression-test/suites/nereids_p0/show/test_show_diagnose_tablet.groovy index 029fac7428e0bb..62e008412bae3b 100644 --- a/regression-test/suites/nereids_p0/show/test_show_diagnose_tablet.groovy +++ b/regression-test/suites/nereids_p0/show/test_show_diagnose_tablet.groovy @@ -29,6 +29,8 @@ suite("test_show_diagnose_tablet_nereids", "query,diagnose") { // Execute the SHOW TABLET DIAGNOSIS command and verify the output checkNereidsExecute("SHOW TABLET DIAGNOSIS ${tabletId}") + // Execute the SHOW TABLET DIAGNOSIS command and verify the output + checkNereidsExecute("ADMIN DIAGNOSE TABLET ${tabletId}") } catch (Exception e) { log.error("Failed to execute SHOW TABLET DIAGNOSIS command", e) throw e