Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val words = Array("one", "two", "two", "three", "three", "three")
- val wordPairsRDD = sc.parallelize(words).map(word => (word, 1))
- val wordCountsWithGroup = wordPairsRDD
- .groupByKey()
- .map(t => (t._1, t._2.sum))
- .collect()
Add Comment
Please, Sign In to add comment