You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Sameer Tilak <ss...@live.com> on 2014/09/16 20:48:36 UTC

RDD projection and sorting

Hi All,
I have data in for following format:L
1st column is userid and the second column onward are class ids for various products. I want to save this in Libsvm format and an intermediate step is to sort (in ascending manner) the class ids. For example: I/Puid1   1243    3580    2670    122     2593    1782    1526uid2   121     285     2447    1516    343     385     1200     912     1430    5824    1451    8931    1271    1088    2584    1664    5481
Desired O/P:uid1   122  1243  1526  1782  2593  2670  3580                uid2   121     285     343     385   912  1088   1200   1271   1430   1451   1516   1664   2447   2584    5481  5824       8931               
Can someone please point me in the right direction. How do I project 
if I use val data = sc.textFile(..)How do I project column 1 to end (not including column 0) and then sort these projected columns.