欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Flink流式计算

程序员文章站 2022-03-22 12:52:33
Flink流式计算原理,包括Structured Streaming,Continuous Queries,Handling Event-time,Handling Late Data,Watermarks ......

structured streaming

Flink流式计算

  1. a stream is converted into a dynamic table.
  2. a continuous query is evaluated on the dynamic table yielding a new dynamic table.
  3. the resulting dynamic table is converted back into a stream.

defining a table on a stream

 

Flink流式计算

 continuous queries

Flink流式计算

handling event-time

Flink流式计算

tumble(time_attr, interval),定义一个个连续的时间窗口,这样每行数据只可能出现在一个窗口内,窗口之间不会出现重叠defines a tumbling time window. a tumbling time window assigns rows to non-overlapping, continuous windows with a fixed duration (interval). for example, a tumbling window of 5 minutes groups rows in 5 minutes intervals. tumbling windows can be defined on event-time (stream + batch) or processing-time (stream).
tumble_start(time_attr, interval). 返回时间窗口的下限时间戳.returns the timestamp of the inclusive lower bound of the corresponding tumbling, hopping, or session window.

handling late data

Flink流式计算

bob 12:54:00 ./xxx 到达时间14:01:00如何处理?

Flink流式计算

watermarks定义在ctime,允许延迟2hour, 14:00:00-2hour<13:00:00,窗口12:00:00-13::00:00仍保持
watermarks定义在ctime,允许延迟5min,14:00:00-5min>13:00:00,时间窗口12:00:00-13:00:00已过期,数据被丢弃