mihaibudiu commented on code in PR #4361:
URL: https://github.com/apache/calcite/pull/4361#discussion_r2076547722
##########
core/src/test/resources/sql/planner.iq:
##########
@@ -128,7 +128,64 @@ EnumerableCalc(expr#0..2=[{inputs}], $f0=[$t1], $f1=[$t2])
EnumerableCalc(expr#0=[{inputs}], expr#1=[IS NOT NULL($t0)],
DEPTNO=[$t0], $condition=[$t1])
EnumerableValues(tuples=[[{ 10 }, { 10 }, { 20 }, { 30 }, { 30 }, {
50 }, { 50 }, { 60 }, { null }]])
!plan
+!set planner-rules original
+
+# [CALCITE-7000] Extend IntersectToSemiJoinRule to support n-way inputs
+!set planner-rules "-EnumerableRules.ENUMERABLE_INTERSECT_RULE,
+ -CoreRules.INTERSECT_TO_DISTINCT,
+ +CoreRules.INTERSECT_TO_SEMI_JOIN"
+select a from (values (1.0), (2.0), (3.0), (4.0), (5.0)) as t1 (a)
+intersect
+select a from (values (1), (2)) as t2 (a)
+intersect
+select a from (values (1.0), (4.0), (null)) as t3 (a);
++-----+
+| A |
++-----+
+| 1.0 |
++-----+
+(1 row)
+
+!ok
+
+EnumerableCalc(expr#0=[{inputs}], expr#1=[CAST($t0):DECIMAL(11, 1)], A=[$t1])
+ EnumerableNestedLoopJoin(condition=[OR(AND(IS NULL(CAST($0):DECIMAL(11, 1)),
IS NULL(CAST($1):DECIMAL(11, 1))), =(CAST($0):DECIMAL(11, 1),
CAST($1):DECIMAL(11, 1)))], joinType=[semi])
+ EnumerableAggregate(group=[{0}])
+ EnumerableHashJoin(condition=[=($1, $3)], joinType=[semi])
+ EnumerableCalc(expr#0=[{inputs}], expr#1=[CAST($t0):DECIMAL(11, 1) NOT
NULL], expr#2=[CAST($t1):DECIMAL(11, 1) NOT NULL], A=[$t1], A0=[$t2])
+ EnumerableValues(tuples=[[{ 1.0 }, { 2.0 }, { 3.0 }, { 4.0 }, { 5.0
}]])
+ EnumerableCalc(expr#0=[{inputs}], expr#1=[CAST($t0):DECIMAL(11, 1) NOT
NULL], expr#2=[CAST($t1):DECIMAL(11, 1) NOT NULL], A=[$t1], A0=[$t2])
+ EnumerableValues(tuples=[[{ 1 }, { 2 }]])
+ EnumerableCalc(expr#0=[{inputs}], expr#1=[CAST($t0):DECIMAL(11, 1)],
A=[$t1])
+ EnumerableValues(tuples=[[{ 1.0 }, { 4.0 }, { null }]])
+!plan
+!set planner-rules original
+# [CALCITE-7000] Extend IntersectToSemiJoinRule to support n-way inputs
+select a from (values (1.0), (2.0), (3.0), (4.0), (5.0)) as t1 (a)
+intersect
+select a from (values (1), (2)) as t2 (a)
+intersect
+select a from (values (1.0), (4.0), (null)) as t3 (a);
++-----+
+| A |
++-----+
+| 1.0 |
++-----+
+(1 row)
+
+!ok
+
+EnumerableIntersect(all=[false])
Review Comment:
yes, this looks good
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]