Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ private Pair<LogicalPlan, Optional<Expression>> subqueryToApply(

if (!ctx.subqueryIsAnalyzed(subqueryExpr)) {
tmpPlan = addApply(subqueryExpr, tmpPlan.first,
subqueryToMarkJoinSlot, ctx, conjunct,
subqueryToMarkJoinSlot, ctx, tmpPlan.second,
isProject, subqueryExprs.size() == 1, isMarkJoinSlotNotNull);
}
}
Expand Down
16 changes: 16 additions & 0 deletions regression-test/data/nereids_p0/subquery/subquery_unnesting.out
Original file line number Diff line number Diff line change
Expand Up @@ -1519,3 +1519,19 @@
20 2
22 3
24 4

-- !select64 --
0
0
0
0
0
0
0
0
0
0
0
0
2

Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
}
Loading