Searches the longest event chain happened in order (event1, event2, ... , eventN) along the timestamp_column with length of window.
The function works according to the algorithm:
window_funnel(window, mode, timestamp_column, event1, event2, ... , eventN)
CREATE TABLE windowfunnel_test ( `xwho` varchar(50) NULL COMMENT 'xwho', `xwhen` datetime COMMENT 'xwhen', `xwhat` int NULL COMMENT 'xwhat' ) DUPLICATE KEY(xwho) DISTRIBUTED BY HASH(xwho) BUCKETS 3 PROPERTIES ( "replication_num" = "1" ); INSERT into windowfunnel_test (xwho, xwhen, xwhat) values ('1', '2022-03-12 10:41:00', 1), ('1', '2022-03-12 13:28:02', 2), ('1', '2022-03-12 16:15:01', 3), ('1', '2022-03-12 19:05:04', 4); select window_funnel(3600 * 3, 'default', t.xwhen, t.xwhat = 1, t.xwhat = 2 ) AS level from windowfunnel_test t; | level | |---| | 2 |
WINDOW,FUNCTION,WINDOW_FUNNEL