2018-10-03 14:33:47 +00:00
|
|
|
SET send_logs_level = 'none';
|
|
|
|
|
2018-10-03 14:22:28 +00:00
|
|
|
CREATE DATABASE IF NOT EXISTS test;
|
2017-09-15 11:14:19 +00:00
|
|
|
DROP TABLE IF EXISTS test.sum_map;
|
|
|
|
CREATE TABLE test.sum_map(date Date, timeslot DateTime, statusMap Nested(status UInt16, requests UInt64)) ENGINE = Log;
|
|
|
|
|
|
|
|
INSERT INTO test.sum_map VALUES ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]);
|
|
|
|
|
2017-09-20 16:31:44 +00:00
|
|
|
SELECT * FROM test.sum_map ORDER BY timeslot;
|
2017-09-15 11:14:19 +00:00
|
|
|
SELECT sumMap(statusMap.status, statusMap.requests) FROM test.sum_map;
|
|
|
|
SELECT sumMapMerge(s) FROM (SELECT sumMapState(statusMap.status, statusMap.requests) AS s FROM test.sum_map);
|
2017-09-20 16:31:44 +00:00
|
|
|
SELECT timeslot, sumMap(statusMap.status, statusMap.requests) FROM test.sum_map GROUP BY timeslot ORDER BY timeslot;
|
|
|
|
SELECT timeslot, sumMap(statusMap.status, statusMap.requests).1, sumMap(statusMap.status, statusMap.requests).2 FROM test.sum_map GROUP BY timeslot ORDER BY timeslot;
|
2017-09-15 11:14:19 +00:00
|
|
|
|
|
|
|
DROP TABLE test.sum_map;
|
2018-10-03 14:22:28 +00:00
|
|
|
|
|
|
|
select sumMap(val, cnt) from ( SELECT [ CAST(1, 'UInt64') ] as val, [1] as cnt );
|
|
|
|
select sumMap(val, cnt) from ( SELECT [ CAST(1, 'Float64') ] as val, [1] as cnt );
|
|
|
|
select sumMap(val, cnt) from ( SELECT [ CAST('a', 'Enum16(\'a\'=1)') ] as val, [1] as cnt );
|
|
|
|
|
|
|
|
select sumMap(val, cnt) from ( SELECT [ CAST(1, 'DateTime') ] as val, [1] as cnt );
|
|
|
|
select sumMap(val, cnt) from ( SELECT [ CAST(1, 'Date') ] as val, [1] as cnt );
|
|
|
|
select sumMap(val, cnt) from ( SELECT [ CAST('01234567-89ab-cdef-0123-456789abcdef', 'UUID') ] as val, [1] as cnt );
|
|
|
|
select sumMap(val, cnt) from ( SELECT [ CAST(1.01, 'Decimal(10,2)') ] as val, [1] as cnt );
|
|
|
|
|
|
|
|
select sumMap(val, cnt) from ( SELECT [ CAST('a', 'FixedString(1)') ] as val, [1] as cnt ); -- { serverError 43 }
|
|
|
|
select sumMap(val, cnt) from ( SELECT [ CAST('a', 'String') ] as val, [1] as cnt ); -- { serverError 43 }
|