Guest User

Untitled

a guest
Jan 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. val words = Array("one", "two", "two", "three", "three", "three")
  2. val wordPairsRDD = sc.parallelize(words).map(word => (word, 1))
  3.  
  4. val wordCountsWithGroup = wordPairsRDD
  5. .groupByKey()
  6. .map(t => (t._1, t._2.sum))
  7. .collect()
Add Comment
Please, Sign In to add comment