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 27e61b7626c [fix](planner)correlated predicate should include isnull predicate (#34833) 27e61b7626c is described below commit 27e61b7626c571aadad544a69a0529205520950a Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Wed May 15 18:02:18 2024 +0800 [fix](planner)correlated predicate should include isnull predicate (#34833) --- .../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 62737131b62..93823cf398c 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 @@ -957,7 +957,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