[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.
This commit is contained in:
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -387,14 +386,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: \"{}\".",
|
||||
@ -848,3 +839,4 @@ public class ConnectProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
0
tools/single-node-cluster/multi-fe
Normal file → Executable file
0
tools/single-node-cluster/multi-fe
Normal file → Executable file
Reference in New Issue
Block a user