Hi!

As far as I know, returning an array from the getValue method containing
external data format is OK. Flink will do the conversion for you.

Are you faced with any exception when using this array_agg? If yes what's
the exception stack?

You can also open a JIRA ticket to require a built-in support for
array_agg, as this function exists in many data ware houses.

Yuval Itzchakov <yuva...@gmail.com> 于2021年8月23日周一 下午7:38写道:

> Hi,
>
> I'm trying to implement a generic ARRAY_AGG UDF function (identical to the
> one that exists in many data WHs, e.g
> https://docs.snowflake.com/en/sql-reference/functions/array_agg.html) to
> utilize in Flink SQL.
>
> Taking reference from CollectAggFunction
> <https://github.com/apache/flink/blob/master/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/aggfunctions/CollectAggFunction.java>,
> I tried using ArrayData to generate a GenericArrayData as an output type.
> The problem with is I need a way to convert from the external format being
> used in the UDF (e.g String, Integer) to the internal representation
> required by Flink (i.e. StringData). I haven't found a straight way of
> going about that.
>
> Here is a gist of the implementation
> <https://gist.github.com/YuvalItzchakov/5cc7b076d31d73e5c1f9b7b72b3c624b>.
> Would appreciate any help on how to tackle this.
>
> --
> Best Regards,
> Yuval Itzchakov.
>

Reply via email to