回复:Transfer information from one window to the next

Posted by 施晓罡(星罡) on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Transfer-information-from-one-window-to-the-next-tp11738.html

Hi sonex

I think you can accomplish it by using a PassThroughFunction as the apply function and processing the elements in a rich flatMap function followed.  You can keep the information in the flatmap function (via states) so that they can be shared among different windows.

The program may look like

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
    .flatMap(...) // process the windows with shared information

Regards,
Xiaogang


------------------------------------------------------------------
发件人:Sonex <[hidden email]>
发送时间:2017年2月20日(星期一) 16:32
收件人:user <[hidden email]>
主 题:Transfer information from one window to the next

val stream =
inputStream.assignAscendingTimestamps(_.eventTime).keyBy(_.inputKey).timeWindow(Time.seconds(3600),Time.seconds(3600))

stream.apply{...}

Given the above example I want to transfer information (variables and
values) from the current apply function to the apply function of the next
window (of course with the same key).

How can I do that?



--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Transfer-information-from-one-window-to-the-next-tp11737.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.