title: Variable number of arguments for pyspark udf
body: <p>I have around <code>275</code> columns and  I would like to search <code>25</code> columns for a regex string <code>"^D(410|412)</code>. If this search string is is present in any of <code>2</code>5 columns I would like to add <code>true</code> to <code>MyNewColumn</code>.</p>
  
  <p>using below I could do it for <code>2</code> columns. Is there anyway for passing variable number of columns ?</p>
  
  <p><strong>Below code works for 2 columns</strong></p>
  
  <pre><code>def moreThanTwoArgs(col1,col2): 
  return bool((re.search("^D(410|412)",col1) or re.search("^D(410|412)",col2)))
  
  twoUDF= udf(moreThanTwoArgs,BooleanType())
  df = df.withColumn("MyNewColumn", twoUDF(df["X1"], df["X2"]))
  </code></pre>