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/05/03 18:48:00 UTC

[jira] [Commented] (CALCITE-2296) Extra logic to derive additional filters in the FilterJoinRule

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

Vitalii Diravka commented on CALCITE-2296:
------------------------------------------

[~julianhyde] There was some example in TODO block. But I have added the query example to the Jira ticket description.

Also I have initial work for this Jira with possible solution:
 [https://github.com/vdiravka/calcite/commits/CALCITE-2296]
 I will verify it one more time and if it appears correct, I will open a PR.

> Extra logic to derive additional filters in the FilterJoinRule
> --------------------------------------------------------------
>
>                 Key: CALCITE-2296
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2296
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.16.0
>            Reporter: Vitalii Diravka
>            Assignee: Vitalii Diravka
>            Priority: Major
>             Fix For: next
>
>
> There is necessary to add logic to derive additional filters from for FilterJoinRule in the case of using disjunction of expressions:
>  [https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/FilterJoinRule.java#L155]
> The example query is:
> {code:sql} 
> select * from sales.emp e join 
> sales.dept d on e.job = d.name
> where (e.deptno = 5 AND d.deptno = 2)
> OR (e.deptno = 7 AND d.deptno = 3)
> {code}
> The filrer condition in DNF
> LogicalFilter(condition=[OR(AND(=($7, 5), =($9, 2)), AND(=($7, 7), =($9, 3)))])
> can be transformed into CNF and then the ncessary filters can be pushed down:
> LogicalFilter(condition=[OR(=($7, 5), =($7, 7))]) and LogicalFilter(condition=[OR(=($9, 2), =($9, 3))])
> Additional filter still will be present on top of join. 
> Finally deriving additional filters can allow to scan less information. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)