spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-14451][SQL] Move encoder definition int...
Date Fri, 08 Apr 2016 08:17:57 GMT
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12231#discussion_r58993349
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/typedaggregators.scala
---
    @@ -27,28 +27,20 @@ import org.apache.spark.sql.expressions.Aggregator
     ////////////////////////////////////////////////////////////////////////////////////////////////////
     
     
    -class TypedSum[IN, OUT : Numeric](f: IN => OUT) extends Aggregator[IN, OUT, OUT] {
    -  val numeric = implicitly[Numeric[OUT]]
    -  override def zero: OUT = numeric.zero
    -  override def reduce(b: OUT, a: IN): OUT = numeric.plus(b, f(a))
    -  override def merge(b1: OUT, b2: OUT): OUT = numeric.plus(b1, b2)
    -  override def finish(reduction: OUT): OUT = reduction
    -
    -  // TODO(ekl) java api support once this is exposed in scala
    -}
    -
    -
     class TypedSumDouble[IN](f: IN => Double) extends Aggregator[IN, Double, Double] {
       override def zero: Double = 0.0
       override def reduce(b: Double, a: IN): Double = b + f(a)
       override def merge(b1: Double, b2: Double): Double = b1 + b2
       override def finish(reduction: Double): Double = reduction
     
    +  override def bufferEncoder: Encoder[Double] = ExpressionEncoder[Double]()
    --- End diff --
    
    use `Encoders.scalaDouble`?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message