I have placed log.info statements inside my UDF but it is getting failed on cluster. Local working fine. Here is the snippet:
def relType = udf((colValue: String, relTypeV: String) => {
var relValue = "NA"
val relType = relTypeV.split(",").toList
val relTypeMap = relType.map { col =>
val split = col.split(":")
(split(0), split(1))
}.toMap
// val keySet = relTypeMap
relTypeMap.foreach { x =>
if ((x._1 != null || colValue != null || x._1.trim() != "" || colValue.trim() != "") && colValue.equalsIgnoreCase(x._1)) {
relValue = relTypeMap.getOrElse(x._1, "NA")
log.info("testing.........")
}
}
relValue
})
Also, when i am calling any function inside UDF and using log statements, logs are not printed in cluster and it works fine too.