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从关注开始
Spark版wordcount,并根据词频进行排序

相关文章:

  • 2021-12-06
  • 2021-12-09
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2021-08-03
  • 2021-10-03
  • 2021-11-14
  • 2022-12-23
  • 2021-04-03
  • 2022-12-23
相关资源
相似解决方案