NobiGo commented on PR #2761:
URL: https://github.com/apache/calcite/pull/2761#issuecomment-1090000131

   Hi @libenchao @rubenada :
   I have tried this again and I find some rules maybe do the same thing[ 
JoinPushThroughJoinRule.RIGHT,JoinPushThroughJoinRule.LEFT]:
   
   For example (include the Rule):
   ```
   EnumerableMergeJoin(condition=[=($0, $4)], joinType=[inner]): rowcount = 
22500.0, cumulative cost = {26400.0 rows, 27934.021115928546 cpu, 0.0 io}, id = 
468
     EnumerableSort(sort0=[$0], dir0=[ASC]): rowcount = 100.0, cumulative cost 
= {200.0 rows, 9311.340371976183 cpu, 0.0 io}, id = 458
       EnumerableTableScan(table=[[foodmart, sales_fact_1997]]): rowcount = 
100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 43
     EnumerableMergeJoin(condition=[=($0, $2)], joinType=[inner]): rowcount = 
1500.0, cumulative cost = {2100.0 rows, 18622.680743952365 cpu, 0.0 io}, id = 
466
       EnumerableSort(sort0=[$0], dir0=[ASC]): rowcount = 100.0, cumulative 
cost = {200.0 rows, 9311.340371976183 cpu, 0.0 io}, id = 461
         EnumerableTableScan(table=[[foodmart2, sales_fact_1997]]): rowcount = 
100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 47
       EnumerableSort(sort0=[$0], dir0=[ASC]): rowcount = 100.0, cumulative 
cost = {200.0 rows, 9311.340371976183 cpu, 0.0 io}, id = 464
         EnumerableTableScan(table=[[foodmart3, sales_fact_1997]]): rowcount = 
100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 58
   ```
   
   For example (exclude the Rule):
   ```
   EnumerableMergeJoin(condition=[AND(=($0, $4), =($2, $4))], 
joinType=[inner]): rowcount = 22500.0, cumulative cost = {143000.0 rows, 
2588408.644525307 cpu, 0.0 io}, id = 139
     EnumerableSort(sort0=[$0], sort1=[$2], dir0=[ASC], dir1=[ASC]): rowcount = 
10000.0, cumulative cost = {110200.0 rows, 2579097.304153331 cpu, 0.0 io}, id = 
134
       EnumerableNestedLoopJoin(condition=[true], joinType=[inner]): rowcount = 
10000.0, cumulative cost = {100200.0 rows, 202.0 cpu, 0.0 io}, id = 132
         EnumerableTableScan(table=[[foodmart, sales_fact_1997]]): rowcount = 
100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 43
         EnumerableTableScan(table=[[foodmart2, sales_fact_1997]]): rowcount = 
100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 47
     EnumerableSort(sort0=[$0], dir0=[ASC]): rowcount = 100.0, cumulative cost 
= {200.0 rows, 9311.340371976183 cpu, 0.0 io}, id = 137
       EnumerableTableScan(table=[[foodmart3, sales_fact_1997]]): rowcount = 
100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 58
   ```
   
   So from the result, I think it has done the same thing? But why I don't know 
for now.
   
   The SQL:
   ```
   select * from \"foodmart\".\"sales_fact_1997\" as 
t1,\"foodmart2\".\"sales_fact_1997\" as t2,\"foodmart3\".\"sales_fact_1997\"  
as t3  where t1.\"cust_id\"=t3.\"cust_id\" and t2.\"cust_id\"=t3.\"cust_id\"
   ```


-- 
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]

Reply via email to