I have two RDDs :
RDD1[String, Double]
sample data :
("a" , 1.0)
("b" , 2.0)
("c" , 3.0)
("d" , 4.0)
This corresponds to a key value pair.
RDD2[String , (String , String)
sample data :
("a" , ("b" , "c"))
("b" , ("a" , "b"))
("c" , ("a" , "d"))
("d" , ("a" , "b"))
RDD1 contains values that is required by RDD2
So I want to be able to access values from RDD2 in RDD1 such as :
("a" , ("b" , "c")) will map to ("a" , (2.0 , 3.0))
2.0 & 3.0 are the corresponding values in RDD1
How can I achieve this with Scala Spark ? Possible solutions is to convert RDD1 to a HashMap and then just "get" the values within a Map operation of RDD2 :
RDD2.map(m => RDD1HashMap.get(m._2._1))
Is there an alternative method to achieve this ?