1. 程式人生 > >Flink流式計算

Flink流式計算

Structured Streaming

  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

 

 Continuous Queries

Handling Event-time

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

Bob 12:54:00 ./xxx 到達時間14:01:00如何處理?

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已過期,資料被丟棄

&n