This commit is contained in:
罗祥
2019-05-19 21:31:36 +08:00
parent 10b5ad9d09
commit 3f29f6a9cc
16 changed files with 532 additions and 176 deletions

View File

@ -0,0 +1,14 @@
package rdd.scala
import org.apache.spark.{SparkConf, SparkContext}
object WordCount extends App {
val conf = new SparkConf().setAppName("sparkBase").setMaster("local[2]")
val sc = new SparkContext(conf)
val rdd = sc.textFile("input/wc.txt").flatMap(_.split(",")).map((_, 1)).reduceByKey(_ + _)
rdd.foreach(println)
rdd.saveAsTextFile("output/")
}