You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2023/05/24 08:24:00 UTC

[jira] [Resolved] (CALCITE-5705) Generalize RemoveEmptySingleRule to work with arbitrary relations and pruning configurations

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

Stamatis Zampetakis resolved CALCITE-5705.
------------------------------------------
    Resolution: Fixed

Fixed in https://github.com/apache/calcite/commit/f32289870be80e69dabc5b7e24bd6c777d4eb688.

> Generalize RemoveEmptySingleRule to work with arbitrary relations and pruning configurations
> --------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5705
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5705
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>             Fix For: 1.35.0
>
>
> Currently [RemoveEmptySingleRule|https://github.com/apache/calcite/blob/b0b27e8872b33c5ab203e0e2365d267a594c80be/core/src/main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java#LL285C23-L285C44] can only transform {{SingleRel}} relations to empty. However, the logic inside the {{matches}} method is at the most part capable of handling any kind of relation including those that have multiple children.
> By generalizing the {{RemoveEmptySingleRule}} to work with arbitrary relations we can refactor other pruning rules such as those created by [CorrelateLeftEmptyRuleConfig|https://github.com/apache/calcite/blob/b0b27e8872b33c5ab203e0e2365d267a594c80be/core/src/main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java#L588] without the need for creating more classes and duplicating code.
> Moreover by changing the constructor to accept {{PruneEmptyRule.Config}} instead of {{RemoveEmptySingleRuleConfig}} we can reduce code duplication further since configurations such as {{ZeroMaxRowsRuleConfig}} and {{SortFetchZeroRuleConfig}} could be modified to create instances of {{RemoveEmptySingleRule}}.
> This is mainly a refactoring to simplify pruning rules and remove duplicate logic. The change is fully backwards compatible.



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