title: How to split a column with comma separated values in PySpark's Dataframe?
body: <p>I have a PySpark dataframe with a column that contains comma separated values. The number of values that the column contains is fixed (say 4).
  Example:</p>
  
  <pre class="lang-python prettyprint-override"><code>+----+----------------------+
  |col1|                  col2|
  +----+----------------------+
  |   1|val1, val2, val3, val4|
  |   2|val1, val2, val3, val4|
  |   3|val1, val2, val3, val4|
  |   4|val1, val2, val3, val4|
  +----+----------------------+
  </code></pre>
  
  <p>Here I want to split col2 into 4 separate columns as shown below:</p>
  
  <pre class="lang-python prettyprint-override"><code>+----+-------+-------+-------+-------+
  |col1|  col21|  col22|  col23|  col24|
  +----+-------+-------+-------+-------+
  |   1|   val1|   val2|   val3|   val4|
  |   2|   val1|   val2|   val3|   val4|
  |   3|   val1|   val2|   val3|   val4|
  |   4|   val1|   val2|   val3|   val4|
  +----+-------+-------+-------+-------+
  </code></pre>
  
  <p>How can this be done?</p>