Created
March 25, 2017 14:28
-
-
Save Swalloow/ddc125f58b2b2ca4815444557d769bdb to your computer and use it in GitHub Desktop.
WordCount with Scala
This file contains 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
val file = spark.textFile("hdfs://...") | |
val counts = file.flatMap(line => line.split(" ")) | |
.map(word => (word, 1)) | |
.reduceByKey(_ + _) | |
counts.saveAsTextFile("hdfs://...") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment