in src/main/scala/com/spotify/bdrc/pipeline/MaxItemPerUser.scala [72:78]
def spark(input: RDD[Rating]): RDD[Rating] = {
input
.keyBy(_.user)
// Reduce items per key by picking the side with higher score for each pair of input
.reduceByKey((x, y) => if (x.score > y.score) x else y)
.values
}