title: Spark how to merge two column based on a condition
body: <p>I have a spark dataFrame which has 3 column, and I want to merge two of theme based on the 3rd one, here is an example : <br></p>
  
  <pre><code>+---+---+---+
  |AAA|bbb|ccc|
  +---+---+---+
  |AAA|BBB|  E|
  |AAA|BBB|  R|
  |AAA|BBB|  E|
  |AAA|BBB|  R|
  |AAA|BBB|  R|
  |AAA|BBB|  E|
  +-----------+
  </code></pre>
  
  <p>I want to use the value of column AAA when the value of column CCC is E and to use BBB when CCC is R
  here is the output : </p>
  
  <pre><code>+---+---+
  |NEW|ccc|
  +---+---+
  |AAA|  E|
  |BBB|  R|
  |AAA|  E|
  |BBB|  R|
  |BBB|  R|
  |AAA|  E|
  +-------+
  </code></pre>