Re: 回复:Transfer information from one window to the next

Posted by Sonex on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Transfer-information-from-one-window-to-the-next-tp11738p11805.html

I solved the state you were talking about.

The solution would like like this (similar to what you wrote):

stream.keyBy(...).timeWindow(...)
    .apply(new WindowFunction() {
        public void apply(K key, W window, Iterable<IN> elements, Collector<OUT> out) {
            out.collect(new Tuple3<>(key, window, elements);
    })
    .keyBy(0)    // use the same key as the windows
    .mapWitState(...) // process the windows with shared information