You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/11/01 03:36:38 UTC

[GitHub] [calcite] xy2953396112 commented on a change in pull request #2546: [CALCITE-4803] AggregateProjectMergeRule lost alias after remove the …

xy2953396112 commented on a change in pull request #2546:
URL: https://github.com/apache/calcite/pull/2546#discussion_r739938223



##########
File path: core/src/main/java/org/apache/calcite/rel/rules/AggregateProjectMergeRule.java
##########
@@ -125,14 +125,17 @@ public AggregateProjectMergeRule(
             newGroupSet, newGroupingSets, aggCalls.build());
 
     // Add a project if the group set is not in the same order or
-    // contains duplicates.
+    // contains duplicates or contains alias.
     final RelBuilder relBuilder = call.builder();
     relBuilder.push(newAggregate);
     final List<Integer> newKeys =
         Util.transform(aggregate.getGroupSet().asList(),
             key -> requireNonNull(map.get(key),
                 () -> "no value found for key " + key + " in " + map));
-    if (!newKeys.equals(newGroupSet.asList())) {
+    final List<String> newaggFieldNames = newAggregate.getRowType().getFieldNames();
+    final List<String> aggFieldNames = aggregate.getRowType().getFieldNames();

Review comment:
       > newaggFieldNames -> newAggFieldNames?
   
   I updated the code. Please help review again.Thanks.




-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org