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

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

问题描述

我读到,"..排序运算符必须缓冲它接收到的所有元素.然后,当它接收到水印时,它可以对时间戳低于水印的所有元素进行排序,并按已排序的顺序发出它们.这是正确的,因为水印表明没有更多元素可以到达并与已排序元素混在一起..."-

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.

一些操作员注册计时器(Windows,基于时间的联接,自定义实现).当操作者的时钟经过计时器注册的时间时,操作者将触发计时器.

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天全站免登陆