NobiGo commented on PR #2761:
URL: https://github.com/apache/calcite/pull/2761#issuecomment-1091388684
@libenchao
```
select * from T1, T2 where T1.c1 = T2.c and T1.c2 = T2.c
```
we can push T1.c1 = T1.c2 into the left operand of the Join, which is more
efficient?
Yes, I think it is an issue we can improve. So Let's get it more clearly.
So the plan will from
```
EnumerableMergeJoin(condition=[AND(=($0, $2), =($0, $3))],
joinType=[inner]): rowcount = 225.0, cumulative cost = {825.0 rows,
20464.7488183476 cpu, 0.0 io}, id = 104
EnumerableSort(sort0=[$0], dir0=[ASC]): rowcount = 100.0, cumulative cost
= {200.0 rows, 9311.340371976183 cpu, 0.0 io}, id = 99
EnumerableTableScan(table=[[foodmart, sales_fact_1997]]): rowcount =
100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 33
EnumerableSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC]): rowcount =
100.0, cumulative cost = {200.0 rows, 11153.40844637142 cpu, 0.0 io}, id = 102
EnumerableTableScan(table=[[hr, emps]]): rowcount = 100.0, cumulative
cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 37
```
become
```
EnumerableMergeJoin(condition=[=($0, $3)], joinType=[inner]): rowcount =
225.0, cumulative cost = {670.0 rows, 11187.238444372979 cpu, 0.0 io}, id = 114
EnumerableSort(sort0=[$0], dir0=[ASC]): rowcount = 100.0, cumulative cost
= {200.0 rows, 9311.340371976183 cpu, 0.0 io}, id = 107
EnumerableTableScan(table=[[foodmart, sales_fact_1997]]): rowcount =
100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 33
EnumerableSort(sort0=[$1], dir0=[ASC]): rowcount = 15.0, cumulative cost =
{130.0 rows, 1875.8980723967957 cpu, 0.0 io}, id = 112
EnumerableCalc(expr#0..2=[{inputs}], expr#3=[=($t0, $t1)],
proj#0..2=[{exprs}], $condition=[$t3]): rowcount = 15.0, cumulative cost =
{115.0 rows, 901.0 cpu, 0.0 io}, id = 116
EnumerableTableScan(table=[[hr, emps]]): rowcount = 100.0, cumulative
cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 37
```
Right? So maybe we can modify the JIRA description to illustrate it?
Do we need to do it in JoinConditionPushRule? Maybe we can discuss in JIRA.
--
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]