Created
November 18, 2014 14:22
-
-
Save bryanyang0528/48463a7a280c0f6b8064 to your computer and use it in GitHub Desktop.
readfile
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
val text = sc.textFile("README.md") | |
val textPairsRDD = text.flatMap(_.split(" ")).map((_,1)) | |
textPairsRDD.take(10) | |
//res2: Array[(String, Int)] = Array((#,1), (Apache,1), (Spark,1), ("",1), | |
//(Spark,1), (is,1), (a,1), (fast,1), (and,1), (general,1)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment