title: How to get unique pairs of values in DataFrame
body: <p>Given a pySpark DataFrame, how can I get all possible unique combinations of columns <code>col1</code> and <code>col2</code>.</p>
  
  <p>I can get unique values for a single column, but cannot get unique pairs of <code>col1</code> and <code>col2</code>:</p>
  
  <pre><code>df.select('col1').distinct().rdd.map(lambda r: r[0]).collect()
  </code></pre>
  
  <p>I tried this, but it doesn't seem to work:</p>
  
  <pre><code>df.select(['col1','col2']).distinct().rdd.map(lambda r: r[0]).collect()
  </code></pre>