[
https://issues.apache.org/jira/browse/CALCITE-6340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17835559#comment-17835559
]
James Duong commented on CALCITE-6340:
--------------------------------------
The change looks to be calling project.getTraitSet() instead of
cluster.getTraitSet().
Working on a test case for this next.
> 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
> Assignee: James Duong
> Priority: Major
>
> 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)