Hi Pouria,

Table aggregate functions are not currently supported in SQL, they have
been introduced in the Table API as per FLIP-29:
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=97552739.

Best,
Junrui

Pouria Pirzadeh <pouria.pirza...@gmail.com> 于2024年3月13日周三 02:06写道:

> Hi,
> I am using the SQL api on Flink 1.18 and I am trying to write a SQL query
> which uses a 'user-defined table aggregate function' (UDTAGG). However, the
> documentation
> <https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/table/functions/udfs/>
> [1] only includes a Table API example when it comes to UDTAGG. I tried
> writing the query similar to a regular SQL query with a GROUP BY clause and
> it does not work.
>
> Can someone show how the below example query from the documentation can be
> written in SQL?
>
> env
>   .from("MyTable")
>   .groupBy($("myField"))
>   .flatAggregate(call("Top2", $("value")).as("value", "rank"))
>   .select($("myField"), $("value"), $("rank"));
>
>
>
>
>
>
>
> [1]
> https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/table/functions/udfs/
>
>

Reply via email to