title: moving transformations from hive sql query to Spark
body: <pre><code>val temp = sqlContext.sql(s"SELECT A, B, C, (CASE WHEN (D) in (1,2,3) THEN ((E)+0.000)/60 ELSE 0 END) AS Z from TEST.TEST_TABLE")
  val temp1 = temp.map({ temp =&gt; ((temp.getShort(0), temp.getString(1)), (USAGE_TEMP.getDouble(2), USAGE_TEMP.getDouble(3)))})
  .reduceByKey((x, y) =&gt; ((x._1+y._1),(x._2+y._2)))
  </code></pre>
  
  <p>instead of the above code which is doing the computation(case evaluation) on hive layer I would like to have the transformation done in scala. How would I do it?</p>
  
  <p>Is it possible to do the same while filling the data inside  Map?</p>