[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 work, 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;

Hence 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).

In the meantime, we also need to update the `unwrap` methods, which is ambiguous for `java.lang.List[Object]`, since both `ListObjectInspector` and `StructObjectInspector` can accept that. I will create follow up issue for this.
Indentation is off.