title: Process all columns / the entire row in a Spark UDF
body: <p>For a dataframe containing a mix of string and numeric datatypes, the goal is to create a new <code>features</code> column that is a <code>minhash</code> of all of them.</p>
  
  <p>While this could be done by performing a <code>dataframe.toRDD</code> it is expensive to do that when the next step will be to simply convert the <code>RDD</code> <em>back</em> to a dataframe.</p>
  
  <p>So is there a way to do a <code>udf</code> along the following lines:</p>
  
  <pre><code>val wholeRowUdf = udf( (row: Row) =&gt;  computeHash(row))
  </code></pre>
  
  <p><code>Row</code> is not a <code>spark sql</code> datatype of course - so this would not work as shown. </p>
  
  <p><strong>Update/clarifiction</strong>  I realize it is easy to create a full-row UDF that runs inside <code>withColumn</code>. What is not so clear is what can be used inside a <code>spark sql</code> statement:</p>
  
  <pre><code>val featurizedDf = spark.sql("select wholeRowUdf( what goes here? ) as features 
                                from mytable")
  </code></pre>