Created
October 9, 2015 15:06
-
-
Save josephpconley/c330f59bb0ca42dcf368 to your computer and use it in GitHub Desktop.
Spark code for following word count text: Betty Botta bought some butter; "But," said she, "this butter's bitter! If I put it in my batter It will make my batter bitter. But a bit o' better butter Will but make my batter better." Then she bought a bit o' butter Better than the bitter butter, Made her bitter batter better. So 'twas better Betty B…
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
sc.textFile("hdfs://localhost/jconley/input/wc.txt").flatMap(_.trim.split("""[\s\W]+""")).map(w => w -> 1).reduceByKey(_ + _).sortBy(_._2, ascending = false).foreach(println) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment