gcandal
gcandal

Reputation: 957

How to have a true sliding window that ignores recent events?

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:

Are there any alternatives I'm missing or is any of the assumptions incorrect?

Upvotes: 0

Views: 623

Answers (1)

David Anderson
David Anderson

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

Related Questions