问题
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());
However, I get an UnsupportedOperationException saying
This aggregation function cannot be a RichFunction.
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?
Thanks
回答1:
This is not a mistake on your side.
Flink doesn't support functions that extend RichAggregateFunction
in a group window.
来源:https://stackoverflow.com/questions/47437207/flink-error-on-using-richaggregatefunction