import org.apache.spark.{SparkConf, SparkContext}
/**
* Created by loushsh on 2017/10/9.
*/
object WordCount {
def main(args:Array[String]): Unit ={
val conf=new SparkConf()
val sc=new SparkContext(conf)
val line= sc.textFile(args(0))
val count=line.flatMap(_.split(" ")).map((_,1)).reduceByKey(_+_).sortBy(_._2,false).repartition(1).saveAsTextFile(args(1))
}
}
更多精彩內容,歡迎掃碼關注如下微信公衆號:大數據技術宅。大數據、AI從關注開始