Change `collect` at local to `reduceByKey` in a spark cluster