Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.38.0
Description
Let us consider an Aggregate such as:
Aggregate(group=[{9}])
if we call RelMdUtil#setAggChildKeys to obtain the Aggregate's child keys corresponding to the group key 0, it will simply return 0
for (int bit : groupKey) { if (bit < aggRel.getGroupCount()) { // group by column childKey.set(bit); // <- Potentially wrong!
And this is incorrect, on the child the corresponding key is 9; i.e. we should apply the corresponding conversion:
for (int bit : groupKey) { if (bit < aggRel.getGroupCount()) { // group by column childKey.set(aggRel.getGroupSet().asList().get(bit)); // <- FIX
as it is done e.g. on column origins for Aggregates:
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)); }
Attachments
Issue Links
- links to