silundong commented on code in PR #4499:
URL: https://github.com/apache/calcite/pull/4499#discussion_r2286769499


##########
core/src/main/java/org/apache/calcite/rel/rules/AggregateUnionTransposeRule.java:
##########
@@ -117,17 +116,12 @@ public AggregateUnionTransposeRule(Class<? extends 
Aggregate> aggregateClass,
       return;
     }
 
-    int groupCount = aggRel.getGroupSet().cardinality();
-
-    List<AggregateCall> transformedAggCalls =
-        transformAggCalls(
-            aggRel.copy(aggRel.getTraitSet(), aggRel.getInput(),
-                aggRel.getGroupSet(), null, aggRel.getAggCallList()),
-            groupCount, aggRel.getAggCallList());
-    if (transformedAggCalls == null) {
-      // we've detected the presence of something like AVG,
-      // which we can't handle
-      return;
+    for (AggregateCall aggCall : aggRel.getAggCallList()) {

Review Comment:
   `transformAggCalls()` is used to build the top-Aggregate, but it uses a copy 
of the origin Aggregate (and erases the groupSets information) to simulate the 
input of the top-Aggregate, which will cause type inference errors. (Just 
explaining the reason for the modification)



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