[SPARK-4785] [SQL] Support udf instance ser/de after initialization

UDF contract change in Hive 0.13.1. In Hive 0.12.0, it's always safe to construct and initialize a fresh UDF object on worker side, while in Hive 0.13.1, UDF objects should only be initialized on driver side and then serialized to the worker side. We provide the ability to serialize the initialized UDF instance and deserialize them cross process boundary.
Does this relate to the `HiveSimpleUdf` and UDF bridge case you mentioned offline? Would be better to leave a comment here. I was confused when reading this.