You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Robineast <Ro...@xense.co.uk> on 2016/06/06 11:23:43 UTC
Re: How to modify collection inside a spark rdd foreach
It's not that clear what you are trying to achieve - what type is myRDD and
where do k and v come from?
Anyway it seems you want to end up with a map or a dictionary which is what
PairRDD is for e.g.
val rdd = sc.makeRDD(Array("1","2","3"))
val pairRDD = rdd.map(el => (el.toInt, el))
-----
Robin East
Spark GraphX in Action Michael Malak and Robin East
Manning Publications Co.
http://www.manning.com/books/spark-graphx-in-action
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/How-to-modify-collection-inside-a-spark-rdd-foreach-tp27088p27095.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org