title: Apache Spark: collect into an array intersections
body: <p>Suppose a dataframe with two columns: C1 and C2</p>
  <pre><code>+---+-----+
  |C1 | C2  |
  +---+-----+
  |A  |  B  |
  |C  |  D  |
  |A  |  E  |
  |E  |  F  |
  +---+-----+
  </code></pre>
  <p>My goal is: collect into in array intersections</p>
  <pre><code>+--------------+
  | intersections|
  +--------------+
  |[A, B, E, F]  |
  |[C, D]        |
  +--------------+
  </code></pre>
  <p>How it can be done good if the dataframe has the large number of rows (~ 1 billion)</p>