Created
May 14, 2016 17:09
-
-
Save dedunumax/749a390d97fd20bf0991402c0b29d7a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.dedunu.datascience.sample | |
import org.apache.spark.{SparkContext, SparkConf} | |
object Driver { | |
def main(args: Array[String]): Unit = { | |
val sparkConf = new SparkConf().setAppName("Sample Job Name") | |
val sparkContext = new SparkContext(sparkConf) | |
val textFile = sparkContext.textFile("file://" + args(0) + "/*") | |
val counts = textFile.flatMap(line => line.split(" ")) | |
.map(word => (word, 1)) | |
.reduceByKey(_ + _) | |
counts.saveAsTextFile("file://" + args(1)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment