###统计wordcount单词,并打印出来
valsplitfile=sc.textFile("/a.txt")
valwordcounts=splitfile.flatMap(x=>x.split("\t")).map(word=>(word,1)).reduceByKey(_+ _)
wordcounts.collect().foreach {println}
wordcounts.take(3).foreach {println} ## 打印前三行记录
###统计wordcount单词,并打印出来
valsplitfile=sc.textFile("/a.txt")
valwordcounts=splitfile.flatMap(x=>x.split("\t")).map(word=>(word,1)).reduceByKey(_+ _)
wordcounts.collect().foreach {println}
wordcounts.take(3).foreach {println} ## 打印前三行记录