I was trying to use UDF in spark, and noticed there are three different ways to declare UDF, from Scala syntax prespective what each of these declarations means, how does one UDF function can be accessed in three different ways,from a java developer point the last one is straight forward, but the previous two are not clear. I am bit confused now.
// You could define UDF this way
val upperUDF1 = udf { s: String => s.toUpperCase }
// or this way
val upperUDF2 = udf[String, String](_.toUpperCase)
//or even this way!
def upperUDF3 = udf((data: String) => data.toUpperCase )
Thanks @RameshMahrjan, After some reading I figured out we can use curly braces or parenthesis and they are interchangeable. So as I understand UDF function is defined to accept generic value so we can use type parameter to call it.