Are you doing this because it's sorted somehow, or you have a file where you 
want the last K? For that you could probably use the lower-level API of 
SparkContext.runJob() to run a job on just the last partition and then return 
the last elements from there. I'm just curious how general this need is.

Matei

On Oct 24, 2013, at 3:23 PM, Matt Cheah <[email protected]> wrote:

> Hi everyone,
> 
> I see there is a take() function for RDDs, getting the first n elements. Is 
> there a way to get the last n elements?
> 
> Thanks,
> 
> -Matt Cheah

Reply via email to