chunweilei commented on a change in pull request #2241:
URL: https://github.com/apache/calcite/pull/2241#discussion_r518494152



##########
File path: core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
##########
@@ -1930,7 +1929,20 @@ public static MutableRel 
unifyAggregates(MutableAggregate query,
       }
       final List<AggregateCall> aggregateCalls = new ArrayList<>();
       for (AggregateCall aggregateCall : query.aggCalls) {
-        if (aggregateCall.isDistinct()) {
+        if (aggregateCall.isDistinct() && aggregateCall.getArgList().size() == 
1) {
+          int aggIndex = aggregateCall.getArgList().get(0);
+          if (targetGroupByIndexList.contains(aggIndex)) {
+            int newIndex = targetGroupByIndexList.indexOf(aggIndex);
+            aggregateCalls.add(

Review comment:
       if (targetGroupByIndexList.contains(aggIndex)) is not necessary.
   You
    can do like this:
   ```
   final int newIndex = targetGroupByIndexList.indexOf(aggIndex);
   if (newIndex >=0 ) {
      ......
   }
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to