title: Apache Spark, add an "CASE WHEN ... ELSE ..." calculated column to an existing DataFrame
body: <p>I'm trying to add an "CASE WHEN ... ELSE ..." calculated column to an existing DataFrame, using Scala APIs.
  Starting dataframe:</p>
  
  <pre><code>color
  Red
  Green
  Blue
  </code></pre>
  
  <p>Desired dataframe (SQL syntax: CASE WHEN color == Green THEN 1 ELSE 0 END AS bool):</p>
  
  <pre><code>color bool
  Red   0
  Green 1
  Blue  0
  </code></pre>
  
  <p>How should I implement this logic?</p>