You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2025/05/07 23:38:00 UTC

[jira] [Assigned] (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 ]

Mihai Budiu reassigned CALCITE-7002:
------------------------------------

    Assignee: Zhen Chen

> 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
>
> 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)