This is an automated email from the ASF dual-hosted git repository. starocean999 pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 5d719b8e564 [fix](planner)correlated predicate should include isnull predicate (#34834) 5d719b8e564 is described below commit 5d719b8e564e7d9eeef22209480e5d6c4f071984 Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Wed May 15 17:48:39 2024 +0800 [fix](planner)correlated predicate should include isnull predicate (#34834) --- .../org/apache/doris/analysis/StmtRewriter.java | 3 +- .../correctness_p0/test_subquery_with_agg.groovy | 41 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java index 1ac31c8fc63..032ce708617 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java @@ -947,7 +947,8 @@ public class StmtRewriter { * query block (i.e. is not bound by the given 'tupleIds'). */ private static boolean isCorrelatedPredicate(Expr expr, List<TupleId> tupleIds) { - return (expr instanceof BinaryPredicate || expr instanceof SlotRef) && !expr.isBoundByTupleIds(tupleIds); + return (expr instanceof BinaryPredicate || expr instanceof SlotRef + || expr instanceof IsNullPredicate) && !expr.isBoundByTupleIds(tupleIds); } /** diff --git a/regression-test/suites/correctness_p0/test_subquery_with_agg.groovy b/regression-test/suites/correctness_p0/test_subquery_with_agg.groovy index e0592830ffe..a962d64dcbc 100644 --- a/regression-test/suites/correctness_p0/test_subquery_with_agg.groovy +++ b/regression-test/suites/correctness_p0/test_subquery_with_agg.groovy @@ -82,4 +82,45 @@ suite("test_subquery_with_agg") { drop table if exists agg_subquery_table; """ + sql """drop table if exists subquery_table_xyz;""" + sql """CREATE TABLE `subquery_table_xyz` ( + `phone`bigint(20) NULL + ) ENGINE=OLAP + DUPLICATE KEY(`phone`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`phone`) BUCKETS 3 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1" + );""" + sql """WITH tmp1 AS + (SELECT DISTINCT phone + FROM subquery_table_xyz oua + WHERE (NOT EXISTS + (SELECT 1 + FROM subquery_table_xyz o1 + WHERE oua.phone = o1.phone + AND phone IS NOT NULL))), + tmp2 AS + (SELECT DISTINCT phone + FROM subquery_table_xyz oua + WHERE (NOT EXISTS + (SELECT 1 + FROM subquery_table_xyz o1 + WHERE oua.phone = o1.phone + and phone IS NOT NULL))), + tmp3 AS + (SELECT DISTINCT phone + FROM subquery_table_xyz oua + WHERE (NOT EXISTS + (SELECT 1 + FROM subquery_table_xyz o1 + WHERE oua.phone = o1.phone and + phone IS NOT NULL))) + SELECT COUNT(DISTINCT tmp1.phone) + FROM tmp1 + JOIN tmp2 + ON tmp1.phone = tmp2.phone + JOIN tmp3 + ON tmp2.phone = tmp3.phone;""" + } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org