mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Added a test from Andrey #2641
This commit is contained in:
parent
0782052768
commit
c5c1a8def7
@ -0,0 +1,3 @@
|
||||
v1 o1 ['s2','s1']
|
||||
v1 o2 ['s4']
|
||||
v2 o3 ['s5','s3']
|
18
tests/queries/0_stateless/01116_asof_join_dolbyzerr.sql
Normal file
18
tests/queries/0_stateless/01116_asof_join_dolbyzerr.sql
Normal file
@ -0,0 +1,18 @@
|
||||
CREATE TEMPORARY TABLE sessions (date DateTime, visitorId String, sessionId String);
|
||||
CREATE TEMPORARY TABLE orders (date DateTime, visitorId String, orderId String);
|
||||
|
||||
INSERT INTO sessions VALUES ('2018-01-01 00:00:00', 'v1', 's1'), ('2018-01-02 00:00:00', 'v1', 's2'), ('2018-01-03 00:00:00', 'v2', 's3'), ('2018-01-04 00:00:00', 'v1', 's4'), ('2018-01-05 00:00:00', 'v2', 's5'), ('2018-01-06 00:00:00', 'v3', 's6');
|
||||
INSERT INTO orders VALUES ('2018-01-03 00:00:00', 'v1', 'o1'), ('2018-01-05 00:00:00', 'v1', 'o2'), ('2018-01-06 00:00:00', 'v2', 'o3');
|
||||
|
||||
SELECT
|
||||
visitorId,
|
||||
orderId,
|
||||
groupUniqArray(sessionId)
|
||||
FROM sessions
|
||||
ASOF INNER JOIN orders ON (sessions.visitorId = orders.visitorId) AND (sessions.date <= orders.date)
|
||||
GROUP BY
|
||||
visitorId,
|
||||
orderId
|
||||
ORDER BY
|
||||
visitorId ASC,
|
||||
orderId ASC;
|
Loading…
Reference in New Issue
Block a user