title: call of distinct and map together throws NPE in spark library
body: <p>I am unsure if this is a bug, so if you do something like this</p>
  
  <pre><code>// d:spark.RDD[String]
  d.distinct().map(x =&gt; d.filter(_.equals(x)))
  </code></pre>
  
  <p>you will get a Java NPE. However if you do a <code>collect</code> immediately after <code>distinct</code>, all will be fine.</p>
  
  <p>I am using <a href="http://www.spark-project.org" rel="noreferrer">spark</a> 0.6.1.</p>