我有以下代码
file = spark.textFile("hdfs://...")
counts = file.flatMap(lambda line: line.split(" ")) \
.map(lambda word: (word, 1)) \
.reduceByKey(lambda a, b: a + b)
counts.saveAsTextFile("hdfs://...")
http://spark.apache.org/examples.html我已经从这里复制了示例
我无法理解这段代码,尤其是关键字
有人能用通俗易懂的英语解释一下发生了什么事吗。
请参阅内联注释:
关于reduceByKey的更详细的解释可以找到here
相关问题 更多 >
编程相关推荐