Does anybody know why this is emitting a very larg...
# troubleshooting
d
Does anybody know why this is emitting a very large amount of events relative to input. I inputted 2 events and ended up with over a thousand elements in my sink. What I was expecting from this was that, when an event came in, it would run my reduce over ever event 12 hours older than it (give or take a minute or two) and old events would slide off every minute or so.
❤️ 1
t
Windows in Flink are a little tricky. If an element with timestamp
t
comes in, all windows containing
t
are created. In your case this means
12h * 60m - 1m = 719 windows
. Because of your custom trigger, the windows fire for each element coming in. That would make 1438 output elements for you. On a related note, supplying a custom trigger deactivated the default trigger of the window. Your sliding windows will therefore not close as expected. You need to replicate the behavior of the default event time trigger in your custom one to do that.
d
That makes a lot of sense. So to get the expected behavior, I'd have to identify the relevant window somehow, fire for that one but not for the others and then purge it when the event timer roles around.
t
Could be an option. You should be able to check the window boundaries in the
window
argument of
onElement
. Firing only if the window end is closer than one minute to the elements event time should do the trick.