Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. scala> val salgrp=salname.groupByKey
  2. salgrp: org.apache.spark.rdd.RDD[(Int, Iterable[String])] = ShuffledRDD[11] at groupByKey at <console>:41
  3. scala> salgrp.collect
  4. 18/09/04 20:51:06 INFO DAGScheduler: Job 0 finished: collect at <console>:44, took 1.723661 s
  5. res0: Array[(Int, Iterable[String])] = Array((50000,CompactBuffer(Bhupesh, Tejas, Dinesh, Lokesh)), (10000,CompactBuffer(Sheela, Kumar, Venkat)), (45000,CompactBuf
  6. fer(Pavan, Ratan, Amit)))
  7.  
  8. val data = List((1, List("one", "two", "three")))
  9. val rdd = sparkContext.parallelize(data)
  10. rdd.flatMap(v => v._2).foreach(println)
  11.  
  12. one
  13. two
  14. three
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement