title: Inner map function in Spark
body: <p>I have two RDDs : </p>
  
  <pre><code>RDD1[String, Double]
  </code></pre>
  
  <p>sample data : </p>
  
  <pre><code>("a" , 1.0)
  ("b" , 2.0)
  ("c" , 3.0)
  ("d" , 4.0)
  </code></pre>
  
  <p>This corresponds to a key value pair.</p>
  
  <hr>
  
  <pre><code>RDD2[String , (String , String)
  </code></pre>
  
  <p>sample data : </p>
  
  <pre><code>("a" , ("b" , "c"))
  ("b" , ("a" , "b"))
  ("c" , ("a" , "d"))
  ("d" , ("a" , "b"))
  </code></pre>
  
  <p>RDD1 contains values that is required by RDD2</p>
  
  <p>So I want to be able to access values from RDD2 in RDD1 such as : </p>
  
  <pre><code>("a" , ("b" , "c")) will map to ("a" , (2.0 , 3.0))
  </code></pre>
  
  <p>2.0 &amp; 3.0 are the corresponding values in RDD1</p>
  
  <p>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 : </p>
  
  <pre><code>RDD2.map(m =&gt; RDD1HashMap.get(m._2._1))
  </code></pre>
  
  <p>Is there an alternative method to achieve this ?</p>