Hi Jiazhi,
not sure if I got the question correctly, but the reduce function will be repeatedly applied to all elements in your tumbling window until only one final aggregate per key and window remains.
So in your case, you would get the user with the max id per UserBehavior(?) for each 30 secs window.
Please note that the window is calculated based on your watermark if you use event time [1]. If you use a watermark strategy to allow late events [2], your windows are triggered later by the allowed lateness.
So if you have a tumbling window of 30 secs and an allowed lateness of 10 secs, you would get window results after
40 secs: outputs results of [0:00, 0:30)
1:10: outputs results of [0:30, 0:60)
1:40: outputs results of [1:00, 1:30)
...
Feel free to ask more questions.
Deal All
I use the reduce operator after the TimeWindow operator, whether to output one element after all elements in the current window have been calculated according to reduce logic?
Thanks
Jiazhi
--
Arvid Heise | Senior Java Developer
Follow us @VervericaData
--
Join Flink Forward - The Apache Flink Conference
Stream Processing | Event Driven | Real Time
--
Ververica GmbH | Invalidenstrasse 115, 10115 Berlin, Germany
--
Ververica GmbH
Registered at Amtsgericht Charlottenburg: HRB 158244 B
Managing Directors: Timothy Alexander Steinert, Yip Park Tung Jason, Ji (Toni) Cheng