fhan created FLINK-22743:
----------------------------
Summary: Adding offsets for TUMBLE* functions for more flexible window start and end time.
Key: FLINK-22743
URL:
https://issues.apache.org/jira/browse/FLINK-22743 Project: Flink
Issue Type: Improvement
Components: Table SQL / Planner
Reporter: fhan
assume that we simply do some calculations using TUMBLE* functions like:
"select name,
TUMBLE_START(ts, INTERVAL '24' HOUR),
TUMBLE_END(ts, INTERVAL '24' HOUR),
count(*)
from source_table group by name, TUMBLE(ts, INTERVAL '24' HOUR);"
when ts = 2021-05-20 12:00:00,
the time of window start is 2021-05-20 08:00:00, and the end is 2021-05-21 08:00:00.
This is not flexible when we want to change the start or end time of the windows. for example, if we want to calculate from the middle of a day, so we need the window start time is 2021-05-20 12:00:00 and the end time is 2021-05-21 12:00:00.
we can add offset for TUMBLE* function for meeting these requirements.
for example, the query maybe:
"select name,
TUMBLE_START(ts, INTERVAL '24' HOUR, INTERVAL '4' HOUR),
TUMBLE_END(ts, INTERVAL '24' HOUR, INTERVAL '4' HOUR),
count(*)
from source_table group by name, TUMBLE(ts, INTERVAL '24' HOUR, INTERVAL '4' HOUR);"
the third parameter( INTERVAL '4' HOUR) here is the offset for TUMBLE* functions.
This is a real requirement in our business, so we wonder whether this is a common requirement and whether our solution make sense.
welcome for discussion.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)