modify
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
(mapreduce,1)
|
@ -1,2 +0,0 @@
|
||||
(spark,2)
|
||||
(hadoop,2)
|
@ -3,14 +3,12 @@ package com.heibaiying.spark.rdd
|
||||
import org.apache.spark.{SparkConf, SparkContext}
|
||||
|
||||
|
||||
object WordCount {
|
||||
object WordCount extends App {
|
||||
|
||||
def main(args: Array[String]): Unit = {
|
||||
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/")
|
||||
}
|
||||
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/")
|
||||
|
||||
}
|
Reference in New Issue
Block a user