You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/04/11 11:46:00 UTC

[jira] [Updated] (FLINK-27175) Fail to call Hive UDAF when the UDAF is with only one parameter with array type

     [ https://issues.apache.org/jira/browse/FLINK-27175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated FLINK-27175:
-----------------------------------
    Labels: pull-request-available  (was: )

> 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
>            Priority: Major
>              Labels: pull-request-available
>
> 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)