如何在 FlinkSQL 的 SESSION window 中获取 LAST_VALUE?

How to get LAST_VALUE in a SESSION window in FlinkSQL?

我在 Flink SQL (1.13) 中使用会话 windows。 有没有办法(必须在 SQL 中,没有 UDF 等)来获取某个字段的最后一个值(换句话说:这将是 window_end 处的值)? 我正在尝试:

SELECT user_account_id, 
       SESSION_START(request_timestamp, INTERVAL '30' MINUTE) AS window_start, 
       SESSION_END(request_timestamp, INTERVAL '30' MINUTE) AS window_end,
       LAST_VALUE(package)
GROUP BY SESSION(request_timestamp, INTERVAL '30' MINUTE), user_account_id

但我收到错误消息:

Could not find an implementation method 'merge' in class 'org.apache.flink.table.planner.functions.aggfunctions.LastValueAggFunction' for function 'LAST_VALUE' that matches the following signature:
void merge(org.apache.flink.table.data.RowData, java.lang.Iterable)

我想在这里使用 window 函数 (OVER(...)) 是行不通的。 任何提示表示赞赏!

我得到的答案是目前还不支持。 解决方法是创建自定义 user-defined aggregate function (UDAGG) 。 除此之外,该功能还有一个新的 Jira