ProcessWindowFunction#process is passed a Context object that contains public abstract KeyedStateStore windowState(); public abstract KeyedStateStore globalState();
which are available for you to use for custom state. Whatever you store in windowState is scoped to a window, and is cleared when that window is cleared (this is only useful for windows that may have multiple firings). On the other hand, state that you create in globalState is retained indefinitely. If you have an unbounded key space with keys that become stale (such as sessionIds), you will want to use state TTL [1] on the state descriptor(s) to arrange for its eventual deletion. [1] https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/state.html#state-time-to-live-ttl Regards, David On Sat, Jul 18, 2020 at 2:30 PM ゞ野蠻遊戲χ <zhoujiazhi1...@vip.qq.com> wrote: > Dear all: > > How do I clear custom state in ProcessWindowsFunction? Because there is no > onTimer method in ProcessAllWindowFunction. > > Thanks > Jiazhi >