You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Adam Kennedy (Jira)" <ji...@apache.org> on 2024/03/25 19:47:00 UTC

[jira] [Created] (CALCITE-6340) RelBuilder always creates Project with Convention.NONE during aggregate_

Adam Kennedy created CALCITE-6340:
-------------------------------------

             Summary: RelBuilder always creates Project with Convention.NONE during aggregate_
                 Key: CALCITE-6340
                 URL: https://issues.apache.org/jira/browse/CALCITE-6340
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.36.0
            Reporter: Adam Kennedy


In the RelBuilder method aggregate_, when (config.pruneInputOfAggregate() && r instanceof Project) line 2443 the Project will be rewritten to remove unused columns.

When this happens, the new Project will be created with the following line

{{{}2487: r =
{}}}{{{}2488:   project.copy(cluster.traitSet(), project.getInput(), newProjects,{}}}
{{2489:     builder.build());}}
 
The use of cluster.traitSet() returns emptyTraitSet which is always going to use Convention.NONE regardless of the Rebuilder's ProjectFactory.

In the case of a query plan using a non-Logical convention FOO, with FooProject nodes that require the FOO convention, RelBuilder will normally happily produce FooProject nodes with FOO convention, allowing many CoreRules to be easily reused for custom Conventions.

However, while RelBuilder will produce FooProject with FOO convention in the majority of cases, for the one specific case of column pruning a Project input to an aggregate, it will instead product a FooProject with NONE convention.



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