title: How to merge two columns of a `Dataframe` in Spark into one 2-Tuple?
body: <p>I have a Spark <code>DataFrame</code> <code>df</code> with five columns. I want to add another column with its values being the tuple of the first and second columns. When using with withColumn() method, I get the mismatch error, because the input is not Column type, but instead (Column,Column). <strong>I wonder if there is a solution beside running for loop over the rows in this case?</strong></p>
  
  <pre><code>var dfCol=(col1:Column,col2:Column)=&gt;(col1,col2)
  val vv = df.withColumn( "NewColumn", dfCol( df(df.schema.fieldNames(1)) , df(df.schema.fieldNames(2)) ) )
  </code></pre>