2019-01-16 19:24:21 +00:00
|
|
|
-- this test cannot pass without the new DFA matching algorithm of sequenceMatch
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS sequence;
|
2019-01-16 19:24:21 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE sequence
|
2019-01-16 19:24:21 +00:00
|
|
|
(
|
|
|
|
userID UInt64,
|
|
|
|
eventType Enum8('A' = 1, 'B' = 2, 'C' = 3),
|
|
|
|
EventTime UInt64
|
|
|
|
)
|
|
|
|
ENGINE = Memory;
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO sequence SELECT 1, number = 0 ? 'A' : (number < 1000000 ? 'B' : 'C'), number FROM numbers(1000001);
|
2019-01-16 19:24:21 +00:00
|
|
|
|
|
|
|
SELECT userID
|
2019-04-16 14:13:13 +00:00
|
|
|
FROM sequence
|
2019-01-16 19:24:21 +00:00
|
|
|
GROUP BY userID
|
|
|
|
HAVING sequenceMatch('(?1).*(?2).*(?3)')(toDateTime(EventTime), eventType = 'A', eventType = 'B', eventType = 'C');
|
|
|
|
|
|
|
|
SELECT userID
|
2019-04-16 14:13:13 +00:00
|
|
|
FROM sequence
|
2019-01-16 19:24:21 +00:00
|
|
|
GROUP BY userID
|
|
|
|
HAVING sequenceMatch('(?1).*(?2).*(?3)')(toDateTime(EventTime), eventType = 'A', eventType = 'B', eventType = 'A');
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE sequence;
|