This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 566cc51cf1c branch-3.0: [fix](nereids) fix subquery unnest can not found aggregate slot #51086 (#51137) 566cc51cf1c is described below commit 566cc51cf1c38cee41160ccfffd9ecbf722541f4 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Thu May 22 14:21:32 2025 +0800 branch-3.0: [fix](nereids) fix subquery unnest can not found aggregate slot #51086 (#51137) Cherry-picked from #51086 Co-authored-by: 924060929 <lanhuaj...@selectdb.com> --- .../doris/nereids/rules/analysis/SubqueryToApply.java | 2 +- .../data/nereids_p0/subquery/subquery_unnesting.out | Bin 7209 -> 7253 bytes .../nereids_p0/subquery/subquery_unnesting.groovy | 9 +++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubqueryToApply.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubqueryToApply.java index d64c7f2baed..cacd3d9cd6c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubqueryToApply.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubqueryToApply.java @@ -381,7 +381,7 @@ public class SubqueryToApply implements AnalysisRuleFactory { if (!ctx.subqueryIsAnalyzed(subqueryExpr)) { tmpPlan = addApply(subqueryExpr, tmpPlan.first, - subqueryToMarkJoinSlot, ctx, conjunct, + subqueryToMarkJoinSlot, ctx, tmpPlan.second, isProject, subqueryExprs.size() == 1, isMarkJoinSlotNotNull); } } diff --git a/regression-test/data/nereids_p0/subquery/subquery_unnesting.out b/regression-test/data/nereids_p0/subquery/subquery_unnesting.out index 5124b5f9700..535e10059ad 100644 Binary files a/regression-test/data/nereids_p0/subquery/subquery_unnesting.out and b/regression-test/data/nereids_p0/subquery/subquery_unnesting.out differ diff --git a/regression-test/suites/nereids_p0/subquery/subquery_unnesting.groovy b/regression-test/suites/nereids_p0/subquery/subquery_unnesting.groovy index 397c5cfbf29..8fa6524aefa 100644 --- a/regression-test/suites/nereids_p0/subquery/subquery_unnesting.groovy +++ b/regression-test/suites/nereids_p0/subquery/subquery_unnesting.groovy @@ -133,4 +133,13 @@ suite ("subquery_unnesting") { qt_select61 """SELECT * FROM t1 AS t1 WHERE EXISTS (SELECT k1 FROM t1 AS t2 WHERE t1.k1 <> t2.k1 + 7 GROUP BY k1 HAVING k1 >= 100);""" qt_select62 """select * from t1 left semi join ( select * from t1 where t1.k1 < -1 ) l on true;""" qt_select63 """SELECT * FROM t1 AS t1 WHERE EXISTS (SELECT k1 FROM t1 AS t2 WHERE t1.k1 <> t2.k1 + 7 GROUP BY k1 HAVING sum(k2) >= 1) order by t1.k1, t1.k2;""" + + qt_select64 """ + select case + when t1.k1=1 then (select count(*) from t2 where t1.k2=t2.k2) + when t1.k1=2 then (select count(*) from t3 where t1.k2=t3.k2) + else 0 end as kk + from t1 + order by kk + """ } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org