Hi Deep,

The Iterable trait in scala has methods like map and reduce that you can
use to iterate elements of Iterable[String]. You can also create an
Iterator from the Iterable. For example, suppose you have

val rdd: RDD[Iterable[String]]

you can do

rdd.map { x => //x has type Iterable[String]
   x.map(...) // Process elements in iterable[String]
   val iter:Iterator[String] = x.iterator
   while(iter.hasNext) {
        iter.next()
   }
}

Hope this helps!

Liquan

On Wed, Sep 24, 2014 at 8:21 AM, Deep Pradhan <pradhandeep1...@gmail.com>
wrote:

> Can we iterate over RDD of Iterable[String]? How do we do that?
> Because the entire Iterable[String] seems to be a single element in the
> RDD.
>
> Thank You
>



-- 
Liquan Pei
Department of Physics
University of Massachusetts Amherst

Reply via email to