How to RDD.take(middle 10 elements)

2014-07-10 Thread Nick Chammas
Interesting question on Stack Overflow:
http://stackoverflow.com/q/24677180/877069

Basically, is there a way to take() elements of an RDD at an arbitrary
index?

Nick
​




--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/How-to-RDD-take-middle-10-elements-tp9340.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

Re: How to RDD.take(middle 10 elements)

2014-07-10 Thread Xiangrui Meng
This is expensive but doable:

rdd.zipWithIndex().filter { case (_, idx) = idx = 10  idx  20 }.collect()

-Xiangrui

On Thu, Jul 10, 2014 at 12:53 PM, Nick Chammas
nicholas.cham...@gmail.com wrote:
 Interesting question on Stack Overflow:
 http://stackoverflow.com/q/24677180/877069

 Basically, is there a way to take() elements of an RDD at an arbitrary
 index?

 Nick


 
 View this message in context: How to RDD.take(middle 10 elements)
 Sent from the Apache Spark User List mailing list archive at Nabble.com.