I have the following code that works.
val locList = Source.fromInputStream(getClass.getResourceAsStream("/locations.txt")).getLines().toList
def locCheck(col: String): Boolean = locList.contains(col)
def locUDF = udf[Boolean, String](locCheck)
But when I add a toUpperCase to make it
val locList = Source.fromInputStream(getClass.getResourceAsStream("/locations.txt")).getLines().toList
def locCheck(col: String): Boolean = locList.contains(col.toUpperCase)
def locUDF = udf[Boolean, String](locCheck)
I run into a Failed to execute user defined function caused by java.lang.NullPointerException
I using the udf as df.filter(locUDF('location)).count()
What am I doing wrong here and how do I fix it ?
locationcolumn iflocationis null then col is null and throws NPE incol.toUpperCase