New to the spark. I have two RDDs and you want to create a referenced RDD as shown below.
val rdd1 = Array(1, 2)
val rdd2 = Array(a, b, c)
val resultRDD = [(1,a), (1,b), (1,c), (2,a), (2,b), (2,c)]
Can someone help me on what kind of transformations or actions I need to use to create resultRDD as above. FYI, I write in scala.
EDIT
Thank. for me, as shown below, sparking works.
val data = Array('a', 'b')
val rdd1 = sc.parallelize(data)
val data2 = Array(1, 2, 3)
val rdd2 = sc.parallelize(data2)
rdd1.cartesian(rdd2).foreach(println)
source
share