摘要:
1. countByKey 定义:countByKey():scala.collection.Map(K,Long)按照key值计算每一个key出现的总次数 案例: val rdd:RDD[(String,Int)] = sc.makeRDD(Array(("zs",60),("zs",70),(" 阅读全文
posted @ 2022-08-24 17:45
jsqup
阅读(28)
评论(0)
推荐(0)
摘要:
定义:combineByKey(createCombiner,mergePart,mergerbine ) combineByKey需要传递三个参数(函数) 1、createCombiner函数 将相同key值的某一个value数据进行一个函数操作,得到一个新的value数据 零值(新的value数 阅读全文
posted @ 2022-08-24 14:41
jsqup
阅读(44)
评论(0)
推荐(0)
摘要:
1. sortByKey 定义:sortByKey([ascending], [numPartitions]) 解释:按照key值对RDD进行排序,返回一个排序完成RDD ascending: boolean(true:升序 false:降序) numPartitions: 分区个数 案例: def 阅读全文
posted @ 2022-08-24 14:09
jsqup
阅读(41)
评论(0)
推荐(0)
摘要:
1. groupByKey 定义:groupByKey([numPartitions])、 解释:只对键值对类型RDD生效,同时返回的是一个新的RDD[(key,Iterator[Value])] 案例: def groupByKeyOper(sc: SparkContext): Unit = { 阅读全文
posted @ 2022-08-24 08:44
jsqup
阅读(38)
评论(0)
推荐(0)

浙公网安备 33010602011771号