2016-11-01 21:10:22 +00:00
|
|
|
DROP TABLE IF EXISTS test.aggregates;
|
|
|
|
CREATE TABLE test.aggregates (d Date, s AggregateFunction(uniq, UInt64)) ENGINE = MergeTree(d, d, 8192);
|
|
|
|
|
|
|
|
INSERT INTO test.aggregates
|
2017-01-20 06:05:27 +00:00
|
|
|
SELECT toDate('2016-10-31') AS d, uniqState(toUInt64(arrayJoin(range(100)))) AS s
|
|
|
|
UNION ALL
|
2016-11-01 21:10:22 +00:00
|
|
|
SELECT toDate('2016-11-01') AS d, uniqState(toUInt64(arrayJoin(range(100)))) AS s;
|
|
|
|
|
|
|
|
INSERT INTO test.aggregates SELECT toDate('2016-10-31') + number AS d, uniqState(toUInt64(arrayJoin(range(100)))) AS s FROM (SELECT * FROM system.numbers LIMIT 2) GROUP BY d;
|
|
|
|
|
|
|
|
SELECT d, uniqMerge(s) FROM test.aggregates GROUP BY d ORDER BY d;
|
|
|
|
|
2017-01-20 06:05:27 +00:00
|
|
|
INSERT INTO test.aggregates
|
|
|
|
SELECT toDate('2016-12-01') AS d, uniqState(toUInt64(arrayJoin(range(100)))) AS s
|
|
|
|
UNION ALL
|
|
|
|
SELECT toDate('2016-12-02') AS d, uniqState(toUInt64(arrayJoin(range(100)))) AS s
|
|
|
|
UNION ALL
|
|
|
|
SELECT toDate('2016-12-03') AS d, uniqState(toUInt64(arrayJoin(range(100)))) AS s;
|
|
|
|
|
|
|
|
SELECT d, uniqMerge(s) FROM test.aggregates GROUP BY d ORDER BY d;
|
|
|
|
|
2016-11-01 21:10:22 +00:00
|
|
|
DROP TABLE test.aggregates;
|