Github user sunjincheng121 commented on a diff in the pull request:
https://github.com/apache/flink/pull/5241#discussion_r160413762
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/AggregationCodeGenerator.scala
---
@@ -359,12 +359,17 @@ class AggregationCodeGenerator(
val accumulate: String = {
for (i <- aggs.indices) yield {
- j"""
- | ${accTypes(i)} acc$i = (${accTypes(i)})
accs.getField($i);
- | ${genDataViewFieldSetter(s"acc$i", i)}
- | ${aggs(i)}.accumulate(
- | acc$i,
- | ${parametersCode(i)});""".stripMargin
--- End diff --
The code is very simple. bug when `!parametersCode(i).isEmpty`, will
generate the following code:
`.accumulate(acc0());` which we do not wanted.
---