def intersection(other)
      mapping_function = 'lambda{|item| [item, nil]}'
      filter_function  = 'lambda{|(key, values)| values.size > 1}'

      self.map(mapping_function)
          .cogroup(other.map(mapping_function))
          .filter(filter_function)
          .keys
    end
def intersection(other)
      mapping_function = 'lambda{|item| [item, nil]}'
      filter_function  = 'lambda{|(key, values)| values.size > 1}'

      self.map(mapping_function)
          .cogroup(other.map(mapping_function))
          .filter(filter_function)
          .keys
    end
Return the intersection of this RDD and another one. The output will not contain
 any duplicate elements, even if the input RDDs did.

 == Example:
   rdd1 = $sc.parallelize([1,2,3,4,5])
   rdd2 = $sc.parallelize([1,4,5,6,7])
   rdd1.intersection(rdd2).collect
   # => [1, 4, 5]