当前位置:网站首页>Flink window table valued function
Flink window table valued function
2022-06-11 12:11:00 【But don't ask about your future】
List of articles
Preface
from 1.13 Version start ,Flink Start using window table valued functions (Windowing table-valued functions,Windowing TVFs) To define the window . The window table valued function is Flink Defined polymorphic table functions (PTF), You can expand the table and return
Scroll the window (Tumbling Windows)
The sliding window (Hop Windows, Jump window )
Accumulation window (Cumulate Windows)
Session window (Session Windows, At present, it has not fully supported )
At the window TVF In the return value of , Remove all columns from the original table , Additional to describe the window has also been added 3 Columns : Window start point (window_start)、 Window end point (window_end)、 Window time (window_time). Window time refers to the time attribute in the window , Its value is equal to window_end - 1ms, So it is equivalent to the maximum timestamp of the data contained in the window
1. Scroll the window (TUMBLE)
stay SQL By calling TUMBLE() Function to declare a scrolling window , Only one core parameter is window size (size). stay SQL The counting window is not considered in , So a scrolling window is a scrolling time window , The current time attribute field needs to be passed into the parameter ; in addition , window TVF It's essentially a table function , The table can be extended , Therefore, the table of the current query should also be passed in as a whole
TUMBLE(TABLE EventTable, DESCRIPTOR(ts), INTERVAL '1' HOUR)
2. The sliding window (HOP)
The use of sliding windows is similar to scrolling windows , The frequency of statistical output can be controlled by setting the sliding step . stay SQL By calling HOP() To declare a sliding window ; In addition to passing in the table name 、 Outside of time attribute , You also need to pass in the window size (size) And sliding step size (slide) Two parameters
HOP(TABLE EventTable, DESCRIPTOR(ts), INTERVAL '5' MINUTES, INTERVAL '1' HOURS));
Time based attribute ts, In the table EventTable Created on with size 1 Hours of sliding window , Every time 5 Slide once in minutes . The third parameter after the time attribute field is the step size (slide), The fourth parameter is the window size (size)
3. Accumulation window (CUMULATE)
The cumulative window is the window TVF New window function in , It will carry out cumulative calculation in a certain statistical period . There are two core parameters in the accumulation window : Maximum window length (max window size) And cumulative step size (step). The so-called maximum window length is the statistical period , The ultimate goal is to count the data during this period 
CUMULATE(TABLE EventTable, DESCRIPTOR(ts), INTERVAL '1' HOURS, INTERVAL '1' DAYS))
Time based attribute ts, In the table EventTable A statistical period is defined as 1 God 、 The cumulative step is 1 Cumulative window of hours . Note that the third parameter is the step size step, The fourth parameter is the maximum window length
边栏推荐
猜你喜欢

【LeetCode】494. Objective and (2 wrong questions)

刷题笔记(十三)--二叉树:前中后序遍历(复习)

Hang up the interviewer

Use compiler option '--downleveliteration' to allow iteration of iterations

.net core 抛异常对性能影响的求证之路

Guangdong municipal safety construction data management software 2022 new forms are coming

SQLServer连接数据库(中文表)部分数据乱码问题解决

你管这破玩意儿叫 MQ?

When a pure data service machine calls in, it falls back to 2g/3g

Intl.NumberFormat 设置数字格式
随机推荐
【LeetCode】1049. Weight of the last stone II (wrong question 2)
2020-07 学习笔记整理
C# 读取txt文件生成Word文档
Live app development to determine whether the user is logging in to the platform for the first time
Deep learning and CV tutorial (14) | image segmentation (FCN, segnet, u-net, pspnet, deeplab, refinenet)
Gestion de projets logiciels 7.1. Concept de base du calendrier du projet
Adjust the array order so that odd numbers precede even numbers (C language)
Where is it safer to open an account for soda ash futures? How much capital is needed for a transaction?
SQLServer连接数据库(中文表)部分数据乱码问题解决
Flink data flow graph, parallelism, operator chain, jobgraph and executiongraph, task and task slot
Notes on brushing questions (13) -- binary tree: traversal of the first, middle and last order (review)
13、ReentrantLock、ReentrantReadWriteLock、StampedLock讲解
[JUC supplementary] immutable object, shared meta mode, final principle
flink 部署模式和运行时架构(会话模式、单作业模式、应用模式,JobManager、TaskManager,YARN 模式部署以及运行时架构)
一般运维架构图
JS addition and multiplication error resolution number precision
Splunk最佳实践之workload managment
gocron 定时任务管理平台
刷题笔记(十四)--二叉树:层序遍历和DFS,BFS
程序员常用的命令符