luoyuxia created FLINK-27175:
--------------------------------
Summary: Fail to call Hive UDAF when the UDAF is with only one
parameter with array type
Key: FLINK-27175
URL: https://issues.apache.org/jira/browse/FLINK-27175
Project: Flink
Issue Type: Sub-task
Reporter: luoyuxia
When try to call Hive's collect_list function, it'll throw the following
exception:
{code:java}
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to
[Ljava.lang.Object;
at
org.apache.flink.table.functions.hive.conversion.HiveInspectors.lambda$getConversion$7f882244$1(HiveInspectors.java:201)
at
org.apache.flink.table.functions.hive.HiveGenericUDAF.accumulate(HiveGenericUDAF.java:185)
at LocalNoGroupingAggregateWithoutKeys$39.processElement(Unknown Source)
{code}
The reason is when the parameter is a single array, Flink calls
udf.accumulate(AggregationBuffer, Array[Double]), at this point java's var-args
will cast Array[Double] to Array[Object]and let it be Object... args.
{code:java}
public void accumulate(GenericUDAFEvaluator.AggregationBuffer acc, Object...
inputs) {code}
Then it will consider the elements in the array as parameters.
The exception will also happen for other similar Hive UDAF.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)