You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Vitalii Diravka (JIRA)" <ji...@apache.org> on 2018/04/05 16:53:00 UTC

[jira] [Commented] (CALCITE-2241) Join equality condition should be considered while pushing down filter conditions with expressions disjunction for both tables

    [ https://issues.apache.org/jira/browse/CALCITE-2241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16427241#comment-16427241 ] 

Vitalii Diravka commented on CALCITE-2241:
------------------------------------------

The initial work with test case for current Jira:
https://github.com/vdiravka/calcite/commit/531469dd32ee65902ce1719cf36895b5b043d7a6

> 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
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.17.0
>
>
> 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
(v7.6.3#76005)