Flink中的水印和触发器有什么区别? [英] What's the difference between a watermark and a trigger in Flink?

查看:29
本文介绍了Flink中的水印和触发器有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到,..排序运算符必须缓冲它收到的所有元素.然后,当它收到水印时,它可以对时间戳低于水印的所有元素进行排序,并按排序顺序发出它们.这是正确的,因为水印表明不会有更多元素可以到达,这些元素将与已排序的元素混合......" - https://cwiki.apache.org/confluence/display/FLINK/Time+and+Order+in+Streams

I read that, "..The ordering operator has to buffer all elements it receives. Then, when it receives a watermark it can sort all elements that have a timestamp that is lower than the watermark and emit them in the sorted order. This is correct because the watermark signals that not more elements can arrive that would be intermixed with the sorted elements..." - https://cwiki.apache.org/confluence/display/FLINK/Time+and+Order+in+Streams

因此,水印似乎充当了以下操作员的信号,用于开始处理.我想,这也是触发器所做的.两者有什么区别?

Hence, it seems that the watermark serves as a signal to the following operator, for beginning processing. I guess, that's what also a Trigger does. What's the difference between the two?

推荐答案

您可以将水印视为告诉操作员现在是什么(事件)时间的特殊记录.当操作员收到水印时,它会将水印与其当前时间以及从不同流分区收到的其他水印进行比较.根据比较,操作员提前自己的时钟.

You can think of watermarks as special records that tell an operator what (event-) time it is. When an operator receives a watermark, it compares the watermark with its current time and other watermarks it received from different stream partitions. Depending on the comparison, the operator advances its own clock.

一些运算符注册计时器(窗口、基于时间的连接、自定义实现).当操作员的时钟经过定时器注册的时间时,操作员触发定时器.

Some operators register timers (windows, time-based joins, custom implementations). An operator triggers a timer when the clock of the operator passes the time for which the timer was registered.

所以,水印和计时器是两个不同的东西.水印告诉操作员现在是什么时间,操作员在正确的时间点触发计时器.

So, watermarks and timers are two different things. Watermarks tell an operator what time it is and the operator triggers a timer at the right point in time.

这篇关于Flink中的水印和触发器有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆