Apache Flink中的空窗口 [英] Empty windows in Apache Flink

查看:75
本文介绍了Apache Flink中的空窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有事件时间的数据流,是否可以在Apache Flink中发射没有数据的窗口?例如,当滚动窗口大小为 15分钟时,如果在 [(0,15),(15,20),...] .

I have a datastream with event time, is it possible to emit windows with no data in Apache Flink? For example with a tumbling window size of 15 minutes it would be ideal if I could empty windows if they have no events in the time period of [(0, 15), (15, 20), ...] for example.

推荐答案

否,这是不可能的.Flink的窗口运算符仅在添加第一个事件时才创建一个窗口.

No, this is not possible. Flink's window operator only creates a window when the first event is added to it.

不为空窗口生成结果的原因是,窗口通常是在键控流上定义的(如果不对键控流进行键控,则不可能并行处理该窗口).如果Flink将为键控流上的空窗口发出记录,则它将需要为每个可能的键值发出结果.由于存在太多可能的键,因此这是不可能的.

The reason for not emitting results for empty windows is, that windows are typically defined on a keyed stream (without keying a stream it is not possible to process the window in parallel). If Flink would emit records for empty windows on a keyed stream, it would need to emit a result for every possible key value. Since there are way too many possible keys, this is not possible.

这篇关于Apache Flink中的空窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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