You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jess Balint (Jira)" <ji...@apache.org> on 2023/02/07 22:34:01 UTC
[jira] [Closed] (CALCITE-5314) Prune empty parts of a query by exploiting stats/metadata
[ https://issues.apache.org/jira/browse/CALCITE-5314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jess Balint closed CALCITE-5314.
--------------------------------
Resolved in release 1.33.0 (2023-02-06)
> Prune empty parts of a query by exploiting stats/metadata
> ---------------------------------------------------------
>
> Key: CALCITE-5314
> URL: https://issues.apache.org/jira/browse/CALCITE-5314
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Stamatis Zampetakis
> Assignee: Hanumath Rao Maduri
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.33.0
>
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
> Currently there is a collection of rules (i.e., [PruneEmptyRules|https://github.com/apache/calcite/blob/4ef9ffe0d4afb80fe95e66d4d9c9e6f5939f70a8/core/src/main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java]) which remove sections of a query plan when it does not produce any rows.
> At the moment, the removal requires an empty {{Values}} operator to be in the plan in order to take effect. However, there are cases where queries involve empty relations/tables and in that case we could remove parts of the plan as well.
> The information if a relation is empty or not can be derived from metadata. For example, we could check if the [RelMdMaxRowCount|https://github.com/apache/calcite/blob/4ef9ffe0d4afb80fe95e66d4d9c9e6f5939f70a8/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMaxRowCount.java] returns zero to derive that the relation is empty.
> Implementation wise there are various alternatives to consider:
> * modify the existing PruneEmptyRule to consider metadata;
> * add new pruning rules relying exclusively on metadata;
> * add new rules checking metadata and turning the empty relation to an empty {{Values}} which can then be handled by existing rules
--
This message was sent by Atlassian Jira
(v8.20.10#820010)