RDD 常用action算子和transformation算子

2019-10-14  本文已影响0人  邵红晓

常用action算子

scala> val rdd = sc.parallelize(List((1,3),(1,2),(1,4),(2,3),(3,6),(3,8)),3)
rdd: org.apache.spark.rdd.RDD[(Int, Int)] = ParallelCollectionRDD[95] at parallelize at <console>:24
scala> rdd.countByKey()
res63: scala.collection.Map[Int,Long] = Map(3 -> 2, 1 -> 3, 2 -> 1)

常用Transformation算子

上一篇下一篇

猜你喜欢

热点阅读