[SPARK-4244] [SQL] Support Hive Generic UDFs with constant object inspector parameters

Query `SELECT named_struct(lower("AA"), "12", lower("Bb"), "13") FROM src LIMIT 1` will throw exception, some of the Hive Generic UDF/UDAF requires the input object inspector is `ConstantObjectInspector`, however, we won't get that before the expression optimization executed. (Constant Folding).

This PR is a work around to fix this. (As ideally, the `output` of LogicalPlan should be identical before and after Optimization).
The key change here is we need to get the folded result via Hive the method `initializeAndFoldConstants` of UDF, not the `initialize` method, that's why I made the change in L155-L156. UDF itself knows better how to constant fold the computing if it's applicable, and the return value of `initializeAndFoldConstants` tells us if it's can be or not and what the result it is.