title: How do I return Multi-Column Key and Value pairs in Scala using Spark
body: <p>I want to transform the below RDD into Key Value Pairs, with each key having two values.
  The first column should be the key and the second and third column should be the values. How can I use the Case class in scala to perform the transformation?</p>
  
  <pre><code>scala&gt; input
  res31: org.apache.spark.rdd.RDD[org.apache.spark.sql.Row] = MapPartitionsRDD[60] at rdd at &lt;console&gt;:35
  
  scala&gt; input.take(5).foreach(println)
  [Ace,Ball,null]
  [Kids,Kids,null]
  [Hardware,Hardware,null]
  [Market,Market,Markets]
  [Adventure,Adventure,null]
  </code></pre>
  
  <p>Expected O/P:
  I am expecting a key-value pairs much like a Python Dictionary. One key will hold multiple values , hence the values will be a tuple . Once we have the key value pairs, based on key i should be able to extract the values.</p>
  
  <p>e.g</p>
  
  <pre><code>d = {key1: [val1, val2, val3....], key2: [valx, valy, valz, ...], ....}
  </code></pre>
  
  <p><code>d[key1][0]</code> gives the first value of key1</p>
  
  <p>Hope I am able to express my requirements clearly</p>