Contrary of .join() pyspark
<p><code>join</code> returns an RDD containing all pairs of elements with matching keys.</p>

<p><a href="https://spark.apache.org/docs/1.6.2/api/python/pyspark.html#pyspark.RDD.join" rel="nofollow">https://spark.apache.org/docs/1.6.2/api/python/pyspark.html#pyspark.RDD.join</a></p>

<p>Example:</p>

<pre><code> trueDupsRDD = (rdd1.join(rdd2))
</code></pre>

<p><b>How can I perform a disjoin?</b></p>

<p>I tried:</p>

<pre><code>notMatchingRDD = (rdd1.join(!rdd2))
</code></pre>

<p>Use <code>subtractByKey</code>:</p>

<blockquote>
  <p>Return each (key, value) pair in C{self} that has no pair with matching
  key in C{other}.</p>
</blockquote>

<pre><code>rdd1.subtractByKey(rdd2)
</code></pre>

python apache-spark pyspark