mihaibudiu commented on code in PR #4201:
URL: https://github.com/apache/calcite/pull/4201#discussion_r2012523843


##########
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:
   you should not depend on a particular type checking strategy for aggregates, 
that can be changed as part of the type system.
   



-- 
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]

Reply via email to