amaliujia commented on a change in pull request #1589: [CALCITE-3508]
Strengthen outer Join to inner if it is under a Filter that discards null values
URL: https://github.com/apache/calcite/pull/1589#discussion_r347180925
##########
File path: core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
##########
@@ -5452,19 +5458,25 @@ on d.deptno = e.deptno where d.deptno > 7 and
e.deptno > 9]]>
<Resource name="planBefore">
<![CDATA[
LogicalProject(EXPR$0=[1])
- LogicalFilter(condition=[AND(>($7, 7), >($16, 9))])
- LogicalJoin(condition=[=($7, $16)], joinType=[full])
- LogicalTableScan(table=[[CATALOG, SALES, EMP]])
- LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+ LogicalProject(EMPNO=[CAST($0):INTEGER], ENAME=[CAST($1):VARCHAR(20)],
JOB=[CAST($2):VARCHAR(10)], MGR=[$3], HIREDATE=[CAST($4):TIMESTAMP(0)],
SAL=[CAST($5):INTEGER], COMM=[CAST($6):INTEGER], DEPTNO=[CAST($7):INTEGER],
SLACKER=[CAST($8):BOOLEAN], EMPNO0=[CAST($9):INTEGER],
ENAME0=[CAST($10):VARCHAR(20)], JOB0=[CAST($11):VARCHAR(10)], MGR0=[$12],
HIREDATE0=[CAST($13):TIMESTAMP(0)], SAL0=[CAST($14):INTEGER],
COMM0=[CAST($15):INTEGER], DEPTNO0=[CAST($16):INTEGER],
SLACKER0=[CAST($17):BOOLEAN])
+ LogicalJoin(condition=[=($7, $16)], joinType=[inner])
+ LogicalFilter(condition=[>($7, 7)])
+ LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+ LogicalFilter(condition=[>($7, 9)])
+ LogicalTableScan(table=[[CATALOG, SALES, EMP]])
]]>
</Resource>
<Resource name="planAfter">
<![CDATA[
LogicalProject(EXPR$0=[1])
- LogicalFilter(condition=[AND(>($7, 7), >($16, 9))])
Review comment:
One benefit of this change is to make filters pushdown happen in full outer
join case. It's awesome!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services