[SPARK-3904] [SQL] add constant objectinspector support for udfs

In HQL, we convert all of the data type into normal `ObjectInspector`s for UDFs, most of cases it works, however, some of the UDF actually requires its children `ObjectInspector` to be the `ConstantObjectInspector`, which will cause exception.
e.g.
select named_struct("x", "str") from src limit 1;

I updated the method `wrap` by adding the one more parameter `ObjectInspector`(to describe what it expects to wrap to, for example: java.lang.Integer or IntWritable).

As well as the `unwrap` method by providing the input `ObjectInspector`.
Currently the `ObjectInspector` passed should not be `preferWriteable`, because the function `def toInspector(DataType)` will never returns that. I would like to keep it for further improvement (https://issues.apache.org/jira/browse/SPARK-4093), which probably pass in the `WritableObjectInspector`.