mihaibudiu commented on code in PR #4201:
URL: https://github.com/apache/calcite/pull/4201#discussion_r2010764094
##########
core/src/main/java/org/apache/calcite/rel/rules/ProjectAggregateMergeRule.java:
##########
@@ -154,9 +156,22 @@ && kindCount(project.getProjects(), SqlKind.CASE) == 0) {
builder.push(aggregate.getInput());
builder.aggregate(
builder.groupKey(aggregate.getGroupSet(), aggregate.groupSets),
aggCallList);
- builder.project(
- RexPermuteInputsShuttle.of(mapping).visitList(projects2),
- project.getRowType().getFieldNames());
+ // If the output type of Aggregate does not match the input type required
by original Project,
+ // CAST needs to be added
+ List<RexNode> rexInputRefs =
RexPermuteInputsShuttle.of(mapping).visitList(projects2);
Review Comment:
I imagine the project already contains the cast.
But, in general, the project could have a more complex expression of the
aggregate.
Shouldn't the entire expression be preserved?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]