Creating combination of value list with existing key - Pyspark
<p>So my rdd consists of data looking like: </p>

<pre><code>(k, [v1,v2,v3...])
</code></pre>

<p>I want to create a combination of all sets of two for the value part.</p>

<p>So the end map should look like:</p>

<pre><code>(k1, (v1,v2))
(k1, (v1,v3))
(k1, (v2,v3))
</code></pre>

<p>I know to get the value part, I would use something like </p>

<pre><code>rdd.cartesian(rdd).filter(case (a,b) =&gt; a &lt; b)
</code></pre>

<p>However, that requires the entire rdd to be passed (right?) not just the value part.  I am unsure how to arrive at my desired end, I suspect its a groupby.</p>

<p>Also, ultimately, I want to get to the k,v looking like </p>

<pre><code>((k1,v1,v2),1)
</code></pre>

<p>I know how to get from what I am looking for to that, but maybe its easier to go straight there? </p>

<p>Thanks.</p>