This is an automated email from the ASF dual-hosted git repository.

zhenchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new 74bbf474d6 Move ExpandDisjunctionForJoinInputsRule test from 
planner.iq to hep.iq
74bbf474d6 is described below

commit 74bbf474d689b5ee9b4418748559cd4a311ceff5
Author: Zhen Chen <[email protected]>
AuthorDate: Wed Dec 31 18:28:50 2025 +0800

    Move ExpandDisjunctionForJoinInputsRule test from planner.iq to hep.iq
---
 core/src/test/resources/sql/hep.iq     | 74 ++++++++++++++++++++++++++++++++++
 core/src/test/resources/sql/planner.iq | 69 -------------------------------
 2 files changed, 74 insertions(+), 69 deletions(-)

diff --git a/core/src/test/resources/sql/hep.iq 
b/core/src/test/resources/sql/hep.iq
index 556d10f721..8dd5302347 100644
--- a/core/src/test/resources/sql/hep.iq
+++ b/core/src/test/resources/sql/hep.iq
@@ -164,4 +164,78 @@ EnumerableCalc(expr#0..2=[{inputs}], MGR=[$t1], COMM=[$t2])
 !}
 !set hep-rules original
 
+# Test predicate push down with/without expand disjunction.
+with t1 (id1, col11, col12) as (values (1, 11, 111), (2, 12, 122), (3, 13, 
133), (4, 14, 144), (5, 15, 155)),
+t2 (id2, col21, col22) as (values (1, 21, 211), (2, 22, 222), (3, 23, 233), 
(4, 24, 244), (5, 25, 255)),
+t3 (id3, col31, col32) as (values (1, 31, 311), (2, 32, 322), (3, 33, 333), 
(4, 34, 344), (5, 35, 355))
+select * from t1, t2, t3 where id1 = id2 and id1 = id3 and
+(
+(col11 > 11 and col31 <= 32)
+or
+(col22 < 255 and col32 >= 344)
+);
++-----+-------+-------+-----+-------+-------+-----+-------+-------+
+| ID1 | COL11 | COL12 | ID2 | COL21 | COL22 | ID3 | COL31 | COL32 |
++-----+-------+-------+-----+-------+-------+-----+-------+-------+
+|   2 |    12 |   122 |   2 |    22 |   222 |   2 |    32 |   322 |
+|   4 |    14 |   144 |   4 |    24 |   244 |   4 |    34 |   344 |
++-----+-------+-------+-----+-------+-------+-----+-------+-------+
+(2 rows)
+
+!ok
+
+EnumerableMergeJoin(condition=[AND(=($0, $6), OR(AND(>($1, 11), <=($7, 32)), 
AND(<($5, 255), >=($8, 344))))], joinType=[inner])
+  EnumerableMergeJoin(condition=[=($0, $3)], joinType=[inner])
+    EnumerableValues(tuples=[[{ 1, 11, 111 }, { 2, 12, 122 }, { 3, 13, 133 }, 
{ 4, 14, 144 }, { 5, 15, 155 }]])
+    EnumerableValues(tuples=[[{ 1, 21, 211 }, { 2, 22, 222 }, { 3, 23, 233 }, 
{ 4, 24, 244 }, { 5, 25, 255 }]])
+  EnumerableValues(tuples=[[{ 1, 31, 311 }, { 2, 32, 322 }, { 3, 33, 333 }, { 
4, 34, 344 }, { 5, 35, 355 }]])
+!plan
+
+!set hep-rules "
++CoreRules.EXPAND_FILTER_DISJUNCTION_LOCAL,
++CoreRules.EXPAND_JOIN_DISJUNCTION_LOCAL,
++CoreRules.JOIN_CONDITION_PUSH,
++CoreRules.FILTER_INTO_JOIN"
+
+with t1 (id1, col11, col12) as (values (1, 11, 111), (2, 12, 122), (3, 13, 
133), (4, 14, 144), (5, 15, 155)),
+t2 (id2, col21, col22) as (values (1, 21, 211), (2, 22, 222), (3, 23, 233), 
(4, 24, 244), (5, 25, 255)),
+t3 (id3, col31, col32) as (values (1, 31, 311), (2, 32, 322), (3, 33, 333), 
(4, 34, 344), (5, 35, 355))
+select * from t1, t2, t3 where id1 = id2 and id1 = id3 and
+(
+(col11 > 11 and col31 <= 32)
+or
+(col22 < 255 and col32 >= 344)
+);
++-----+-------+-------+-----+-------+-------+-----+-------+-------+
+| ID1 | COL11 | COL12 | ID2 | COL21 | COL22 | ID3 | COL31 | COL32 |
++-----+-------+-------+-----+-------+-------+-----+-------+-------+
+|   2 |    12 |   122 |   2 |    22 |   222 |   2 |    32 |   322 |
+|   4 |    14 |   144 |   4 |    24 |   244 |   4 |    34 |   344 |
++-----+-------+-------+-----+-------+-------+-----+-------+-------+
+(2 rows)
+
+!ok
+
+!if (use_old_decorr) {
+EnumerableCalc(expr#0..8=[{inputs}], proj#0..8=[{exprs}])
+  EnumerableHashJoin(condition=[AND(=($0, $6), OR(AND(>($1, 11), <=($7, 32)), 
AND(<($5, 255), >=($8, 344))))], joinType=[inner])
+    EnumerableMergeJoin(condition=[AND(=($0, $3), OR(>($1, 11), <($5, 255)))], 
joinType=[inner])
+      EnumerableValues(tuples=[[{ 1, 11, 111 }, { 2, 12, 122 }, { 3, 13, 133 
}, { 4, 14, 144 }, { 5, 15, 155 }]])
+      EnumerableValues(tuples=[[{ 1, 21, 211 }, { 2, 22, 222 }, { 3, 23, 233 
}, { 4, 24, 244 }, { 5, 25, 255 }]])
+    EnumerableCalc(expr#0..2=[{inputs}], expr#3=[32], expr#4=[<=($t1, $t3)], 
expr#5=[344], expr#6=[>=($t2, $t5)], expr#7=[OR($t4, $t6)], 
proj#0..2=[{exprs}], $condition=[$t7])
+      EnumerableValues(tuples=[[{ 1, 31, 311 }, { 2, 32, 322 }, { 3, 33, 333 
}, { 4, 34, 344 }, { 5, 35, 355 }]])
+!plan
+!}
+
+!if (use_new_decorr) {
+EnumerableHashJoin(condition=[AND(=($0, $6), OR(AND(>($1, 11), <=($7, 32)), 
AND(<($5, 255), >=($8, 344))))], joinType=[inner])
+  EnumerableMergeJoin(condition=[AND(=($0, $3), OR(>($1, 11), <($5, 255)))], 
joinType=[inner])
+    EnumerableValues(tuples=[[{ 1, 11, 111 }, { 2, 12, 122 }, { 3, 13, 133 }, 
{ 4, 14, 144 }, { 5, 15, 155 }]])
+    EnumerableValues(tuples=[[{ 1, 21, 211 }, { 2, 22, 222 }, { 3, 23, 233 }, 
{ 4, 24, 244 }, { 5, 25, 255 }]])
+  EnumerableCalc(expr#0..2=[{inputs}], expr#3=[32], expr#4=[<=($t1, $t3)], 
expr#5=[344], expr#6=[>=($t2, $t5)], expr#7=[OR($t4, $t6)], 
proj#0..2=[{exprs}], $condition=[$t7])
+    EnumerableValues(tuples=[[{ 1, 31, 311 }, { 2, 32, 322 }, { 3, 33, 333 }, 
{ 4, 34, 344 }, { 5, 35, 355 }]])
+!plan
+!}
+!set hep-rules original
+
 # End hep.iq
diff --git a/core/src/test/resources/sql/planner.iq 
b/core/src/test/resources/sql/planner.iq
index 1147a534ef..1c90347a21 100644
--- a/core/src/test/resources/sql/planner.iq
+++ b/core/src/test/resources/sql/planner.iq
@@ -310,75 +310,6 @@ EnumerableMinus(all=[false])
     EnumerableValues(tuples=[[{ 1.0 }, { 4.0 }, { null }]])
 !plan
 
-# Test predicate push down with/without expand disjunction.
-with t1 (id1, col11, col12) as (values (1, 11, 111), (2, 12, 122), (3, 13, 
133), (4, 14, 144), (5, 15, 155)),
-t2 (id2, col21, col22) as (values (1, 21, 211), (2, 22, 222), (3, 23, 233), 
(4, 24, 244), (5, 25, 255)),
-t3 (id3, col31, col32) as (values (1, 31, 311), (2, 32, 322), (3, 33, 333), 
(4, 34, 344), (5, 35, 355))
-select * from t1, t2, t3 where id1 = id2 and id1 = id3 and
-(
-(col11 > 11 and col31 <= 32)
-or
-(col22 < 255 and col32 >= 344)
-);
-+-----+-------+-------+-----+-------+-------+-----+-------+-------+
-| ID1 | COL11 | COL12 | ID2 | COL21 | COL22 | ID3 | COL31 | COL32 |
-+-----+-------+-------+-----+-------+-------+-----+-------+-------+
-|   2 |    12 |   122 |   2 |    22 |   222 |   2 |    32 |   322 |
-|   4 |    14 |   144 |   4 |    24 |   244 |   4 |    34 |   344 |
-+-----+-------+-------+-----+-------+-------+-----+-------+-------+
-(2 rows)
-
-!ok
-
-EnumerableMergeJoin(condition=[AND(=($0, $6), OR(AND(>($1, 11), <=($7, 32)), 
AND(<($5, 255), >=($8, 344))))], joinType=[inner])
-  EnumerableMergeJoin(condition=[=($0, $3)], joinType=[inner])
-    EnumerableValues(tuples=[[{ 1, 11, 111 }, { 2, 12, 122 }, { 3, 13, 133 }, 
{ 4, 14, 144 }, { 5, 15, 155 }]])
-    EnumerableValues(tuples=[[{ 1, 21, 211 }, { 2, 22, 222 }, { 3, 23, 233 }, 
{ 4, 24, 244 }, { 5, 25, 255 }]])
-  EnumerableValues(tuples=[[{ 1, 31, 311 }, { 2, 32, 322 }, { 3, 33, 333 }, { 
4, 34, 344 }, { 5, 35, 355 }]])
-!plan
-
-!set planner-rules "
-+CoreRules.EXPAND_FILTER_DISJUNCTION_LOCAL"
-
-with t1 (id1, col11, col12) as (values (1, 11, 111), (2, 12, 122), (3, 13, 
133), (4, 14, 144), (5, 15, 155)),
-t2 (id2, col21, col22) as (values (1, 21, 211), (2, 22, 222), (3, 23, 233), 
(4, 24, 244), (5, 25, 255)),
-t3 (id3, col31, col32) as (values (1, 31, 311), (2, 32, 322), (3, 33, 333), 
(4, 34, 344), (5, 35, 355))
-select * from t1, t2, t3 where id1 = id2 and id1 = id3 and
-(
-(col11 > 11 and col31 <= 32)
-or
-(col22 < 255 and col32 >= 344)
-);
-+-----+-------+-------+-----+-------+-------+-----+-------+-------+
-| ID1 | COL11 | COL12 | ID2 | COL21 | COL22 | ID3 | COL31 | COL32 |
-+-----+-------+-------+-----+-------+-------+-----+-------+-------+
-|   2 |    12 |   122 |   2 |    22 |   222 |   2 |    32 |   322 |
-|   4 |    14 |   144 |   4 |    24 |   244 |   4 |    34 |   344 |
-+-----+-------+-------+-----+-------+-------+-----+-------+-------+
-(2 rows)
-
-!ok
-
-!if (use_old_decorr) {
-EnumerableHashJoin(condition=[AND(=($0, $6), OR(AND(>($1, 11), <=($7, 32)), 
AND(<($5, 255), >=($8, 344))))], joinType=[inner])
-  EnumerableMergeJoin(condition=[AND(=($0, $3), OR(>($1, 11), <($5, 255)))], 
joinType=[inner])
-    EnumerableValues(tuples=[[{ 1, 11, 111 }, { 2, 12, 122 }, { 3, 13, 133 }, 
{ 4, 14, 144 }, { 5, 15, 155 }]])
-    EnumerableValues(tuples=[[{ 1, 21, 211 }, { 2, 22, 222 }, { 3, 23, 233 }, 
{ 4, 24, 244 }, { 5, 25, 255 }]])
-  EnumerableCalc(expr#0..2=[{inputs}], expr#3=[32], expr#4=[<=($t1, $t3)], 
expr#5=[344], expr#6=[>=($t2, $t5)], expr#7=[OR($t4, $t6)], 
proj#0..2=[{exprs}], $condition=[$t7])
-    EnumerableValues(tuples=[[{ 1, 31, 311 }, { 2, 32, 322 }, { 3, 33, 333 }, 
{ 4, 34, 344 }, { 5, 35, 355 }]])
-!plan
-!}
-
-!if (use_new_decorr) {
-EnumerableMergeJoin(condition=[AND(=($0, $6), OR(AND(>($1, 11), <=($7, 32)), 
AND(<($5, 255), >=($8, 344))))], joinType=[inner])
-  EnumerableMergeJoin(condition=[=($0, $3)], joinType=[inner])
-    EnumerableValues(tuples=[[{ 1, 11, 111 }, { 2, 12, 122 }, { 3, 13, 133 }, 
{ 4, 14, 144 }, { 5, 15, 155 }]])
-    EnumerableValues(tuples=[[{ 1, 21, 211 }, { 2, 22, 222 }, { 3, 23, 233 }, 
{ 4, 24, 244 }, { 5, 25, 255 }]])
-  EnumerableValues(tuples=[[{ 1, 31, 311 }, { 2, 32, 322 }, { 3, 33, 333 }, { 
4, 34, 344 }, { 5, 35, 355 }]])
-!plan
-!}
-!set planner-rules original
-
 # [CALCITE-7086] Implement a rule that performs the inverse operation of 
AggregateCaseToFilterRule
 # Refer to RelToSqlConverterTest.testAggregateFilterToCase(). The following 
two SQL
 # represent the true filtered Aggregate and the case-style Aggregate converted 
by AggregateFilterToCaseRule.

Reply via email to