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 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 3:28:45 AM 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
>>>>
>>>>
>>>

Reply via email to