Github user shaoxuan-wang commented on a diff in the pull request: https://github.com/apache/flink/pull/3470#discussion_r104303912 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/aggfunctions/SumAggFunction.scala --- @@ -49,13 +50,25 @@ abstract class SumAggFunction[T: Numeric] extends AggregateFunction[T] { val v = value.asInstanceOf[T] val a = accumulator.asInstanceOf[SumAccumulator[T]] a.f0 = numeric.plus(v, a.f0) - a.f1 = true + a.f1 += 1 + } + } + + override def retract(accumulator: Accumulator, value: Any): Unit = { + if (value != null) { + val v = value.asInstanceOf[T] + val a = accumulator.asInstanceOf[SumAccumulator[T]] + a.f0 = numeric.plus(v, a.f0) --- End diff -- Added the test to compare two accumulators instead of just comparing two values will catch this.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---