Spark Scala当中reduceByKey(_+_) reduceByKey((x,y) => x+y)的用法

2019-07-22 11:27:54 浏览数 (1)

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)

更多请看下节:https://blog.csdn.net/qq_44596980/article/details/93383431

0 人点赞