mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix retention function
This commit is contained in:
parent
97c532c0f0
commit
02e9cc8f2d
@ -104,7 +104,6 @@ public:
|
||||
if (event)
|
||||
{
|
||||
this->data(place).add(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
0 [1,1]
|
||||
1 [1,1]
|
||||
2 [1,1]
|
||||
3 [1,1]
|
||||
4 [1,1]
|
||||
----------
|
||||
0 [1,1,1]
|
||||
1 [1,1,1]
|
||||
2 [1,1,1]
|
||||
3 [1,1,1]
|
||||
4 [1,1,1]
|
||||
----------
|
||||
0 [1,1,1]
|
||||
1 [0,0,0]
|
||||
2 [1,1,1]
|
||||
3 [0,0,0]
|
||||
4 [1,1,1]
|
@ -0,0 +1,14 @@
|
||||
DROP TABLE IF EXISTS retention_test;
|
||||
CREATE TABLE retention_test(date Date, uid Int32)ENGINE = Memory;
|
||||
|
||||
INSERT INTO retention_test SELECT '2018-08-06', number FROM numbers(8);
|
||||
INSERT INTO retention_test SELECT '2018-08-07', number FROM numbers(6);
|
||||
INSERT INTO retention_test SELECT '2018-08-08', number FROM numbers(7);
|
||||
|
||||
SELECT uid, retention(date = '2018-08-06', date = '2018-08-07') AS r FROM retention_test WHERE date IN ('2018-08-06', '2018-08-07') GROUP BY uid ORDER BY uid LIMIT 5;
|
||||
SELECT '----------';
|
||||
SELECT uid, retention(1, date = '2018-08-06', date = '2018-08-07') AS r FROM retention_test WHERE date IN ('2018-08-06', '2018-08-07') GROUP BY uid ORDER BY uid LIMIT 5;
|
||||
SELECT '----------';
|
||||
SELECT uid, retention(uid % 2 = 0, date = '2018-08-06', date = '2018-08-07') AS r FROM retention_test WHERE date IN ('2018-08-06', '2018-08-07') GROUP BY uid ORDER BY uid LIMIT 5;
|
||||
|
||||
DROP TABLE IF EXISTS retention_test;
|
Loading…
Reference in New Issue
Block a user