[
https://issues.apache.org/jira/browse/CALCITE-6749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated CALCITE-6749:
------------------------------------
Labels: pull-request-available (was: )
> RelMdUtil#setAggChildKeys may return an incorrect result
> --------------------------------------------------------
>
> Key: CALCITE-6749
> URL: https://issues.apache.org/jira/browse/CALCITE-6749
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.38.0
> Reporter: Ruben Q L
> Assignee: Ruben Q L
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.39.0
>
>
> Let us consider an Aggregate such as:
> {code}
> Aggregate(group=[{9}])
> {code}
> if we call {{RelMdUtil#setAggChildKeys}} to obtain the Aggregate's child keys
> corresponding to the group key 0, it will simply return 0
> {code}
> for (int bit : groupKey) {
> if (bit < aggRel.getGroupCount()) {
> // group by column
> childKey.set(bit); // <- Possibly wrong!
> {code}
> And this is incorrect, on the child the corresponding key is 9; i.e. we
> should apply the corresponding conversion:
> {code}
> for (int bit : groupKey) {
> if (bit < aggRel.getGroupCount()) {
> // group by column
> childKey.set(aggRel.getGroupSet().asList().get(bit)); // <- FIX
> {code}
> as it is done e.g. on column origins for Aggregates:
> {code}
> public @Nullable Set<RelColumnOrigin> getColumnOrigins(Aggregate rel,
> RelMetadataQuery mq, int iOutputColumn) {
> if (iOutputColumn < rel.getGroupCount()) {
> // get actual index of Group columns.
> return mq.getColumnOrigins(rel.getInput(),
> rel.getGroupSet().asList().get(iOutputColumn));
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)