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

EveyWu updated CALCITE-6447:
----------------------------
    Attachment:     (was: image-2024-06-27-15-05-55-779.png)

> Extract common expressions for disjunctions in Join
> ---------------------------------------------------
>
>                 Key: CALCITE-6447
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6447
>             Project: Calcite
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 1.37.0
>            Reporter: ruanhui
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.37.0
>
>         Attachments: image-2024-06-25-16-26-15-058.png
>
>
> For SQL:
> {code:java}
> select *
> from tbl_a
>   join tbl_b on tbl_a.id = tbl_b.id
> where (tbl_a.x > 100 and tbl_b.y < 10)
>    or (tbl_a.x > 100 and tbl_b.z > 20){code}
> we can rewrite it to
> {code:java}
> select *
> from tbl_a
>   join tbl_b on tbl_a.id = tbl_b.id
> where tbl_a.x > 100
>   and (tbl_b.y < 10 or tbl_b.z > 20){code}
> And in this way *tbl_a.x > 100* can be pushed down and it is likely that this 
> will help reduce the amount of data involved in the join.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to