def spark()

in src/main/scala/com/spotify/bdrc/pipeline/TopItems.scala [91:98]


  def spark(input: RDD[Rating]): Seq[(String, Double)] = {
    input
      .map(x => (x.item, x.score))
      // Sum values with addition
      .reduceByKey(_ + _)
      // `top` is an action and collects data back to the driver node
      .top(topK)(Ordering.by(_._2))
  }