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

    https://github.com/apache/spark/pull/18113#discussion_r153020437
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/typedaggregators.scala
 ---
    @@ -81,14 +77,13 @@ class TypedCount[IN](val f: IN => Any) extends 
Aggregator[IN, Long, Long] {
       }
     }
     
    -
     class TypedAverage[IN](val f: IN => Double) extends Aggregator[IN, 
(Double, Long), Double] {
       override def zero: (Double, Long) = (0.0, 0L)
       override def reduce(b: (Double, Long), a: IN): (Double, Long) = (f(a) + 
b._1, 1 + b._2)
    -  override def finish(reduction: (Double, Long)): Double = reduction._1 / 
reduction._2
       override def merge(b1: (Double, Long), b2: (Double, Long)): (Double, 
Long) = {
         (b1._1 + b2._1, b1._2 + b2._2)
       }
    +  override def finish(reduction: (Double, Long)): Double = reduction._1 / 
reduction._2
    --- End diff --
    
    switched finish and merge around to make functions consistent


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to