Hi Sean, I have a RDD like *theItems: org.apache.spark.rdd.RDD[Iterable[Int]]*
I did like *val items = theItems.collect *//to get it as an array items: Array[Iterable[Int]] *val check = items.contains(item)* Thanks Amit On Sun, Dec 28, 2014 at 1:58 PM, Amit Behera <amit.bd...@gmail.com> wrote: > Hi Nicholas, > > The RDD contains only one Iterable[Int]. > > Pankaj, > I used *collect* and I am getting as *items: Array[Iterable[Int]].* > > Then I did like : > > *val check = items.take(1).contains(item)* > > I am getting *check: Boolean = false, *but the item is present. > > > Thanks > Amit > > > > On Sun, Dec 28, 2014 at 8:56 AM, Pankaj <pankajnaran...@gmail.com> wrote: > >> Amit, I think you can use collect method to change RDD to Array so you >> can use array methods for the same. >> >> I think transformation functions would not allow to do that as they are >> lazily called you need to use Actions LIke collect or foreach method >> >> On Sun, Dec 28, 2014 at 1:54 AM, Amit Behera <amit.bd...@gmail.com> >> wrote: >> >>> Hi All, >>> >>> I want to check an item is present or not in a RDD of Iterable[Int] >>> using scala >>> >>> something like in java we do : >>> >>> *list.contains(item)* >>> >>> and the statement returns true if the item is present otherwise false. >>> >>> Please help me to find the solution. >>> >>> Thanks >>> Amit >>> >>> >> >