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:44:00 UTC

[jira] [Updated] (CALCITE-2296) Extra logic to derive additional filters from for FilterJoinRule

     [ https://issues.apache.org/jira/browse/CALCITE-2296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vitalii Diravka updated CALCITE-2296:
-------------------------------------
    Description: 
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. 


  was:
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

Also it can solve CALCITE-2241.


> Extra logic to derive additional filters from for 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)