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