and in python,

>>> map = {'a': 1, 'b': 2, 'c': 3}
>>> rdd = sc.parallelize(map.items())
>>> rdd.collect()
[('a', 1), ('c', 3), ('b', 2)]

best,


matt

On 08/28/2014 07:01 PM, Sean Owen wrote:
val map = Map("foo" -> 1, "bar" -> 2, "baz" -> 3)
val rdd = sc.parallelize(map.toSeq)

rdd is a an RDD[(String,Int)] and you can do what you like from there.

On Thu, Aug 28, 2014 at 11:56 PM, SK <skrishna...@gmail.com> wrote:
Hi,

How do I convert a Map object to an RDD so that I can use the
saveAsTextFile() operation to output the Map object?

thanks



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/transforming-a-Map-object-to-RDD-tp13071.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org

Reply via email to