window_time

window_time

window_time 介绍

window_time(window_column) - 从时间/会话窗口列中提取时间值,该值可用作窗口的事件时间值。提取的时间是(window.end - 1),这反映了聚合窗口具有排他性的上限的事实 - [开始时间,结束时间)。有关详细解释和示例,请参阅结构化流指南文档中的“事件时间上的窗口操作”。

参数:

window_column - 表示时间/会话窗口的列。

Examples:

> SELECT a, window.start as start, window.end as end, window_time(window), cnt FROM (SELECT a, window, count(*) as cnt FROM VALUES ('A1', '2021-01-01 00:00:00'), ('A1', '2021-01-01 00:04:30'), ('A1', '2021-01-01 00:06:00'), ('A2', '2021-01-01 00:01:00') AS tab(a, b) GROUP by a, window(b, '5 minutes') ORDER BY a, window.start);
  A1    2021-01-01 00:00:00 2021-01-01 00:05:00 2021-01-01 00:04:59.999999  2
  A1    2021-01-01 00:05:00 2021-01-01 00:10:00 2021-01-01 00:09:59.999999  1
  A2    2021-01-01 00:00:00 2021-01-01 00:05:00 2021-01-01 00:04:59.999999  1

Since: 3.4.0