diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java b/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java index 2f0262e985afab..2a957775e113b8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java @@ -42,6 +42,7 @@ import org.apache.doris.load.loadv2.JobState; import org.apache.doris.mysql.privilege.PrivPredicate; import org.apache.doris.nereids.trees.expressions.And; +import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.qe.ConnectContext; import com.google.common.collect.Lists; @@ -528,7 +529,7 @@ private static void addNeedCancelLoadJob(String label, String state, * used for nereids planner */ public void cancelLoadJob(String dbName, String label, String state, - org.apache.doris.nereids.trees.expressions.CompoundPredicate operator) + Expression operator) throws JobException, AnalysisException, DdlException { Database db = Env.getCurrentInternalCatalog().getDbOrDdlException(dbName); // List of load jobs waiting to be cancelled @@ -582,7 +583,7 @@ public void cancelLoadJob(String dbName, String label, String state, } private static void addNeedCancelLoadJob(String label, String state, - org.apache.doris.nereids.trees.expressions.CompoundPredicate operator, + Expression operator, List loadJobs, List matchLoadJobs) throws AnalysisException { diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java index 8d1988607cd1c3..eb9b3f0e831a22 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java @@ -47,7 +47,7 @@ import org.apache.doris.load.Load; import org.apache.doris.mysql.privilege.PrivPredicate; import org.apache.doris.nereids.trees.expressions.And; -import org.apache.doris.nereids.trees.expressions.CompoundPredicate; +import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.persist.CleanLabelOperationLog; import org.apache.doris.qe.ConnectContext; import org.apache.doris.qe.OriginStatement; @@ -248,7 +248,7 @@ public void recordFinishedLoadJob(String label, long transactionId, String dbNam * Match need cancel loadJob by stmt. **/ @VisibleForTesting - public static void addNeedCancelLoadJob(String label, String state, CompoundPredicate operator, + public static void addNeedCancelLoadJob(String label, String state, Expression operator, List loadJobs, List matchLoadJobs) throws AnalysisException { PatternMatcher matcher = PatternMatcherWrapper.createMysqlPattern(label, @@ -281,7 +281,7 @@ public static void addNeedCancelLoadJob(String label, String state, CompoundPred /** * Cancel load job by stmt. **/ - public void cancelLoadJob(String dbName, String label, String state, CompoundPredicate operator) + public void cancelLoadJob(String dbName, String label, String state, Expression operator) throws DdlException, AnalysisException { Database db = Env.getCurrentInternalCatalog().getDbOrDdlException(dbName); // List of load jobs waiting to be cancelled diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java index 1e01e544a2510d..c4e055e735f899 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java @@ -401,15 +401,11 @@ public Expression visitAnd(And and, ExpressionRewriteContext context) { // x and y return and.withChildren(nonTrueLiteral); } - } else if (nullCount == 1) { - if (nonTrueLiteral.size() == 1) { - // null and true - return new NullLiteral(BooleanType.INSTANCE); - } + } else if (nullCount < and.children().size()) { // null and x return and.withChildren(nonTrueLiteral); } else { - // null and null + // null and null and null and ... return new NullLiteral(BooleanType.INSTANCE); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CancelCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CancelCommand.java index 88ecf3cba1e6d8..e82191c3648e97 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CancelCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CancelCommand.java @@ -144,18 +144,18 @@ private void binaryCheck(Expression expr, Map supportedColumns) private void compoundCheck(Expression expr, Map supportedColumns) throws AnalysisException { // current only support label and state if (expr instanceof Not) { - throw new AnalysisException("Current not support NOT operator"); + throw new AnalysisException("not support NOT operator"); } for (int i = 0; i < 2; i++) { Expression child = expr.child(i); if (child instanceof CompoundPredicate) { - throw new AnalysisException("Current not support nested clause"); + throw new AnalysisException("not support where clause: " + expr.toSql()); } else if (child instanceof Like) { likeCheck(child, supportedColumns); } else if (child instanceof BinaryOperator) { binaryCheck(child, supportedColumns); } else { - throw new AnalysisException("Only support like/binary predicate"); + throw new AnalysisException("Only support like/equalTo/And/Or predicate"); } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CancelLoadCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CancelLoadCommand.java index 6ec13f5f84f882..80c622a1957a18 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CancelLoadCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CancelLoadCommand.java @@ -21,7 +21,6 @@ import org.apache.doris.common.UserException; import org.apache.doris.job.exception.JobException; import org.apache.doris.load.ExportJobState; -import org.apache.doris.nereids.trees.expressions.CompoundPredicate; 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; @@ -57,9 +56,9 @@ public CancelLoadCommand(String dbName, Expression whereClause) { public void run(ConnectContext ctx, StmtExecutor executor) throws Exception { validate(ctx); try { - ctx.getEnv().getJobManager().cancelLoadJob(dbName, label, state, (CompoundPredicate) whereClause); + ctx.getEnv().getJobManager().cancelLoadJob(dbName, label, state, whereClause); } catch (JobException e) { - ctx.getEnv().getLoadManager().cancelLoadJob(dbName, label, state, (CompoundPredicate) whereClause); + ctx.getEnv().getLoadManager().cancelLoadJob(dbName, label, state, whereClause); } }