Map2 for RDD[A], RDD[B], F:(A,B)=>C

If I have two RDDs of the same size but potentially different types, and a binary function to map the two types to a third types, what is the best way to create a new RDD where each element is a combination of the corresponding two elements of the original RDDS?

def map2[A,B,C](rdd1:RDD[A], rdd2:RDD[B], f:(A,B)=>C)): RDD[C] = {


Does the fact that I’m asking this question already mean I’m approaching the problem completely wrong?

def map2[A,B,C](rdd1: RDD[A], rdd2: RDD[B])(f: (A,B) => C): RDD[C] =
  (rdd1 zip rdd2) map f.tupled

But it looks like there are some restrictions on zip in Spark. Might be best to ask these kind of things on a Spark specific forum.