Spark Scala当中reduceByKey(_+_) reduceByKey((x,y) => x+y)的用法
程序员文章站
2022-04-29 08:25:42
Spark Scala当中reduceByKey(_+_) reduceByKey((x,y) => x+y)的用法 ......
[学习笔记]
reducebykey(_+_)是reducebykey((x,y) => x+y)的一个 简洁的形式
*/
val rdd08 = sc.parallelize(list((1, 1), (1, 4),(1, 3), (3, 7), (3, 5)))
val rdd08_1 = rdd08.reducebykey((x, y) => x + y)
println("reducebykey 用法 " + rdd08_1.collect().mkstring(","))
sc.stop()
}
def myunion(rdd05: rdd[int], rdd06: rdd[int]): unit = {
val res: rdd[int] = rdd05.union(rdd06)
文章转载自原文:
上一篇: vuex学习之Actions的用法详解