This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 3d6c51d6c1115a5d18e4e05ebfd083ad252a8e80 Author: Mingyu Chen <morning...@163.com> AuthorDate: Mon Sep 4 15:19:37 2023 +0800 [fix](row-policy) fix creating row policy with forward issue (#23801) The `CreateRowPolicyCommand` is implemented with overriding `run()` method. So when executing `create row policy` in non-master FE, and forward it to Master FE, it will call `execute(TUniqueId queryId)` method and go through `executeByNereids()`. And because without `run()` method, it will do nothing and return OK. So after `show row policy`, user will get empty result. This PR fix it by implmenting the `run()` method but throw an Exception, so that it will fallback to old planner, to do the creating row policy command normally. The full implement of `run()` method should be implemented later. This is just a tmp fix. --- .../nereids/trees/plans/commands/CreatePolicyCommand.java | 9 +++++++++ .../src/main/java/org/apache/doris/qe/ConnectProcessor.java | 10 +--------- tools/single-node-cluster/multi-fe | 0 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreatePolicyCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreatePolicyCommand.java index 318d1b5e79..9c878fc6e2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreatePolicyCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreatePolicyCommand.java @@ -18,11 +18,14 @@ package org.apache.doris.nereids.trees.plans.commands; import org.apache.doris.analysis.UserIdentity; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.plans.PlanType; import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor; import org.apache.doris.policy.FilterType; import org.apache.doris.policy.PolicyTypeEnum; +import org.apache.doris.qe.ConnectContext; +import org.apache.doris.qe.StmtExecutor; import java.util.List; import java.util.Map; @@ -73,4 +76,10 @@ public class CreatePolicyCommand extends Command implements ForwardWithSync { public <R, C> R accept(PlanVisitor<R, C> visitor, C context) { return visitor.visitCreatePolicyCommand(this, context); } + + @Override + public void run(ConnectContext ctx, StmtExecutor executor) throws Exception { + throw new AnalysisException("Not support create policy command in Nereids now"); + } } + diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java index 2a6b15573e..5bef0c05be 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java @@ -56,7 +56,6 @@ import org.apache.doris.nereids.glue.LogicalPlanAdapter; import org.apache.doris.nereids.minidump.MinidumpUtils; import org.apache.doris.nereids.parser.NereidsParser; import org.apache.doris.nereids.stats.StatsErrorEstimator; -import org.apache.doris.nereids.trees.plans.commands.CreatePolicyCommand; import org.apache.doris.plugin.AuditEvent.EventType; import org.apache.doris.proto.Data; import org.apache.doris.qe.QueryState.MysqlStateType; @@ -386,14 +385,6 @@ public class ConnectProcessor { if (mysqlCommand == MysqlCommand.COM_QUERY && ctx.getSessionVariable().isEnableNereidsPlanner()) { try { stmts = new NereidsParser().parseSQL(originStmt); - for (StatementBase stmt : stmts) { - LogicalPlanAdapter logicalPlanAdapter = (LogicalPlanAdapter) stmt; - // TODO: remove this after we could process CreatePolicyCommand - if (logicalPlanAdapter.getLogicalPlan() instanceof CreatePolicyCommand) { - stmts = null; - break; - } - } } catch (Exception e) { // TODO: We should catch all exception here until we support all query syntax. LOG.debug("Nereids parse sql failed. Reason: {}. Statement: \"{}\".", @@ -847,3 +838,4 @@ public class ConnectProcessor { } } + diff --git a/tools/single-node-cluster/multi-fe b/tools/single-node-cluster/multi-fe old mode 100644 new mode 100755 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org