1. [SPARK-25768][SQL] fix constant argument expecting UDAFs (commit: 353d328041397762e12acf915967cafab5dcdade) (details)
  2. fix security issue of zinc (commit: 5cef11acc0770ca49a0487d6543eb81022b7415d) (details)
Commit 353d328041397762e12acf915967cafab5dcdade by wenchen
[SPARK-25768][SQL] fix constant argument expecting UDAFs
## What changes were proposed in this pull request?
Without this PR some UDAFs like `GenericUDAFPercentileApprox` can throw
an exception because expecting a constant parameter (object inspector)
as a particular argument.
The exception is thrown because `toPrettySQL` call in `ResolveAliases`
analyzer rule transforms a `Literal` parameter to a `PrettyAttribute`
which is then transformed to an `ObjectInspector` instead of a
`ConstantObjectInspector`. The exception comes from `getEvaluator`
method of `GenericUDAFPercentileApprox` that actually shouldn't be
called during `toPrettySQL` transformation. The reason why it is called
are the non lazy fields in `HiveUDAFFunction`.
This PR makes all fields of `HiveUDAFFunction` lazy.
## How was this patch tested?
added new UT
Closes #22766 from peter-toth/SPARK-25768.
Authored-by: Peter Toth <> Signed-off-by: Wenchen
Fan <>
(cherry picked from commit f38594fc561208e17af80d17acf8da362b91fca4)
Signed-off-by: Wenchen Fan <>
(commit: 353d328041397762e12acf915967cafab5dcdade)
The file was modifiedsql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUDFs.scala (diff)
The file was modifiedsql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala (diff)
The file was modifiedbuild/mvn (diff)