title: Spark Scala Register UDF - Why I need to pass underscore (_) at the end of function
body: <p>I have created an UDF in Scala and when I was trying to register this UDF with just function name it was showing me error. </p>
  
  <p><strong>Not Working</strong> </p>
  
  <pre><code>def IPConvertUDF = spark.udf.register("IPConvertUDF", IPConvert)
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>error: missing argument list for method IPConvert
  Unapplied methods are only converted to functions when a function type is expected.
  You can make this conversion explicit by writing `IPConvert _` or `IPConvert(_)` instead of `IPConvert`.
  def IPConvertUDF = spark.udf.register("IPConvertUDF", IPConvert)
  </code></pre>
  
  <blockquote>
    <p>And so I added extra <code>_</code> after method name and it worked.</p>
  </blockquote>
  
  <p><strong>Works perfectly</strong> </p>
  
  <pre><code>def IPConvertUDF = spark.udf.register("IPConvertUDF", IPConvert _)
  </code></pre>
  
  <p>Would someone be able to explain be what is the meaning of extra <code>_</code> after the method name? </p>