title: Plug a function with currying into Spark UserDefinedFunction
body: <p>I have a function that works as expected</p>
  
  <pre><code>import org.apache.spark.sql.expressions.UserDefinedFunction
  import org.apache.spark.sql.functions.udf
  import scala.collection.mutable.WrappedArray
  
  def arrayContainsAny(s: Seq[String]): UserDefinedFunction = udf((xs: WrappedArray[String]) =&gt; !xs.toList.intersect(s).isEmpty)
  </code></pre>
  
  <p>I need to split the function from the <code>UserDefinedFunction</code> definition</p>
  
  <p>I have have tried the following</p>
  
  <pre><code>// imports again
  def _arrayContainsAny(s: Seq[String])(c: WrappedArray[String]): Boolean = !c.toList.intersect(s).isEmpty
  def arrayContainsAny: UserDefinedFunction = udf[Boolean, WrappedArray[String], Seq[String]](_arrayContainsAny)
  </code></pre>
  
  <p>but it does not even compile.</p>
  
  <p>The problem seems to be that I define the function as <code>udf[X, Y, Z]</code> and thus it expects a function <code>(Z, Y) =&gt; X</code> and not a <code>(Z)(Y) =&gt; X</code></p>
  
  <p>Does anyone know how to do this?</p>
  
  <p>-- β</p>