[SPARK-3891][SQL] Add array support to percentile, percentile_approx and constant inspectors support

Supported passing array to percentile and percentile_approx UDAFs
To support percentile_approx,  constant inspectors are supported for GenericUDAF
Constant folding support added to CreateArray expression
Avoided constant udf expression re-evaluation

Author: Venkata Ramana G <ramana.gollamudi@huawei.com>
Constant check and returning value is required for two reasons:
1. some UDF functions returns constant iterator when initializeAndFoldConstants called with constant iterators, by executing them once.
But if the same are called with "function.evaluate" they will not return the  same constant value type. There will be mismatch in the datatype expected by constantReturnInspector datatype vs datatype returned by function.evaluate.(Ex: org.apache.hadoop.io.Text vs String). This fails unwrap.
So if return Inspector is constant we don't need to call "function.evaluate" as the expression is already evaluated and return value is already present in constant iterator.
This I have uncovered, when I made CreateArrayExression as foldable, then test fails. So modified as part of current defect fix only.

2. Even if Literal is identified during optimization, expression is evaluated twice, once during return Inspector creation and next during eval function.