title: Create a map column in Apache Spark from other columns
body: <p>I searched this quite a bit but cannot find anything that I can adapt to my situation. I have a dataframe like so:</p>
  
  <pre><code>+-----------------+---------------+
  |             keys|         values|
  +-----------------+---------------+
  |[one, two, three]|[101, 202, 303]|
  +-----------------+---------------+
  </code></pre>
  
  <p>Keys have an array of strings, values has an array of ints.</p>
  
  <p>I want to create a new column that contains a map of keys to values like so:</p>
  
  <pre><code>+-----------------+---------------+---------------------------+
  |             keys|         values|                        map|
  +-----------------+---------------+---------------------------+
  |[one, two, three]|[101, 202, 303]|Map(one-&gt;101, two-&gt;202, etc|
  +-----------------+---------------+---------------------------+
  </code></pre>
  
  <p>I've been looking at this question, but not sure it can be used as a starting point for my situation: <a href="https://stackoverflow.com/questions/44225514/spark-dataframe-columns-transform-to-map-type-and-list-of-map-type">Spark DataFrame columns transform to Map type and List of Map Type</a></p>
  
  <p>I need this in Scala please.</p>
  
  <p>Thanks!</p>