You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jiatao Tao (Jira)" <ji...@apache.org> on 2020/11/11 02:38:00 UTC

[jira] [Updated] (CALCITE-4375) Merge join condition that has "OR"

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

Jiatao Tao updated CALCITE-4375:
--------------------------------
    Summary: Merge join condition that has "OR"   (was: Merge join condition that has "OR" as much as possible)

> Merge join condition that has "OR" 
> -----------------------------------
>
>                 Key: CALCITE-4375
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4375
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jiatao Tao
>            Assignee: Jiatao Tao
>            Priority: Major
>
> SQL:
> SELECT * FROM emps,depts 
>  WHERE
>  (emps.name = depts.name AND empno=1)
>  OR 
>  (emps.name = depts.name AND empno=2)
>  
> And the join after optimizer is:
> EnumerableNestedLoopJoin(condition=[OR(AND(=($1, $11), =($0, 1)), AND(=($1, $11), =($0, 2)))], joinType=[inner])
>  
> In fact ($1, $11) can be extracted, and the join can be:
> HashJoin(condition=[AND(=($1, $11), OR(=($0, 1), =($0, 2)))], joinType=[inner]) 
>  
> We found 8 queries like this patten in TPC-DS, he benefits of optimization are great:
>  # EnumerableNestedLoopJoin -> HashJoin
>  # filter can be push down
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)