xy2953396112 commented on a change in pull request #2241: URL: https://github.com/apache/calcite/pull/2241#discussion_r517118764
########## File path: core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java ########## @@ -1931,6 +1931,22 @@ public static MutableRel unifyAggregates(MutableAggregate query, final List<AggregateCall> aggregateCalls = new ArrayList<>(); for (AggregateCall aggregateCall : query.aggCalls) { if (aggregateCall.isDistinct()) { + if (aggregateCall.getArgList().size() == 1) { + int aggIndex = aggregateCall.getArgList().get(0); + if (target.groupSet.asSet().contains(aggIndex)) { Review comment: The aggregate function containing the distinct keyword has only one parameter. Check the parameters here. ---------------------------------------------------------------- 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: us...@infra.apache.org