Zip or map elements to create new RDD

2014-03-29 Thread yh18190
Hi,
I have an RDD of elements and want to create a new RDD by Zipping other RDD
in order.
result[RDD] with sequence of 10,20,30,40,50 ...elements.
I am facing problems as index is not an RDD...its gives an error...Could
anyone help me how we can zip it or map it inorder to obtain following
result.(0,10),(1,20),(2,30),(3,40)
I tried like this...but doesnt work...even zipWithIndex doesnt work becoz
its scala method..not RDD method..

 val index= List.range(0, result.count(),1)
result.zip(index)



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Zip-or-map-elements-to-create-new-RDD-tp3467.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.


Re: Zip or map elements to create new RDD

2014-03-29 Thread Sonal Goyal
zipWithIndex works on the git clone, not sure if its part of a released
version.

https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/rdd/RDD.scala



Best Regards,
Sonal
Nube Technologies http://www.nubetech.co

http://in.linkedin.com/in/sonalgoyal




On Sat, Mar 29, 2014 at 5:27 PM, yh18190 yh18...@gmail.com wrote:

 Hi,
 I have an RDD of elements and want to create a new RDD by Zipping other RDD
 in order.
 result[RDD] with sequence of 10,20,30,40,50 ...elements.
 I am facing problems as index is not an RDD...its gives an error...Could
 anyone help me how we can zip it or map it inorder to obtain following
 result.(0,10),(1,20),(2,30),(3,40)
 I tried like this...but doesnt work...even zipWithIndex doesnt work becoz
 its scala method..not RDD method..

  val index= List.range(0, result.count(),1)
 result.zip(index)



 --
 View this message in context:
 http://apache-spark-user-list.1001560.n3.nabble.com/Zip-or-map-elements-to-create-new-RDD-tp3467.html
 Sent from the Apache Spark User List mailing list archive at Nabble.com.



Re: Zip or map elements to create new RDD

2014-03-29 Thread yh18190
Thanks sonal.Is der anyother way like to map values with Increasing
indexes...so that i can map(t=(i,t)) where value if 'i' increases after
each map operation on element...

Please help me ..in this aspect 



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Zip-or-map-elements-to-create-new-RDD-tp3467p3470.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.