Re: "dynamically" sort a large collection?

2015-10-12 Thread Adrian Tanase
ect: "dynamically" sort a large collection? Hey, I need to scan a large "key-value" collection as below: 1) sort it on an attribute of “value” 2) scan it one by one, from element with largest value 2.1) if the current element matches a pre-defined condition, its value will be

"dynamically" sort a large collection?

2015-10-12 Thread Yifan LI
Hey, I need to scan a large "key-value" collection as below: 1) sort it on an attribute of “value” 2) scan it one by one, from element with largest value 2.1) if the current element matches a pre-defined condition, its value will be reduced and the element will be inserted back to collection.

Re: "dynamically" sort a large collection?

2015-10-12 Thread Yifan LI
rtedRdd.flatMapValues( v => > If (v % 2 == 0) { > Some(v / 2) > } else { > None > } > ) > > Then you need to sort again. > > -adrian > > From: Yifan LI > Date: Monday, October 12, 2015 at 1:03 PM > To: spark users > Subject: "dynamically" sor

Re: "dynamically" sort a large collection?

2015-10-12 Thread Yifan LI
.@adobe.com>> wrote: >> >> I think you’re looking for the flatMap (or flatMapValues) operator – you can >> do something like >> >> sortedRdd.flatMapValues( v => >> If (v % 2 == 0) { >> Some(v / 2) >> } else { >> None >> } >> ) >> >> T