I am writing a Spark Scala UDF and facing "java.lang.UnsupportedOperationException: Schema for type Any is not supported"
import org.apache.spark.sql.expressions.UserDefinedFunction
import org.apache.spark.sql.functions.udf
val aBP = udf((bG: String, pS: String, bP: String, iOne: String, iTwo: String) => {
if (bG != "I") {"NA"}
else if (pS == "D")
{if (iTwo != null) iOne else "NA"}
else if (pS == "U")
{if (bP != null) bP else "NA"}
})
This is throwing error "java.lang.UnsupportedOperationException: Schema for type Any is not supported"
elsetoo. What if none of those conditions are satisfied? - philantrovert