title: How to name aggregate columns?
body: <p>I'm using Spark in Scala and my aggregated columns are anonymous. Is there a convenient way to rename multiple columns from a dataset? I thought about imposing a schema with <code>as</code> but the key column is a struct (due to the <code>groupBy</code> operation), and I can't find out how to define a <code>case class</code> with a <code>StructType</code> in it.</p>
  
  <p>I tried defining a schema as follows:</p>
  
  <pre><code>val returnSchema = StructType(StructField("edge", StructType(StructField("src", IntegerType, true),
                                                               StructField("dst", IntegerType), true)), 
                                StructField("count", LongType, true))
  edge_count.as[returnSchema]
  </code></pre>
  
  <p>but I got a compile error:</p>
  
  <pre><code>Message: &lt;console&gt;:74: error: overloaded method value apply with alternatives:
    (fields: Array[org.apache.spark.sql.types.StructField])org.apache.spark.sql.types.StructType &lt;and&gt;
    (fields: java.util.List[org.apache.spark.sql.types.StructField])org.apache.spark.sql.types.StructType &lt;and&gt;
    (fields: Seq[org.apache.spark.sql.types.StructField])org.apache.spark.sql.types.StructType
   cannot be applied to (org.apache.spark.sql.types.StructField, org.apache.spark.sql.types.StructField, Boolean)
         val returnSchema = StructType(StructField("edge", StructType(StructField("src", IntegerType, true),
  </code></pre>