luoyuxia commented on code in PR #19423: URL: https://github.com/apache/flink/pull/19423#discussion_r848990971
########## flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/HiveGenericUDAF.java: ########## @@ -173,6 +178,14 @@ public GenericUDAFEvaluator.AggregationBuffer createAccumulator() { public void accumulate(GenericUDAFEvaluator.AggregationBuffer acc, Object... inputs) throws HiveException { + // When the parameter of the function is (Integer, Array[Double]), Flink calls + // udf.eval(AggregationBuffer, Integer, Array[Double]), which is not a problem. + // But 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, So we need wrap it. + if (isArgsSingleArray) { + inputs = new Object[] {inputs}; + } if (!allIdentityConverter) { for (int i = 0; i < inputs.length; i++) { Review Comment: That's why we should make this change. When argsType is array, we will wrap the inputs to array so that the length will be 1. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org