This first question;
I want to learn time behaviour of window. Let's assume I'll process data every 2 seconds with the Processing time
, and the current time is 10:26:25.169
. At this time, I deployed job.
In this case, Will each time window be rounded to 0, 2, 4 and so on seconds? Like below;
10:26:24.000 - 10:26:26.000
10:26:26.000 - 10:26:28.000
As you can see, i've deploy job at 10:26:25.169
, but flink did round window by 2 seconds. Is that right?
If not, Does windows works like below?;
10:26:25.169 - 10:26:27.169
10:26:27.169 - 10:26:29.169
Which one is true? Is this behaviour can change when I use event time
instead of processing time
?
The second question;
I want to keep state for each key. For that i can use richFlatMap function or keyedProcessFunction. But i wonder that can I manage state using above functions after applied window? For example;
// in this case i can manage state by key
ds.keyBy(_.field).process(new MyStateFunction)
// in this case, can i manage state after window for the same key?
ds.keyBy(keyExtractorWithTime)
.window(new MyWindowFunction)
.reduce(new myRedisFunction)
.process(new MyStateFunction)