title: How to create a TypedColumn in a Spark Dataset and manipulate it?
body: <p>I'm trying to perform an aggregation using <code>mapGroups</code> that returns a SparseMatrix as one of the columns, and sum the columns.</p>
  
  <p>I created a <code>case class</code> schema for the mapped rows in order to provide column names. The matrix column is typed <code>org.apache.spark.mllib.linalg.Matrix</code>. If I don't run <code>toDF</code> before performing the aggregation (<code>select(sum("mycolumn")</code>) I get one type mismatch error (<code>required: org.apache.spark.sql.TypedColumn[MySchema,?]</code>). If I include <code>toDF</code> I get another type mismatch error: <code>cannot resolve 'sum(mycolumn)' due to data type mismatch: function sum requires numeric types, not org.apache.spark.mllib.linalg.MatrixUDT</code>. So what's the right way to do it?</p>