title: how to write case with when condition in spark sql using scala
body: <pre><code>SELECT c.PROCESS_ID, 
         CASE WHEN c.PAYMODE = 'M' 
             THEN 
                 CASE WHEN CURRENCY = 'USD' 
                     THEN c.PREMIUM * c.RATE 
                     ELSE c.PREMIUM END * 12
             ELSE 
                 CASE WHEN CURRENCY = 'USD' 
                     THEN c.PREMIUM * c.RATE 
                     ELSE c.PREMIUM END END VAlue
  FROM CMM c
  </code></pre>
  
  <p>i want to convert sql query spark sql api how can i do?</p>
  
  <p>thanks </p>