[
https://issues.apache.org/jira/browse/CALCITE-2241?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vova Vysotskyi reassigned CALCITE-2241:
---------------------------------------
Assignee: (was: Vitalii Diravka)
> Join equality condition should be considered while pushing down filter
> conditions with expressions disjunction for both tables
> ------------------------------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-2241
> URL: https://issues.apache.org/jira/browse/CALCITE-2241
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.16.0
> Reporter: Vitalii Diravka
> Priority: Major
>
> The filter condition on Join with expressions for both join inputs can be
> pushed further to inputs only if that condition is conjunction of
> expressions. It will be good if filter condition with disjunction of such
> expressions will be pushed past a Join by taking into account equality
> inference of join condition.
> Query example:
> {code:java}
> SELECT t1.deptno FROM sales.emp t1 join sales.emp t2 ON t1.deptno = t2.deptno
> WHERE t1.deptno = 1 OR t2.deptno = 4
> {code}
> Expected plan:
> {code:java}
> LogicalProject(DEPTNO=[$7])
> LogicalJoin(condition=[AND(=($7, $16))], joinType=[inner])
> LogicalFilter(condition=[OR(=($7, 1), =($7, 4))])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> LogicalFilter(condition=[OR(=($16, 1), =($16, 4))])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> Actual plan:
> {code:java}
> LogicalProject(DEPTNO=[$7])
> LogicalJoin(condition=[AND(=($7, $16), OR(=($7, 1), =($16, 4)))],
> joinType=[inner])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> The changes can be done for
> _RelMdPredicates.JoinConditionBasedPredicateInference_ code and will be
> applied by using _JoinPushTransitivePredicatesRule_
--
This message was sent by Atlassian Jira
(v8.3.4#803005)