窗格和 window apache beam 之间的区别

Difference between a pane and window apache beam

窗格和window有什么区别?传入的元素被分组为 windows。那么一个窗格包含什么?

我从 beam 文档中获取了以下代码

.of(new DoFn<String, String>() {
     public void processElement(@Element String word, PaneInfo paneInfo) {
  }})

每个元素属于一个窗格吗?还是多个窗格?需要一个简单的类比来理解 pane 和 window

窗口策略根据事件时间对数据进行分区。一个元素可以属于多个windows(滑动windows).

窗格由每个 window 的触发器触发。 window 可以发出多个窗格,具体取决于触发触发器的次数。如果没有触发器,当 window 超出范围时它只会触发一个窗格。

然后每个窗格发出的数据可以通过累积模式聚合在一起。

您可以将 window 视为 class,将窗格视为 class 的实例。一个元素可以属于一个或多个 windows 并被 windows 用于发出窗格。

有关 windows 和触发器的编程 guide 中可以找到更多详细信息。

When you specify a trigger, you must also set the the window’s accumulation mode. When a trigger fires, it emits the current contents of the window as a pane. Since a trigger can fire multiple times, the accumulation mode determines whether the system accumulates the window panes as the trigger fires, or discards them.

To set a window to accumulate the panes that are produced when the trigger fires, invoke.accumulatingFiredPanes() when you set the trigger. To set a window to discard fired panes, invoke .discardingFiredPanes().