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)

文章转载自原文:https://blog.csdn.net/qq_44596980/article/details/93311988


作者:海中一神兽,发布于:2019/08/14
原文:https://www.cnblogs.com/haima1949/p/11347245.html