📅  最后修改于: 2022-03-11 14:46:42.709000             🧑  作者: Mango
from operator import add
rdd = sc.parallelize([("a", 1), ("b", 1), ("a", 1)])
sorted(rdd.reduceByKey(add).collect())
# [('a', 2), ('b', 1)]