How can I group pairRDD by keys and turn the values into RDD

核能气质少年 提交于 2019-12-10 11:48:15

问题


So what I have is RDD[(String, Int)] and I need to convert it into Map[String, RDD[Int]]

Ex.

My input looks like this:

RDD[("a", 1), ("a", 2), ("b", 1), ("c", 3)]

And the output I'm trying to get is:

Map["a" -> RDD[1, 2], "b" -> RDD[1], "c" -> RDD[3]]

Thanks in advance!

来源:https://stackoverflow.com/questions/48402479/how-can-i-group-pairrdd-by-keys-and-turn-the-values-into-rdd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!