Reduce Tuple2Integer, Integer to Tuple2Integer,ListInteger

2014-09-16 Thread Tom
From my map function I create Tuple2Integer, Integer pairs. Now I want to
reduce them, and get something like Tuple2Integer, Listlt;Integer. 

The only way I found to do this was by treating all variables as String, and
in the reduceByKey do
/return a._2 + , + b._2/ //in which both are numeric values saved in a
String
After which I do a Arrays.asList(string.split(,)) in mapValues. This
leaves me with String, Listlt;Integer. So now I am looking for either
- A function with which I can transform String, Listlt;Integer to
Integer, Listlt;Integer
or
- A way to reduce Tuple2Integer, Integer into a Tuple2Integer,
Listlt;Integer in the reduceByKey function so that I can use Integers all
the way

Of course option two would have preferences.

Thanks!



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Reduce-Tuple2-Integer-Integer-to-Tuple2-Integer-List-Integer-tp14361.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: Reduce Tuple2Integer, Integer to Tuple2Integer,ListInteger

2014-09-16 Thread Sean Owen
If you mean you have (key,value) pairs, and want pairs with key, and
all values for that key, then you're looking for groupByKey

On Tue, Sep 16, 2014 at 2:42 PM, Tom thubregt...@gmail.com wrote:
 From my map function I create Tuple2Integer, Integer pairs. Now I want to
 reduce them, and get something like Tuple2Integer, Listlt;Integer.

 The only way I found to do this was by treating all variables as String, and
 in the reduceByKey do
 /return a._2 + , + b._2/ //in which both are numeric values saved in a
 String
 After which I do a Arrays.asList(string.split(,)) in mapValues. This
 leaves me with String, Listlt;Integer. So now I am looking for either
 - A function with which I can transform String, Listlt;Integer to
 Integer, Listlt;Integer
 or
 - A way to reduce Tuple2Integer, Integer into a Tuple2Integer,
 Listlt;Integer in the reduceByKey function so that I can use Integers all
 the way

 Of course option two would have preferences.

 Thanks!



 --
 View this message in context: 
 http://apache-spark-user-list.1001560.n3.nabble.com/Reduce-Tuple2-Integer-Integer-to-Tuple2-Integer-List-Integer-tp14361.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