title: conditional aggregation using pyspark
body: <p>consider the below as the dataframe</p>
  
  <pre><code>a        b  c   d   e  
  africa  123 1   10  121.2
  africa  123 1   10  321.98
  africa  123 2   12  43.92
  africa  124 2   12  43.92
  usa     121 1   12  825.32
  usa     121 1   12  89.78
  usa     123 2   10  32.24
  usa     123 5   21  43.92
  canada  132 2   13  63.21
  canada  132 2   13  89.23
  canada  132 3   21  85.32
  canada  131 3   10  43.92
  </code></pre>
  
  <p>now I want to convert the below case statement to equivalent statement in PYSPARK using dataframes.</p>
  
  <p>we can directly use this in case statement using hivecontex/sqlcontest nut looking for the traditional pyspark nql query </p>
  
  <pre><code>select 
  case 
      when c &lt;=10 then sum(e)
      when c between 10 and 20 then avg(e)
  else 0.00 end 
  from table 
  group by a,b,c,d
  </code></pre>
  
  <p>Regards
  Anvesh </p>