From 636c674cd7377727a198c61d61cb3b6e9e90d078 Mon Sep 17 00:00:00 2001 From: LiBinfeng Date: Mon, 25 Nov 2024 12:12:10 +0800 Subject: [PATCH 1/2] [fix](regression) add exception when can not find profile with specific tag --- .../org/apache/doris/regression/action/ProfileAction.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/ProfileAction.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/ProfileAction.groovy index 5f6c00be9439dc..2e24ae1f7bc167 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/ProfileAction.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/ProfileAction.groovy @@ -82,8 +82,10 @@ class ProfileAction implements SuiteAction { def jsonSlurper = new JsonSlurper() List profileData = jsonSlurper.parseText(body).data.rows + def canFindProfile = false; for (final def profileItem in profileData) { if (profileItem["Sql Statement"].toString().contains(tag)) { + canFindProfile = true def profileId = profileItem["Profile ID"].toString() def profileCli = new HttpCliAction(context) @@ -113,6 +115,9 @@ class ProfileAction implements SuiteAction { break } } + if (!canFindProfile) { + throw new IllegalStateException("Missing profile with tag: " + tag) + } } httpCli.run() } finally { From 068a47ca92e9ebe1d282f0ce5cdca7e97d67beef Mon Sep 17 00:00:00 2001 From: LiBinfeng Date: Mon, 25 Nov 2024 20:17:47 +0800 Subject: [PATCH 2/2] Revert "[Feat] (Nereids)support showTrash Command (#44352)" This reverts commit 045f59013b0d8da79ee6325923d0cbfa89aa6155. --- .../nereids/parser/LogicalPlanBuilder.java | 7 -- .../doris/nereids/trees/plans/PlanType.java | 1 - .../plans/commands/ShowTrashCommand.java | 78 ------------------- .../trees/plans/visitor/CommandVisitor.java | 5 -- .../ddl/show_trash/test_nereids_trash.groovy | 22 ------ 5 files changed, 113 deletions(-) delete mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTrashCommand.java delete mode 100644 regression-test/suites/nereids_p0/ddl/show_trash/test_nereids_trash.groovy 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 5513b4f5ecbebd..5d31b284e15562 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 @@ -227,7 +227,6 @@ import org.apache.doris.nereids.DorisParser.ShowStorageEnginesContext; import org.apache.doris.nereids.DorisParser.ShowTableIdContext; import org.apache.doris.nereids.DorisParser.ShowTabletsBelongContext; -import org.apache.doris.nereids.DorisParser.ShowTrashContext; import org.apache.doris.nereids.DorisParser.ShowTriggersContext; import org.apache.doris.nereids.DorisParser.ShowVariablesContext; import org.apache.doris.nereids.DorisParser.ShowViewContext; @@ -495,7 +494,6 @@ import org.apache.doris.nereids.trees.plans.commands.ShowStorageEnginesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowTableIdCommand; import org.apache.doris.nereids.trees.plans.commands.ShowTabletsBelongCommand; -import org.apache.doris.nereids.trees.plans.commands.ShowTrashCommand; import org.apache.doris.nereids.trees.plans.commands.ShowTriggersCommand; import org.apache.doris.nereids.trees.plans.commands.ShowVariablesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowViewCommand; @@ -4127,11 +4125,6 @@ public SetDefaultStorageVaultCommand visitSetDefaultStorageVault(SetDefaultStora return new SetDefaultStorageVaultCommand(stripQuotes(ctx.identifier().getText())); } - @Override - public LogicalPlan visitShowTrash(ShowTrashContext ctx) { - return new ShowTrashCommand(); - } - @Override public Object visitRefreshCatalog(RefreshCatalogContext ctx) { if (ctx.name != null) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java index 4e62a7e7269be9..f36af26e89273e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java @@ -204,7 +204,6 @@ public enum PlanType { SHOW_ROLE_COMMAND, SHOW_STORAGE_ENGINES_COMMAND, SHOW_TABLE_ID_COMMAND, - SHOW_TRASH_COMMAND, SHOW_TRIGGERS_COMMAND, SHOW_VARIABLES_COMMAND, SHOW_AUTHORS_COMMAND, diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTrashCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTrashCommand.java deleted file mode 100644 index 58146cb7857512..00000000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTrashCommand.java +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.apache.doris.nereids.trees.plans.commands; - -import org.apache.doris.catalog.Column; -import org.apache.doris.catalog.Env; -import org.apache.doris.catalog.ScalarType; -import org.apache.doris.common.proc.TrashProcDir; -import org.apache.doris.nereids.trees.plans.PlanType; -import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor; -import org.apache.doris.qe.ConnectContext; -import org.apache.doris.qe.ShowResultSet; -import org.apache.doris.qe.ShowResultSetMetaData; -import org.apache.doris.qe.StmtExecutor; -import org.apache.doris.system.Backend; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; - -import java.util.List; - -/** - * show trash command - */ -public class ShowTrashCommand extends ShowCommand { - private List backends = Lists.newArrayList(); - - public ShowTrashCommand() { - super(PlanType.SHOW_TRASH_COMMAND); - } - - public List getBackends() { - return backends; - } - - public ShowResultSetMetaData getMetaData() { - ShowResultSetMetaData.Builder builder = ShowResultSetMetaData.builder(); - for (String title : TrashProcDir.TITLE_NAMES) { - builder.addColumn(new Column(title, ScalarType.createVarchar(30))); - } - return builder.build(); - } - - private ShowResultSet handleShowTrash() throws Exception { - ImmutableMap backendsInfo = Env.getCurrentSystemInfo().getAllBackendsByAllCluster(); - for (Backend backend : backendsInfo.values()) { - this.backends.add(backend); - } - List> infos = Lists.newArrayList(); - TrashProcDir.getTrashInfo(backends, infos); - return new ShowResultSet(getMetaData(), infos); - } - - @Override - public R accept(PlanVisitor visitor, C context) { - return visitor.visitShowTrashCommand(this, context); - } - - @Override - public ShowResultSet doRun(ConnectContext ctx, StmtExecutor executor) throws Exception { - return handleShowTrash(); - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java index 815c5c67030c34..4383ebc01a0b9e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java @@ -86,7 +86,6 @@ import org.apache.doris.nereids.trees.plans.commands.ShowStorageEnginesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowTableIdCommand; import org.apache.doris.nereids.trees.plans.commands.ShowTabletsBelongCommand; -import org.apache.doris.nereids.trees.plans.commands.ShowTrashCommand; import org.apache.doris.nereids.trees.plans.commands.ShowTriggersCommand; import org.apache.doris.nereids.trees.plans.commands.ShowVariablesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowViewCommand; @@ -419,10 +418,6 @@ default R visitShowTableIdCommand(ShowTableIdCommand showTableIdCommand, C conte return visitCommand(showTableIdCommand, context); } - default R visitShowTrashCommand(ShowTrashCommand showTrashCommand, C context) { - return visitCommand(showTrashCommand, context); - } - default R visitSyncCommand(SyncCommand syncCommand, C context) { return visitCommand(syncCommand, context); } diff --git a/regression-test/suites/nereids_p0/ddl/show_trash/test_nereids_trash.groovy b/regression-test/suites/nereids_p0/ddl/show_trash/test_nereids_trash.groovy deleted file mode 100644 index 5a78b27e41c72e..00000000000000 --- a/regression-test/suites/nereids_p0/ddl/show_trash/test_nereids_trash.groovy +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -suite("show_trash_nereids") { - // can not use qt command since the output change based on cluster and backend ip - checkNereidsExecute("""show trash;""") - checkNereidsExecute("""show trash on "127.0.0.1:9050";""") -} \ No newline at end of file