val conf = new SparkConf().setMaster("local[6]").setAppName("wordCount")
val sc = new SparkContext(conf)
sc.textFile("/input")
.flatMap(_.split(" "))
.map((_,1))
.reduceByKey(_+_)
.saveAsTextFile("/output")
sc.stop()
val conf = new SparkConf().setMaster("local[6]").setAppName("wordCount")
val sc = new SparkContext(conf)
sc.textFile("/input")
.flatMap(_.split(" "))
.map((_,1))
.reduceByKey(_+_)
.saveAsTextFile("/output")
sc.stop()
本文标题:请手动写出wordcount的spark代码实现
本文链接:https://www.haomeiwen.com/subject/tiklpctx.html
网友评论