Reputation: 957
I was trying to build something like a window that behaves like a sliding window and:
The parameters of the window would be:
The idea I was trying involved having a sliding window with:
The question now is: how to filter events in order to ignore the ones before "delay"? I've thought of:
Having an aggregator that only sums the value if the event TS is between the correct bounds. This is not possible because aggregators in windows can't be a RichAggregateFunction
and therefore I have no access to the window metadata. Is this assumption correct?
Having pre-aggregation with:
getRuntimeContext().getState()
is not maintained per window and therefore can't be used. Is this assumption correct?Are there any alternatives I'm missing or is any of the assumptions incorrect?
Upvotes: 0
Views: 623
Reputation: 43409
I may have gotten a bit lost in the details, but maybe I see a solution.
Seems like you could use a custom Trigger that fires twice, before and after the delay. Then use a ProcessWindowFunction with incremental aggregation, and use per-window state to hold the count of the first firing (and then subtract later).
Given the complexity in putting that all together, a solution based on a ProcessFunction and managed state might be simpler.
Upvotes: 1