flink 滑动窗口

create table tb_orders (
order_time TIMESTAMP(3),product_id STRING,price FLOAT,
WATERMARK FOR order_time AS order_time - INTERVAL '0' MINUTE
) with (
'connector' = 'kafka',
'scan.startup.mode' = 'earliest-offset',
'topic' = 'todd_fx_tumble01',
'properties.bootstrap.servers' = '10.1.2.3:9092',
'value.format' = 'json'
);
SELECT
HOP_START(order_time, INTERVAL '1' MINUTE, INTERVAL '10' MINUTE) AS win_start,
HOP_END(order_time, INTERVAL '1' MINUTE, INTERVAL '10' MINUTE) AS win_end,
SUM(price) AS total
FROM tb_orders
group by
HOP(order_time, INTERVAL '1' MINUTE, INTERVAL '10' MINUTE)
原文地址:https://www.cnblogs.com/tonggc1668/p/15684337.html