In this data frame I am finding total salary from each group. In Oracle I'd use this code
select job_id,sum(salary) as "Total" from hr.employees group by job_id;
In Spark SQL tried the same, I am facing two issues
empData.groupBy($"job_id").sum("salary").alias("Total").show()
- The alias total is not displaying instead it is showing "sum(salary)" column
I could not use
$
(I think Scala SQL syntax). Getting compilation issueempData.groupBy($"job_id").sum($"salary").alias("Total").show()
Any idea?