Schema for type Any is not supported
I'm trying to create a spark UDF to extract a Map of (key, value) pairs from a User defined case class. The scala function seems to work fine, but when I try to convert that to a UDF in spark2.0, I'm running into the " Schema for type Any is not supported" error. case class myType(c1: String, c2: Int) def getCaseClassParams(cc: Product): Map[String, Any] = { cc .getClass .getDeclaredFields // all field names .map(_.getName) .zip(cc.productIterator.to) // zipped with all values .toMap } But when I try to instantiate a function value as a UDF it results in the following error - val ccUDF = udf{