add tests 01646_fix_window_funnel_inconistency.

This commit is contained in:
HuFuwang 2021-01-10 07:49:11 +08:00
parent 21659e8aa5
commit d0378395c5
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,3 @@
2 1
---
2 1

View File

@ -0,0 +1,49 @@
DROP TABLE IF EXISTS trend;
CREATE TABLE trend
(
`event_date` Date,
`user_id` Int32,
`timestamp` DateTime,
`eventID` Int32,
`product` String
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(event_date)
ORDER BY user_id;
insert into trend values ('2019-01-28', 1, '2019-01-29 10:00:00', 1004, 'phone') ('2019-01-28', 1, '2019-01-29 10:00:00', 1003, 'phone') ('2019-01-28', 1, '2019-01-28 10:00:00', 1002, 'phone');
SELECT
level,
count() AS c
FROM
(
SELECT
user_id,
windowFunnel(6048000000000000)(timestamp, eventID = 1004, eventID = 1003, eventID = 1002) AS level
FROM trend
GROUP BY user_id
)
GROUP BY level
ORDER BY level ASC;
SELECT '---';
TRUNCATE TABLE trend;
insert into trend values ('2019-01-28', 1, '2019-01-29 10:00:00', 1003, 'phone') ('2019-01-28', 1, '2019-01-29 10:00:00', 1004, 'phone') ('2019-01-28', 1, '2019-01-28 10:00:00', 1002, 'phone');
SELECT
level,
count() AS c
FROM
(
SELECT
user_id,
windowFunnel(6048000000000000)(timestamp, eventID = 1004, eventID = 1003, eventID = 1002) AS level
FROM trend
GROUP BY user_id
)
GROUP BY level
ORDER BY level ASC;
DROP TABLE trend;