title: How to convert the group by function to data frame
body: <p>Hi I am new to scala and spark. I am trying group by through spark sql. When I am trying to save or to view the output.It throws following error.</p>
  
  <pre><code>value coalesce is not a member of org.apache.spark.sql.RelationalGroupedDataset
  </code></pre>
  
  <p>This is my code.</p>
  
  <pre><code> val fp = filtertable.select($"_1", $"_2", $"_3",$"_4").groupBy("_1", "_2","_3")
   fp.show() // throws error
   fp.coalesce(1).write.format("csv").save("file://" + test.toString()) //throws error.
  </code></pre>
  
  <p>Any help will be appreciated.</p>