You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by gulyasm <mg...@gmail.com> on 2015/07/28 13:15:01 UTC

Iterating over values by Key

I have K/V pairs where V is an Iterable (from previous groupBy). I use the
JAVA API. 
What I want is to iterate over the values by key, and on every element set
previousElementId attribute, that is the id of the previous element in the
sorted list. 
I try to do this with mapValues. I create an array from the Iterable, sort
the list there and iterate over the values, setting the attribute and saving
the reference for the next element. After that, return the array. 
Is this the best approach or I miss something?

Spark version: 1.4.1
Java version: 1.8

Thanks in advance. 
Mate



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Iterating-over-values-by-Key-tp24029.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