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 31d51d10693 [Enhancement] (nereids)implement syncCommand in nereids (#44335) 31d51d10693 is described below commit 31d51d10693b39f5049549400bd9ac282e2f378b Author: Vallish Pai <vallish...@gmail.com> AuthorDate: Fri Nov 22 19:23:50 2024 +0530 [Enhancement] (nereids)implement syncCommand in nereids (#44335) Issue Number: close #42814 --- .../antlr4/org/apache/doris/nereids/DorisParser.g4 | 6 ++- .../doris/nereids/parser/LogicalPlanBuilder.java | 7 +++ .../apache/doris/nereids/trees/plans/PlanType.java | 1 + .../nereids/trees/plans/commands/SyncCommand.java | 58 ++++++++++++++++++++++ .../trees/plans/visitor/CommandVisitor.java | 5 ++ .../nereids_p0/test_nereids_other_commands.groovy | 20 ++++++++ 6 files changed, 96 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 7e727a7f041..47214c8c271 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 @@ -59,6 +59,7 @@ statementBase | supportedRefreshStatement #supportedRefreshStatementAlias | supportedShowStatement #supportedShowStatementAlias | supportedRecoverStatement #supportedRecoverStatementAlias + | supportedLoadStatement #supportedLoadfStatementAlias | unsupportedStatement #unsupported ; @@ -234,6 +235,10 @@ supportedShowStatement tabletIds+=INTEGER_VALUE (COMMA tabletIds+=INTEGER_VALUE)* #showTabletsBelong ; +supportedLoadStatement + : SYNC #sync + ; + unsupportedOtherStatement : HELP mark=identifierOrText #help | INSTALL PLUGIN FROM source=identifierOrText properties=propertyClause? #installPlugin @@ -371,7 +376,6 @@ unsupportedLoadStatement | SHOW ROUTINE LOAD TASK ((FROM | IN) database=identifier)? wildWhere? #showRoutineLoadTask | SHOW ALL? CREATE ROUTINE LOAD FOR label=multipartIdentifier #showCreateRoutineLoad | SHOW CREATE LOAD FOR label=multipartIdentifier #showCreateLoad - | SYNC #sync | importSequenceStatement #importSequenceStatementAlias | importPrecedingFilterStatement #importPrecedingFilterStatementAlias | importWhereStatement #importWhereStatementAlias 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 cd9279c9023..5513b4f5ecb 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 @@ -245,6 +245,7 @@ import org.apache.doris.nereids.DorisParser.StructLiteralContext; import org.apache.doris.nereids.DorisParser.SubqueryContext; import org.apache.doris.nereids.DorisParser.SubqueryExpressionContext; import org.apache.doris.nereids.DorisParser.SupportedUnsetStatementContext; +import org.apache.doris.nereids.DorisParser.SyncContext; import org.apache.doris.nereids.DorisParser.SystemVariableContext; import org.apache.doris.nereids.DorisParser.TableAliasContext; import org.apache.doris.nereids.DorisParser.TableNameContext; @@ -499,6 +500,7 @@ 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; import org.apache.doris.nereids.trees.plans.commands.ShowWhiteListCommand; +import org.apache.doris.nereids.trees.plans.commands.SyncCommand; import org.apache.doris.nereids.trees.plans.commands.UnsetDefaultStorageVaultCommand; import org.apache.doris.nereids.trees.plans.commands.UnsetVariableCommand; import org.apache.doris.nereids.trees.plans.commands.UnsupportedCommand; @@ -4368,6 +4370,11 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> { return new ShowTableIdCommand(tableId); } + @Override + public LogicalPlan visitSync(SyncContext ctx) { + return new SyncCommand(); + } + @Override public LogicalPlan visitShowDelete(ShowDeleteContext ctx) { String dbName = 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 b4a9aaa51f1..4e62a7e7269 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 @@ -211,6 +211,7 @@ public enum PlanType { SHOW_VIEW_COMMAND, SHOW_WHITE_LIST_COMMAND, SHOW_TABLETS_BELONG_COMMAND, + SYNC_COMMAND, RECOVER_DATABASE_COMMAND, RECOVER_TABLE_COMMAND, RECOVER_PARTITION_COMMAND, diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/SyncCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/SyncCommand.java new file mode 100644 index 00000000000..9499899d39d --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/SyncCommand.java @@ -0,0 +1,58 @@ +// 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.analysis.RedirectStatus; +import org.apache.doris.analysis.StmtType; +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.StmtExecutor; + +/** + * sync command + */ +public class SyncCommand extends Command implements Redirect { + + /** + * constructor + */ + public SyncCommand() { + super(PlanType.SYNC_COMMAND); + } + + @Override + public void run(ConnectContext ctx, StmtExecutor executor) throws Exception { + // nothing to do + } + + @Override + public <R, C> R accept(PlanVisitor<R, C> visitor, C context) { + return visitor.visitSyncCommand(this, context); + } + + @Override + public RedirectStatus toRedirectStatus() { + return RedirectStatus.FORWARD_WITH_SYNC; + } + + @Override + public StmtType stmtType() { + return StmtType.SYNC; + } +} 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 0a7446075fa..815c5c67030 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 @@ -91,6 +91,7 @@ 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; import org.apache.doris.nereids.trees.plans.commands.ShowWhiteListCommand; +import org.apache.doris.nereids.trees.plans.commands.SyncCommand; import org.apache.doris.nereids.trees.plans.commands.UnsetDefaultStorageVaultCommand; import org.apache.doris.nereids.trees.plans.commands.UnsetVariableCommand; import org.apache.doris.nereids.trees.plans.commands.UnsupportedCommand; @@ -422,6 +423,10 @@ public interface CommandVisitor<R, C> { return visitCommand(showTrashCommand, context); } + default R visitSyncCommand(SyncCommand syncCommand, C context) { + return visitCommand(syncCommand, context); + } + default R visitShowDeleteCommand(ShowDeleteCommand showDeleteCommand, C context) { return visitCommand(showDeleteCommand, context); } diff --git a/regression-test/suites/nereids_p0/test_nereids_other_commands.groovy b/regression-test/suites/nereids_p0/test_nereids_other_commands.groovy new file mode 100644 index 00000000000..3115166c2b2 --- /dev/null +++ b/regression-test/suites/nereids_p0/test_nereids_other_commands.groovy @@ -0,0 +1,20 @@ +// 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("test_nereids_other_commands") { + checkNereidsExecute("sync;") +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org