使用 RichAggregateFunction 时出现 Flink 错误 [英] Flink error on using RichAggregateFunction
问题描述
我正在尝试使用抽象的实现 RichAggregateFunction.我希望它变得富有"因为我需要将一些状态存储为聚合器的一部分,而且我可以这样做,因为我可以访问运行时上下文.我的代码如下所示:
I am trying to use an implementation of the abstract RichAggregateFunction in Flink. I want it to be "rich" because I need to store some state as part of the aggregator, and I can do this since I have access to the runtime context. My code is something like below:
stream.keyBy(...)
.window(GlobalWindows.create())
.trigger(...)
.aggregate(new MyRichAggregateFunction());
但是,我收到一个 UnsupportedOperationException 说
However, I get an UnsupportedOperationException saying
此聚合函数不能是 RichFunction.
This aggregation function cannot be a RichFunction.
我显然没有正确使用 RichAggregateFunction.有没有如何正确使用它的例子?或者我应该使用 ProcessFunction 进行此类操作?
I'm clearly not using RichAggregateFunction correctly. Is there any example of how to properly use it? Or should I be using a ProcessFunction for this sort of operation?
谢谢
推荐答案
这对您来说没有错.
Flink 不支持在组窗口中扩展 RichAggregateFunction
的函数.
Flink doesn't support functions that extend RichAggregateFunction
in a group window.
这篇关于使用 RichAggregateFunction 时出现 Flink 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!