简体   繁体   English

Flink Tumble Window 触发时间

[英]Flink Tumble Window Trigger time

I am using Flink to aggregate the data from kafka topics.我正在使用 Flink 聚合来自 kafka 主题的数据。 I am using a tumble window of 1 hour, with the time characteristic set to Event Time.我正在使用 1 小时的翻滚窗口,时间特征设置为事件时间。 I am also using AscendingTimestampExtractor and assigning watermarks to the input based on a particular field value in json.我还使用 AscendingTimestampExtractor 并根据 json 中的特定字段值为输入分配水印。

env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);

We can assume that the JSON field used for watermarking has a time value similar to that of system clock.我们可以假设用于水印的 JSON 字段具有类似于系统时钟的时间值。

If I deploy the job at 3:25 pm, when can I expect the flink aggregated output?如果我在下午 3:25 部署作业,我什么时候可以期待 flink 聚合输出? Will it be at 4:00 pm, 5:00 pm ... or 3:25 pm -4:25 pm, 4:25 pm -5 :25 pm....是在 4:00 pm、5:00 pm ... 还是 3:25 pm -4:25 pm、4:25 pm -5:25 pm....

Flink's windows are aligned with the epoch (rather than the first event), so if the job is deployed at 3:25, the first window will be about the interval from 3:00:00 to 3:59:59.999, and will be produced soon thereafter (based on the watermarking). Flink 的窗口是与 epoch 对齐的(而不是第一个事件),所以如果作业在 3:25 部署,第一个窗口大约是 3:00:00 到 3:59:59.999 的间隔,并且将是此后不久产生(基于水印)。

Note that you can pass an offset to the constructor, so if wanted the windows to end at 10 minutes past the hour instead, you could do this by specifying请注意,您可以将偏移量传递给构造函数,因此如果希望窗口在每小时 10 分钟后结束,您可以通过指定

.window(TumblingEventTimeWindows.of(Time.hours(1), Time.minutes(10)))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM