This is an automated email from the ASF dual-hosted git repository. starocean999 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new c6643c6cc05 [Feat](Nereids) support alter system drop all broker command (#48208) c6643c6cc05 is described below commit c6643c6cc05c2bbde4d777b9c9b31cca92624245 Author: Jensen <czjour...@163.com> AuthorDate: Mon Feb 24 10:13:41 2025 +0800 [Feat](Nereids) support alter system drop all broker command (#48208) --- .../src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 | 4 ++-- .../org/apache/doris/nereids/parser/LogicalPlanBuilder.java | 9 +++++++++ .../nereids/trees/plans/commands/AlterSystemCommand.java | 2 ++ .../info/{DropBrokerOp.java => DropAllBrokerOp.java} | 12 +++++------- .../nereids/trees/plans/commands/info/DropBrokerOp.java | 2 +- 5 files changed, 19 insertions(+), 10 deletions(-) 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 092ae1cd29c..f3b36879895 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 @@ -256,6 +256,7 @@ supportedAlterStatement | ALTER SYSTEM DROP OBSERVER hostPort=STRING_LITERAL #dropObserverClause | ALTER SYSTEM ADD FOLLOWER hostPort=STRING_LITERAL #addFollowerClause | ALTER SYSTEM DROP FOLLOWER hostPort=STRING_LITERAL #dropFollowerClause + | ALTER SYSTEM DROP ALL BROKER name=identifierOrText #dropAllBrokerClause | ALTER SYSTEM ADD BROKER name=identifierOrText hostPorts+=STRING_LITERAL (COMMA hostPorts+=STRING_LITERAL)* #addBrokerClause | ALTER SYSTEM DROP BROKER name=identifierOrText hostPorts+=STRING_LITERAL @@ -648,8 +649,7 @@ unsupportedAlterStatement ; alterSystemClause - : DROP ALL BROKER name=identifierOrText #dropAllBrokerClause - | SET LOAD ERRORS HUB properties=propertyClause? #alterLoadErrorUrlClause + : SET LOAD ERRORS HUB properties=propertyClause? #alterLoadErrorUrlClause | MODIFY BACKEND hostPorts+=STRING_LITERAL (COMMA hostPorts+=STRING_LITERAL)* SET LEFT_PAREN propertyItemList RIGHT_PAREN #modifyBackendClause 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 0b56260042a..bbf148b09cc 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 @@ -143,6 +143,7 @@ import org.apache.doris.nereids.DorisParser.DataTypeWithNullableContext; import org.apache.doris.nereids.DorisParser.DecimalLiteralContext; import org.apache.doris.nereids.DorisParser.DeleteContext; import org.apache.doris.nereids.DorisParser.DereferenceContext; +import org.apache.doris.nereids.DorisParser.DropAllBrokerClauseContext; import org.apache.doris.nereids.DorisParser.DropBrokerClauseContext; import org.apache.doris.nereids.DorisParser.DropCatalogContext; import org.apache.doris.nereids.DorisParser.DropCatalogRecycleBinContext; @@ -693,6 +694,7 @@ import org.apache.doris.nereids.trees.plans.commands.info.DMLCommandType; import org.apache.doris.nereids.trees.plans.commands.info.DecommissionBackendOp; import org.apache.doris.nereids.trees.plans.commands.info.DefaultValue; import org.apache.doris.nereids.trees.plans.commands.info.DistributionDescriptor; +import org.apache.doris.nereids.trees.plans.commands.info.DropAllBrokerOp; import org.apache.doris.nereids.trees.plans.commands.info.DropBackendOp; import org.apache.doris.nereids.trees.plans.commands.info.DropBrokerOp; import org.apache.doris.nereids.trees.plans.commands.info.DropColumnOp; @@ -5739,6 +5741,13 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> { return new ShowAnalyzeCommand(tableName, jobId, stateKey, stateValue, isAuto); } + @Override + public LogicalPlan visitDropAllBrokerClause(DropAllBrokerClauseContext ctx) { + String brokerName = stripQuotes(ctx.name.getText()); + AlterSystemOp alterSystemOp = new DropAllBrokerOp(brokerName); + return new AlterSystemCommand(alterSystemOp); + } + @Override public LogicalPlan visitAddBrokerClause(AddBrokerClauseContext ctx) { String brokerName = stripQuotes(ctx.name.getText()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterSystemCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterSystemCommand.java index ddf57ce6741..78e88943af2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterSystemCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterSystemCommand.java @@ -30,6 +30,7 @@ import org.apache.doris.nereids.trees.plans.commands.info.AddFollowerOp; import org.apache.doris.nereids.trees.plans.commands.info.AddObserverOp; import org.apache.doris.nereids.trees.plans.commands.info.AlterSystemOp; import org.apache.doris.nereids.trees.plans.commands.info.DecommissionBackendOp; +import org.apache.doris.nereids.trees.plans.commands.info.DropAllBrokerOp; import org.apache.doris.nereids.trees.plans.commands.info.DropBackendOp; import org.apache.doris.nereids.trees.plans.commands.info.DropBrokerOp; import org.apache.doris.nereids.trees.plans.commands.info.DropFollowerOp; @@ -74,6 +75,7 @@ public class AlterSystemCommand extends Command implements ForwardWithSync { || alterSystemOp instanceof DropObserverOp || alterSystemOp instanceof AddFollowerOp || alterSystemOp instanceof DropFollowerOp + || alterSystemOp instanceof DropAllBrokerOp || alterSystemOp instanceof AddBrokerOp || alterSystemOp instanceof DropBrokerOp) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropBrokerOp.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropAllBrokerOp.java similarity index 84% copy from fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropBrokerOp.java copy to fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropAllBrokerOp.java index c17406b7e76..a12b1ccc4aa 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropBrokerOp.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropAllBrokerOp.java @@ -20,19 +20,17 @@ package org.apache.doris.nereids.trees.plans.commands.info; import org.apache.doris.analysis.AlterClause; import org.apache.doris.analysis.ModifyBrokerClause; -import java.util.List; - /** - * DropBrokerOp + * DropAllBrokerOp */ -public class DropBrokerOp extends BrokerOp { - public DropBrokerOp(String brokerName, List<String> hostPorts) { - super(ModifyOp.OP_ADD, brokerName, hostPorts); +public class DropAllBrokerOp extends BrokerOp { + public DropAllBrokerOp(String brokerName) { + super(ModifyOp.OP_DROP_ALL, brokerName, null); } @Override public AlterClause translateToLegacyAlterClause() { - return new ModifyBrokerClause(ModifyBrokerClause.ModifyOp.OP_DROP, + return new ModifyBrokerClause(ModifyBrokerClause.ModifyOp.OP_DROP_ALL, getBrokerName(), getHostPorts(), getHostPortPairs()); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropBrokerOp.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropBrokerOp.java index c17406b7e76..42bfa2f10b8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropBrokerOp.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DropBrokerOp.java @@ -27,7 +27,7 @@ import java.util.List; */ public class DropBrokerOp extends BrokerOp { public DropBrokerOp(String brokerName, List<String> hostPorts) { - super(ModifyOp.OP_ADD, brokerName, hostPorts); + super(ModifyOp.OP_DROP, brokerName, hostPorts); } @Override --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org