diff --git a/algebird-spark/src/main/scala/com/twitter/algebird/spark/AlgebirdRDD.scala b/algebird-spark/src/main/scala/com/twitter/algebird/spark/AlgebirdRDD.scala index f930a2965..ea07466e6 100644 --- a/algebird-spark/src/main/scala/com/twitter/algebird/spark/AlgebirdRDD.scala +++ b/algebird-spark/src/main/scala/com/twitter/algebird/spark/AlgebirdRDD.scala @@ -21,8 +21,8 @@ class AlgebirdRDD[T](val rdd: RDD[T]) extends AnyVal { def aggregateOption[B: ClassTag, C](agg: Aggregator[T, B, C]): Option[C] = { val pr = rdd.mapPartitions({ data => if (data.isEmpty) Iterator.empty else { - val sg = agg.prepare(data.next) - Iterator(agg.appendAll(sg, data)) + val b = agg.prepare(data.next) + Iterator(agg.appendAll(b, data)) } }, preservesPartitioning = true) pr.coalesce(1, shuffle = true)