Skip to content

Instantly share code, notes, and snippets.

@saisgit
Created June 14, 2017 10:53
Show Gist options
  • Save saisgit/d4e5904ac9c50cef4d1f97484b5d9e82 to your computer and use it in GitHub Desktop.
Save saisgit/d4e5904ac9c50cef4d1f97484b5d9e82 to your computer and use it in GitHub Desktop.
val textFile = sc.textFile("hdfs://...")
val counts = textFile.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