beetle0915 commented on code in PR #28987:
URL: https://github.com/apache/flink/pull/28987#discussion_r4307716253


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/operations/utils/OperationTreeBuilder.java:
##########
@@ -242,13 +242,22 @@ public QueryOperation dropColumns(List<Expression> 
fieldLists, QueryOperation ch
         return project(finalFields, child, false);
     }
 
+    public List<Expression> expandExpressions(List<Expression> expressions, 
QueryOperation child) {
+        return getResolver(child).resolveExpanding(expressions);
+    }
+
     public QueryOperation aggregate(
             List<Expression> groupingExpressions,
             List<Expression> aggregates,
             QueryOperation child) {
 
-        ExpressionResolver resolver = getAggResolver(child, 
groupingExpressions);
-        List<ResolvedExpression> resolvedGroupings = 
resolver.resolve(groupingExpressions);
+        // Computed grouping expressions need stable names for subsequent 
projections.
+        List<Expression> namedGroupingExpressions =
+                addAliasToTheCallInAggregate(

Review Comment:
   Fixed. All explicit names are now reserved before generating aliases, 
regardless of their order. Added regression tests for both orderings across 
regular, window, and table aggregations.



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