val rdd =sc.textFile("hdfs://localhost.localdomain:9000/input/test")
rdd.count
val wordcount = rdd.flatMap(_.split(' ')).map((_,1)).reduceByKey(_+_)
wordcount.collect
#keypaixu
wordcount.sortByKey(false)
wordsort.collect
#cishiupaixu
rdcount.map(x=>(x._2,x._1)).sortByKey(true).map(x=>(x._2,x._1))collec
sparkshell里的wordcount
最新推荐文章于 2023-07-12 15:47:13 发布