手写 Spark-WordCount

var conf : SparkConf = new SparkConf().setMaster("local[*]").setAppName("WordCount")

var sc  = new SparkContext(conf)

sc.textFile("/input")
	.flatMap(_.split(" "))
	.map((_,1))
	.reduceByKey(_+_)
	.saveAsTextFile("/output")

sc.stop()

你可能感兴趣的:(大数据面试,spark,spark)