You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Liya Fan (Jira)" <ji...@apache.org> on 2022/03/04 11:55:00 UTC

[jira] [Updated] (CALCITE-4990) Add SetOpFilterMergeRule for Converting UNION with same inputs but different filters to single input with OR Filter

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

Liya Fan updated CALCITE-4990:
------------------------------
    Fix Version/s:     (was: 1.30.0)

> Add SetOpFilterMergeRule for Converting UNION with same inputs but different filters to single input with OR Filter
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4990
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4990
>             Project: Calcite
>          Issue Type: Wish
>          Components: core
>    Affects Versions: 1.29.0
>            Reporter: yanjing.wang
>            Assignee: yanjing.wang
>            Priority: Major
>         Attachments: UnionAllToOr.png
>
>
> The attached diagram illustrates how the new rule works.
> !UnionAllToOr.png!
> The rule will be useful when Input Sub Tree is a computing-intensive or large IO operation, 
> and it works for N-way Union, not just 2-way Union. In addition, The Project operator will be optional present.
>  
> It has some prerequisites when applying the rule to rel.
> 1. Project and Input Sub Tree must be identical.
> 2. For UNION: 
> New Filter = left Filter OR right Filter.
> For UNION ALL: 
> left Filter, right Filter must have no overlap.
>  
> Example:
> {code:java}
> SELECT a, b FROM t WHERE c = 1 
> UNION ALL 
> SELECT a, b FROM t WHERE c = 2 
> UNION ALL 
> SELECT a, b FROM t WHERE c = 3   {code}
> After applying the rule, we get
> {code:java}
> SELECT a, b FROM t WHERE c in (1, 2, 3)   {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)