Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-26360 [Umbrella] Improvement for Hive Query Syntax Compatibility
  3. FLINK-27175

Fail to call Hive UDAF when the UDAF is with only one parameter with array type

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 1.16.0
    • None

    Description

      When try to call Hive's collect_list function, it'll throw the following exception:

       

      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) 

      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.

      public void accumulate(GenericUDAFEvaluator.AggregationBuffer acc, Object... inputs) 

      Then it will consider the elements in the array as parameters.

       

      The exception will also happen for other similar Hive UDAF.

      Attachments

        Issue Links

          Activity

            People

              luoyuxia luoyuxia
              luoyuxia luoyuxia
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: