Skip to content

Commit c964fc1

Browse files
cloud-fanrxin
authored andcommitted
[SQL][MINOR] rename present to finish in Aggregator
Author: Wenchen Fan <[email protected]> Closes #9617 from cloud-fan/tmp.
1 parent 95daff6 commit c964fc1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/TypedAggregateExpression.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ case class TypedAggregateExpression(
136136

137137
override def eval(buffer: InternalRow): Any = {
138138
val b = boundB.shift(mutableAggBufferOffset).fromRow(buffer)
139-
val result = cEncoder.toRow(aggregator.present(b))
139+
val result = cEncoder.toRow(aggregator.finish(b))
140140
dataType match {
141141
case _: StructType => result
142142
case _ => result.get(0, dataType)

sql/core/src/main/scala/org/apache/spark/sql/expressions/Aggregator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ abstract class Aggregator[-A, B, C] {
6565
/**
6666
* Transform the output of the reduction.
6767
*/
68-
def present(reduction: B): C
68+
def finish(reduction: B): C
6969

7070
/**
7171
* Returns this `Aggregator` as a [[TypedColumn]] that can be used in [[Dataset]] or [[DataFrame]]

sql/core/src/test/scala/org/apache/spark/sql/DatasetAggregatorSuite.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SumOf[I, N : Numeric](f: I => N) extends Aggregator[I, N, N] with Serializ
3636

3737
override def merge(b1: N, b2: N): N = numeric.plus(b1, b2)
3838

39-
override def present(reduction: N): N = reduction
39+
override def finish(reduction: N): N = reduction
4040
}
4141

4242
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
5050
(b1._1 + b2._1, b1._2 + b2._2)
5151
}
5252

53-
override def present(countAndSum: (Long, Long)): Double = countAndSum._2 / countAndSum._1
53+
override def finish(countAndSum: (Long, Long)): Double = countAndSum._2 / countAndSum._1
5454
}
5555

5656
object ComplexResultAgg extends Aggregator[(String, Int), (Long, Long), (Long, Long)]
@@ -66,7 +66,7 @@ object ComplexResultAgg extends Aggregator[(String, Int), (Long, Long), (Long, L
6666
(b1._1 + b2._1, b1._2 + b2._2)
6767
}
6868

69-
override def present(reduction: (Long, Long)): (Long, Long) = reduction
69+
override def finish(reduction: (Long, Long)): (Long, Long) = reduction
7070
}
7171

7272
class DatasetAggregatorSuite extends QueryTest with SharedSQLContext {

0 commit comments

Comments
 (0)