title: Spark dataframe orderBy using a variable
body: <p>I am trying to do something like this, but it gives an error. What is the right way of doing so while still using a variable? </p>
  
  <pre><code>import org.apache.spark.sql._
  ....
  val seq = Seq[Column](new Column("colX"), new Column("colY"), new Column("colZ"))
  someDataFrame.orderBy(seq)
  </code></pre>
  
  <p>I know that one can also use something like <code>orderBy("colX", "colY", "colZ")</code>, but here I want to use a variable because my order sequence would change on different conditions. </p>
  
  <p>I get an error like this.</p>
  
  <pre><code>error: overloaded method value orderBy with alternatives:
    (sortExprs: org.apache.spark.sql.Column*)org.apache.spark.sql.Dataset[org.apache.spark.sql.Row] &lt;and&gt;
    (sortCol: String,sortCols: String*)org.apache.spark.sql.Dataset[org.apache.spark.sql.Row]
   cannot be applied to (Seq[org.apache.spark.sql.Column])
  </code></pre>