libenchao commented on code in PR #2837:
URL: https://github.com/apache/calcite/pull/2837#discussion_r903516909
##########
core/src/main/java/org/apache/calcite/rel/rules/FilterJoinRule.java:
##########
@@ -138,7 +138,9 @@ protected void perform(RelOptRuleCall call, @Nullable
Filter filter,
}
}
- joinFilters = inferJoinEqualConditions(joinFilters, join);
+ if (joinType != JoinRelType.FULL) {
Review Comment:
for partial outer join, e.g. `left outer`, it seems that we cannot infer
equal conditions either, for the following sql:
```sql
select *
from emp e left outer join dept d
on e.empno = d.deptno and e.deptno = d.deptno
```
we should not transform it to:
```sql
select *
from (select * from emp where empno = deptno) e left outer join dept d
on e.empno = d.deptno
```
I think we should use `aboveFilters` for outer join, and `aboveFilters` plus
`joinFilters` for inner join.
##########
core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml:
##########
@@ -4537,6 +4537,51 @@ LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2],
MGR=[$3], HIREDATE=[$4], SAL=[$
LogicalFilter(condition=[=($7, $0)])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase name="testJoinConditionPushdown3">
+ <Resource name="sql">
+ <![CDATA[select *
+from emp e full join dept d
+on e.deptno = d.deptno and e.empno = d.deptno
+]]>
+ </Resource>
+ <Resource name="planBefore">
Review Comment:
it seems that you forgot to add "planAfter" section?
--
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]