osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When does Trigger.clear() get called?


Hi Averell,

> 1. Neither PURGE nor clear() removes the States (so the States must be explicitly cleared by the user).
Both PURGE and clear() remove state. The PURGE action removes the window state, i.e. the aggregate value. The clear() removes the window meta data including state in Trigger.

> 2. When an event for a window arrives after PURGE has been called, it is still be processed, and is treated as the first event of that window.
In most cases, the answer is yes. However, there is a chance that the event is not treated as the first one by the trigger, since PURGE clears the window state but the window meta data including the Trigger remain.

>  if I know that some keys would never have new events anymore, should/could I remove those streams corresponding to those keys
Yes. I think we can return FIRE_AND_PURGE.

Best, Hequn



On Sun, Oct 14, 2018 at 7:30 AM Averell <lvhuyen@xxxxxxxxx> wrote:
Hello Fabian,

So could I assume the followings?

1. Neither PURGE nor clear() removes the States (so the States must be
explicitly cleared by the user).
2. When an event for a window arrives after PURGE has been called, it is
still be processed, and is treated as the first event of that window.

And one related question: for keyed streams, if I know that some keys would
never have new events anymore, should/could I remove those streams
corresponding to those keys so that I can save some memory allocated to the
metadata?

Thanks and best regards,
Averell



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/