flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "施晓罡(星罡)" <xiaogang....@alibaba-inc.com>
Subject 回复:Transfer information from one window to the next
Date Mon, 20 Feb 2017 08:55:54 GMT
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 <kls.yannis@gmail.com>发送时间:2017年2月20日(星期一)
16:32收件人:user <user@flink.apache.org>主 题: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.
Mime
View raw message