title: Spark Scala Vector Map ClassCastException
body: <p>Trying to make use of the Statistics tool in Spark for Scala and having difficulty preparing a vector that will take.</p>
  
  <pre><code>val featuresrdd =   features.rdd.map{_.getAs[Vector]("features")}
  
  featuresrdd: org.apache.spark.rdd.RDD[org.apache.spark.mllib.linalg.Vector] = MapPartitionsRDD[952] at map at &lt;console&gt;:82
  </code></pre>
  
  <p>This produces a vector of type 'mllib.linalg.vector', however upon using this in the tool, the vector has changed to type 'DenseVector'.</p>
  
  <pre><code>import org.apache.spark.mllib.linalg._
  import org.apache.spark.mllib.stat.Statistics
  import org.apache.spark.rdd.RDD
  
  val correlMatrix: Matrix = Statistics.corr(featuresrdd, "pearson")
  
  java.lang.ClassCastException: org.apache.spark.ml.linalg.DenseVector cannot be cast to org.apache.spark.mllib.linalg.Vector
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks</p>