Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3470#discussion_r104389792
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/aggfunctions/AvgAggFunction.scala
 ---
    @@ -321,12 +317,11 @@ class DecimalAvgAggFunction extends 
AggregateFunction[BigDecimal] {
         if (value != null) {
           val v = value.asInstanceOf[BigDecimal]
           val accum = accumulator.asInstanceOf[DecimalAvgAccumulator]
    +      accum.f0 = accum.f0.subtract(v)
    +      accum.f1 -= 1L
           if (accum.f1 == 0) {
    --- End diff --
    
    Do we need this check?
    It only makes sense if we assume that accumulated and retracted values 
differ. But if that's the case all values for `cnt != 0` would be considered 
wrong. 


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to