Hey everyone :wave: — I have a question about usin...
# troubleshooting
f
Hey everyone 👋 — I have a question about using a
TumblingProcessingTimeWindow
and a reduce function to ensure only a single event within my window is emitted at a time 🧵.
I was wondering if an approach like this would be sufficient?
Copy code
.keyBy { it.key }
.window(TumblingProcessingTimeWindows.of(Duration.ofSeconds(1)))
.reduce { a, b ->
    b
}
However, it’s not clear to me if this reduce function will be called if there is only a single event within my window. Functionally, even if there is only a single event produced within my window I would like to emit it. If there are no events nothing should be omitted and if there are more than 1 events the latest version should be emitted.
e
It should work as you would expect. The reduce function considers its first element as the result as long as no other input gets into it. Have you tried to test this scenario and got an unexpected result?
f
Thank you, yes it works. I think the issue was on my end expecting this data to be ordered. I see in the docs now that ordering inside a window is not guaranteed