title: GroupBy and Aggregate Function In JAVA spark Dataset
body: <p>I am trying to do below operation on a dataset for Grouping and aggregating the Column expend to add up. But this isn't working on a normal Dataset it says for  RelationalGroupedDataset. How can I achieve the below operation in the Normal Dataset</p>
  
  <pre><code>dataset.select.(col("col1"),col("col2"),col("expend")).groupBy(col("col1"),col("col2"),col("expend")).agg(sum("expend"))
  </code></pre>
  
  <p>The SQL query looks like 
  <code>select col1,col2,SUM(expend) from table group by col1,col2</code></p>
  
  <p>The Columns gets repeated when I try this code. 
  <code>dataset.columns()</code> gives me <code>[col1,col2,expend,expend]</code>  is the way of approach right?</p>