You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2025/05/09 10:37:00 UTC

[jira] [Updated] (CALCITE-7002) Create an optimization rule to eliminate UNION from the same source with different filters

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

ASF GitHub Bot updated CALCITE-7002:
------------------------------------
    Labels: pull-request-available  (was: )

> Create an optimization rule to eliminate UNION from the same source with different filters
> ------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7002
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7002
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.39.0
>            Reporter: Mihai Budiu
>            Assignee: Zhen Chen
>            Priority: Minor
>              Labels: pull-request-available
>
> The following query
> {code:sql}
> SELECT * FROM T WHERE p0
> UNION
> SELECT * FROM T WHERE p1
> {code}
> can be rewritten as 
> {code:sql}
> SELECT * FROM T WHERE p0 OR p1 
> {code}
> This works if the the left and right filtered inputs are the same collection.
> This should work even when p0 and p1 return 'true' for the same rows, because UNION eliminates the duplicates.
> A similar rule should work for INTERSECT using AND
>  



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