Re: unable to check whether an item is present in RDD

2014-12-28 Thread Amit Behera
Hi Sean and Nicholas Thank you very much, *exists* method works here :) On Sun, Dec 28, 2014 at 2:27 PM, Sean Owen wrote: > Try instead i.exists(_ == target) > On Dec 28, 2014 8:46 AM, "Amit Behera" wrote: > >> Hi Nicholas, >> >> I am getting >> error: value contains is not a member of Iterab

Re: unable to check whether an item is present in RDD

2014-12-28 Thread Sean Owen
Try instead i.exists(_ == target) On Dec 28, 2014 8:46 AM, "Amit Behera" wrote: > Hi Nicholas, > > I am getting > error: value contains is not a member of Iterable[Int] > > On Sun, Dec 28, 2014 at 2:06 PM, Nicholas Chammas < > nicholas.cham...@gmail.com> wrote: > >> take(1) will just give you a s

Re: unable to check whether an item is present in RDD

2014-12-28 Thread Amit Behera
Hi Nicholas, I am getting error: value contains is not a member of Iterable[Int] On Sun, Dec 28, 2014 at 2:06 PM, Nicholas Chammas < nicholas.cham...@gmail.com> wrote: > take(1) will just give you a single item from the RDD. RDDs are not ideal > for point lookups like you are doing, but you can

Re: unable to check whether an item is present in RDD

2014-12-28 Thread Amit Behera
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 wrote: > Hi Nicholas, > >

Re: unable to check whether an item is present in RDD

2014-12-28 Thread Nicholas Chammas
take(1) will just give you a single item from the RDD. RDDs are not ideal for point lookups like you are doing, but you can find the element you want by doing something like: rdd.filter(i => i.contains(target)).collect() Where target is the Int you are looking for. Nick ​ On Sun Dec 28 2014 at

Re: unable to check whether an item is present in RDD

2014-12-28 Thread Amit Behera
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 a

Re: unable to check whether an item is present in RDD

2014-12-27 Thread Nicholas Chammas
Is the item you're looking up an Int? So you want to find which of the Iterable[Int] elements in your RDD contains the Int you're looking for? On Sat Dec 27 2014 at 3:26:41 PM Amit Behera wrote: > Hi All, > > I want to check an item is present or not in a RDD of Iterable[Int] using > scala > > s

unable to check whether an item is present in RDD

2014-12-27 Thread Amit Behera
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