RE: Key-Value decomposition

2014-11-04 Thread Suraj Satishkumar Sheth
Hi David,
Use something like :
Val outputRDD = rdd.flatMap(keyValue = keyValue._2.split(;).map(value = 
(keyvalue._1, value)).toArray)

Thanks and Regards,
Suraj Sheth

-Original Message-
From: david [mailto:david...@free.fr] 
Sent: Tuesday, November 04, 2014 1:28 PM
To: u...@spark.incubator.apache.org
Subject: Re: Key-Value decomposition

Hi,

 But i've only one RDD. Hre is a more complete exemple :

my rdd is something like   (A, 1;2;3),  (B, 2;5;6), (C, 3;2;1) 

And i expect to have the following result :

 (A,1) , (A,2) , (A,3) , (B,2) , (B,5) , (B,6) , (C,3) ,
(C,2) , (C,1)


Any idea about how can i achieve this ?

Thank's



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Key-Value-decomposition-tp17966p18036.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



RE: Key-Value decomposition

2014-11-04 Thread david
Thank's



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Key-Value-decomposition-tp17966p18050.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



Re: Key-Value decomposition

2014-11-03 Thread Ganelin, Ilya
Very straightforward:

You want to use cartesian.
If you have two RDDs - RDD_1(³A²) and RDD_2(1,2,3)

RDD_1.cartesian(RDD_2) will generate the cross product between the two
RDDs and you will have
RDD_3((³A²,1), (³B²,2), (³C², 3))


On 11/3/14, 11:38 AM, david david...@free.fr wrote:

Hi,

  I'm a newbie in Spark and faces the following use case :

   val data = Array ( A, 1;2;3)
   val rdd = sc.parallelize(data)

// Something here to produce RDD of (Key,value)
// ( A, 1) , (A, 2), (A, 3)
  
Does anybody know how to do ?

Thank's

   



--
View this message in context:
http://apache-spark-user-list.1001560.n3.nabble.com/Key-Value-decompositio
n-tp17966.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




The information contained in this e-mail is confidential and/or proprietary to 
Capital One and/or its affiliates. The information transmitted herewith is 
intended only for use by the individual or entity to which it is addressed.  If 
the reader of this message is not the intended recipient, you are hereby 
notified that any review, retransmission, dissemination, distribution, copying 
or other use of, or taking of any action in reliance upon this information is 
strictly prohibited. If you have received this communication in error, please 
contact the sender and delete the material from your computer.


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



Re: Key-Value decomposition

2014-11-03 Thread david
Hi,

 But i've only one RDD. Hre is a more complete exemple :

my rdd is something like   (A, 1;2;3),  (B, 2;5;6), (C, 3;2;1) 

And i expect to have the following result :

 (A,1) , (A,2) , (A,3) , (B,2) , (B,5) , (B,6) , (C,3) ,
(C,2) , (C,1)


Any idea about how can i achieve this ?

Thank's



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Key-Value-decomposition-tp17966p18036.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