diff options
Diffstat (limited to 'sql')
3 files changed, 5 insertions, 5 deletions
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TypedAggregateExpression.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TypedAggregateExpression.scala index 0e5bc1f9ab..b5a87c56e6 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TypedAggregateExpression.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TypedAggregateExpression.scala @@ -136,7 +136,7 @@ case class TypedAggregateExpression( override def eval(buffer: InternalRow): Any = { val b = boundB.shift(mutableAggBufferOffset).fromRow(buffer) - val result = cEncoder.toRow(aggregator.present(b)) + val result = cEncoder.toRow(aggregator.finish(b)) dataType match { case _: StructType => result case _ => result.get(0, dataType) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala b/sql/core/src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala index 3c1c457e06..2aa5a7d540 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala @@ -65,7 +65,7 @@ abstract class Aggregator[-A, B, C] { /** * Transform the output of the reduction. */ - def present(reduction: B): C + def finish(reduction: B): C /** * Returns this `Aggregator` as a [[TypedColumn]] that can be used in [[Dataset]] or [[DataFrame]] diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DatasetAggregatorSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/DatasetAggregatorSuite.scala index 206095a519..002d5c18f0 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/DatasetAggregatorSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/DatasetAggregatorSuite.scala @@ -36,7 +36,7 @@ class SumOf[I, N : Numeric](f: I => N) extends Aggregator[I, N, N] with Serializ override def merge(b1: N, b2: N): N = numeric.plus(b1, b2) - override def present(reduction: N): N = reduction + override def finish(reduction: N): N = reduction } object TypedAverage extends Aggregator[(String, Int), (Long, Long), Double] with Serializable { @@ -50,7 +50,7 @@ object TypedAverage extends Aggregator[(String, Int), (Long, Long), Double] with (b1._1 + b2._1, b1._2 + b2._2) } - override def present(countAndSum: (Long, Long)): Double = countAndSum._2 / countAndSum._1 + override def finish(countAndSum: (Long, Long)): Double = countAndSum._2 / countAndSum._1 } object ComplexResultAgg extends Aggregator[(String, Int), (Long, Long), (Long, Long)] @@ -66,7 +66,7 @@ object ComplexResultAgg extends Aggregator[(String, Int), (Long, Long), (Long, L (b1._1 + b2._1, b1._2 + b2._2) } - override def present(reduction: (Long, Long)): (Long, Long) = reduction + override def finish(reduction: (Long, Long)): (Long, Long) = reduction } class DatasetAggregatorSuite extends QueryTest with SharedSQLContext { |