title: Getting values of keys from a rdd of maps in scala
body: <p>I have an RDD which has maps as its elements. I cannot use RDD.get, of course. So, as of now, I do the following to get values for keys from this map:</p>
  
  <pre><code>val x = RDD.collect().flatten.toMap
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>x.get(key)
  </code></pre>
  
  <p>to get the value for the key. Now, have a really big rdd which outputs the error <code>java.lang.OutOfMemoryError: GC overhead limit exceeded</code> as I am applying .collect() on the rdd. How can I do it without applying .collect() on the rdd?</p>