title: Why do some operators create a different type of Dataset like RelationalGroupedDataset?
body: <p>Some operators of <code>Dataset</code> create a new <code>Dataset</code> and update the logical plan, like 'filter' as below:</p>
  
  <pre><code>def filter(condition: Column): Dataset[T] = withTypedPlan {
    Filter(condition.expr, logicalPlan)
  }
  </code></pre>
  
  <p>But there are operators, like <code>groupBy</code>, that create a different type of <code>Dataset</code>, i.e. <code>RelationalGroupedDataset</code>.</p>
  
  <p>Why doesn't Spark create a new Dataset with a LogicalPlan which can express <code>groupBy</code>?</p>
  
  <pre><code>@scala.annotation.varargs
  def groupBy(cols: Column*): RelationalGroupedDataset = {
    RelationalGroupedDataset(toDF(), cols.map(_.expr), RelationalGroupedDataset.GroupByType)
  }
  </code></pre>