目录

1.窗口简介

2.基于time和count的windows

3.Tumbling Windows:窗口大小固定,不重叠

4.Sliding Windows


1.窗口简介

WindowAssigner is responsible for assigning each incoming element to one or more windows. 

如何将数据分配给窗口:有可能数据被分配到一个或者多个窗口

tumbling windows,:滚动窗口

sliding windows, :滑动窗口

session windows :会话窗口

global windows.:全局窗口

Time-based windows have a start timestamp (inclusive) and an end timestamp (exclusive) that together describe the size of the window. In code, Flink uses TimeWindow when working with time-based windows which has methods for querying the start- and end-timestamp and also an additional method maxTimestamp() that returns the largest allowed timestamp for a given windows.

window:[ start timestamp , end timestamp )左闭右开

maxTimestamp:也是属于window,它=(end timestamp-1)

2.基于time和count的windows

基于time:根据时间分配窗口

基于count:基于里面的元素的多少进行分配窗口

7-8窗口.

3.Tumbling Windows:窗口大小固定,不重叠

tumbling windows assigner assigns each element to a window of a specified window size. Tumbling windows have a fixed size and do not overlap. For example, if you specify a tumbling window with a size of 5 minutes, the current window will be evaluated and a new window will be started every five minutes as illustrated by the following figure.

7-8窗口.

4.Sliding Windows

每隔5分钟滑动一次窗口,窗口大小为10分钟

场景:每隔半个小时统计前一个小时的数据

The sliding windows assigner assigns elements to windows of fixed length. Similar to a tumbling windows assigner, the size of the windows is configured by the window size parameter. An additional window slide parameter controls how frequently a sliding window is started. Hence, sliding windows can be overlapping if the slide is smaller than the window size. In this case elements are assigned to multiple windows.

For example, you could have windows of size 10 minutes that slides by 5 minutes. With this you get every 5 minutes a window that contains the events that arrived during the last 10 minutes as depicted by the following figure.

7-8窗口.

 

 

 

 

 

 

 

相关文章:

  • 2021-09-07
  • 2021-06-15
  • 2021-06-14
  • 2021-10-07
  • 2022-02-08
  • 2022-01-27
猜你喜欢
  • 2021-12-31
  • 2021-05-24
  • 2021-05-21
  • 2021-12-09
  • 2021-12-16
  • 2022-12-23
相关资源
相似解决方案