flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anwar Rizal <anriza...@gmail.com>
Subject Doubt about window and count trigger
Date Thu, 26 Nov 2015 22:40:18 GMT
Hi all,

>From the documentation:
"The Trigger specifies when the function that comes after the window clause
(e.g., sum, count) is evaluated (“fires”) for each window."

So, basically, if I specify:

keyedStream
    .window(TumblingTimeWindows.of(Time.of(5, TimeUnit.SECONDS))
    .trigger(CountTrigger.of(100))


The execution of the window function is triggered when the count
reaches 100 in the time window of 5 seconds. If you have a system that
never reaches 100 in 5 seconds, basically you will never have the
window fired.


My question is, what would be the best option to have behavior as follow:

The execution of the window function is triggered when 5 seconds is
reached or 100 events are received before 5 seconds.


I think of implementing my own trigger that looks like CountTrigger,
but that will fire also when the end of time window is reached (at the
moment, it just returns Continue, instead of Fired). But maybe there's
a better way ?

Is there a reason why CountTrigger is implemented as it is implemented
today, and not as I described above (5 seconds or 100 events reached,
whichever comes first).


Thanks,

Anwar.

Mime
View raw message