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 2021/02/25 14:51:00 UTC

[jira] [Commented] (CALCITE-4513) RelBuilder.aggregate destroys input traits when pruning unused fields of project

    [ https://issues.apache.org/jira/browse/CALCITE-4513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17290962#comment-17290962 ] 

Stamatis Zampetakis commented on CALCITE-4513:
----------------------------------------------

An obvious workaround to this problem is to disable the optimization ({{RelBuilder.Config#withPruneInputOfAggregate(false)}}).

> RelBuilder.aggregate destroys input traits when pruning unused fields of project
> --------------------------------------------------------------------------------
>
>                 Key: CALCITE-4513
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4513
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.23.0
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>
> RelBuilder attempts to prune unused fields when the underlying input is a project and the respective configuration ({{RelBuilder.Config#pruneInputOfAggregate}}) is enabled (CALCITE-3763). As a result of this optimization a new project operator is introduced in the plan.
> The new operator is created via {{Project#copy}} method but instead of retaining or adapting the previous traitset a new one is created (https://github.com/apache/calcite/blob/94502f51e6a12cd53cec88b39d21b4fec6070428/core/src/main/java/org/apache/calcite/tools/RelBuilder.java#L1922).
> {code:java}
>         r = project.copy(cluster.traitSet(), project.getInput(), newProjects,
>             builder.build());
> {code}
> The main problem with that is that a {{HiveProject}} operator which used to be in {{HiveConvention}} will be transformed to a {{HiveProject}} operator in {{Convention.None}}. Obviously other traits (apart from {{Convention}}) potentially present in the operator are also lost after the transformation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)