def sparkWithAlgebird2()

in src/main/scala/com/spotify/bdrc/pipeline/SumPerItem.scala [75:84]


  def sparkWithAlgebird2(input: RDD[Rating]): RDD[(String, Double)] = {
    import com.twitter.algebird.Aggregator.prepareMonoid
    import com.twitter.algebird.spark._
    input
      .keyBy(_.item)
      .algebird
      // Aggregate per key with an aggregator that converts `UserItemData` to `Double` via
      // `_.score` before reduce. Explicit type due to type inference limitation.
      .aggregateByKey(prepareMonoid { x: Rating => x.score })
  }