Github user walterddr commented on a diff in the pull request: https://github.com/apache/flink/pull/5555#discussion_r170604304 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/AggregateUtil.scala --- @@ -1393,6 +1393,21 @@ object AggregateUtil { throw new TableException(s"unsupported Function: '${unSupported.getName}'") } } + + // create distinct accumulator delegate + if (aggregateCall.isDistinct) { --- End diff -- Good point. Actually there's a very interesting question I've been thinking - This AggFunction literally is the distinct version of the `CollectAggFunction`, however it cannot exist by itself unless chained with other `realAgg` functions --> this means we will need to chain `DistinctAggFunction` with `CollectAggFunction` which just dont make sense. I will try some other approach and see if they work.
---