Handle serialization / lazy initialization of UDF types in scala input formats