apache-flink - 如何在 FlinkSQL 的 SESSION 窗口中获取 LAST_VALUE?
问题描述
我在 Flink SQL (1.13) 中使用会话窗口。有没有办法(必须在 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)
我猜想在这里使用窗口函数 ( OVER(...)
) 是行不通的。任何提示表示赞赏!
解决方案
我得到的答案是这还不被支持。一种解决方法是创建自定义用户定义的聚合函数 (UDAGG)。除此之外,该功能还有一个新的Jira。
推荐阅读
- powershell - 远程 MSI 安装成功,但经审核,无法向其他应用程序注册
- azure - Azure 预留实例 - 检查分配
- excel - 编译 ExcelDNA解包
- typescript - 对于沙盒,有没有办法直接在浏览器中运行 TypeScript?
- python - Python Tkinter StringVar() 未打包在 JSON 请求中
- ios - 禁用或更新 Apple ID 设置,或在模拟器上单击“Not Now”
- c# - 从继承自另一个类的类中获取数据
- javascript - 通过遍历列表来更改图像的 src
- java - Java 扫描器和 if-else 语句
- php - php钠函数中的ENCONDING CHARACTERS问题