Created
November 23, 2017 11:35
-
-
Save dgadiraju/0d4677838c9e7919a43edc9848c9dd8e to your computer and use it in GitHub Desktop.
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
// Row level transformations using flatMap | |
val l = List("Hello", "How are you doing", "Let us perform word count", "As part of the word count program", "we will see how many times each word repeat") | |
val l_rdd = sc.parallelize(l) | |
val l_map = l_rdd.map(ele => ele.split(" ")) | |
val l_flatMap = l_rdd.flatMap(ele => ele.split(" ")) | |
val wordcount = l_flatMap.map(word => (word, "")).countByKey |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment