[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`.
Yes, currently the `oi` is should not be "preferWritable" as `toInspector` doesn't return that. Even if we return an new instance of `Writable` here, it's the same as the `preferWritable` `ObjectInspector` does internally.
As you suggested we don't want to dynamically check the `oi` type, I will keep that for future improvement, and to reuse the writable object.