Apache Flink:count窗口返回一个GlobalWindow



当我将countWindow方法应用于KeyedStream时,我得到的是GlobalWindow,而不是countWindow。有人知道为什么吗?我在Flink文档中找不到任何内容。

谢谢!

WindowedStream<Share, String, GlobalWindow> windowedStream2 = keyed.countWindow(100, 10);

Flink的DataStream API中的计数窗口非常简单,它们不需要一个具有基本GlobalWindow窗口分配器之外的任何智能的窗口分配器,即将每个事件放入窗口中。以下是您正在使用的实现:

/**
* Windows this {@code KeyedStream} into sliding count windows.
*
* @param size The size of the windows in number of elements.
* @param slide The slide interval in number of elements.
*/
public WindowedStream<T, KEY, GlobalWindow> countWindow(long size, long slide) {
return window(GlobalWindows.create())
.evictor(CountEvictor.of(size))
.trigger(CountTrigger.of(slide));
}

CountWindow及其关联类是Table API运行时的一部分,不被DataStream API使用。

最新更新