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

    https://github.com/apache/flink/pull/2049#discussion_r66638756
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/runtime/aggregate/SumAggregate.scala
 ---
    @@ -27,13 +27,21 @@ abstract class SumAggregate[T: Numeric]
       protected var sumIndex: Int = _
     
       override def initiate(partial: Row): Unit = {
    -    partial.setField(sumIndex, numeric.zero)
    +    partial.setField(sumIndex, null.asInstanceOf[T])
       }
     
       override def merge(partial1: Row, buffer: Row): Unit = {
         val partialValue = partial1.productElement(sumIndex).asInstanceOf[T]
         val bufferValue = buffer.productElement(sumIndex).asInstanceOf[T]
    -    buffer.setField(sumIndex, numeric.plus(partialValue, bufferValue))
    +    if (partialValue == null && bufferValue == null) {
    --- End diff --
    
    Please reorder `if else` cases as in `MaxAggregate`


---
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.
---

Reply via email to