title: Spark - Apply UDF on few columns of a Dataset and form new columns
body: <p>I have a Dataset of String types and I want to apply a function over some columns of this dataset and convert them to Long or Double or Int etc. based on the column and append the new columns (or even a tuple of these columns) to the same Dataset. Can someone please suggest the right way of doing this ?</p>
  
  <p>UPDATE:</p>
  
  <p>The following fails:</p>
  
  <pre><code>ds.withColumn("newCol", Vectors.dense(strDoubleUDF(ds("col10")) + str2DoubleUDF(ds("col12")))
  </code></pre>
  
  <p>with the error</p>
  
  <pre><code>&lt;console&gt;:253: error: overloaded method value dense with alternatives:
    (values: Array[Double])org.apache.spark.mllib.linalg.Vector &lt;and&gt;
    (firstValue: Double,otherValues: Double*)org.apache.spark.mllib.linalg.Vector
   cannot be applied to (org.apache.spark.sql.Column, org.apache.spark.sql.Column)
                           Vectors.dense(str2DoubleUDF(ds("col10")),
  </code></pre>