2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS decimal_sum;
|
2022-06-23 08:37:52 +00:00
|
|
|
set allow_deprecated_syntax_for_merge_tree=1;
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE decimal_sum
|
2018-10-11 14:33:01 +00:00
|
|
|
(
|
|
|
|
date Date,
|
|
|
|
sum32 Decimal32(4),
|
|
|
|
sum64 Decimal64(8),
|
|
|
|
sum128 Decimal128(10)
|
|
|
|
) Engine = SummingMergeTree(date, (date), 8192);
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO decimal_sum VALUES ('2001-01-01', 1, 1, -1);
|
|
|
|
INSERT INTO decimal_sum VALUES ('2001-01-01', 1, -1, -1);
|
2018-10-11 14:33:01 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
OPTIMIZE TABLE decimal_sum;
|
|
|
|
SELECT * FROM decimal_sum;
|
2018-10-11 14:33:01 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO decimal_sum VALUES ('2001-01-01', -2, 1, 2);
|
2018-10-11 14:33:01 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
OPTIMIZE TABLE decimal_sum;
|
|
|
|
SELECT * FROM decimal_sum;
|
2018-10-11 14:33:01 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO decimal_sum VALUES ('2001-01-01', 0, -1, 0);
|
2018-10-11 14:33:01 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
OPTIMIZE TABLE decimal_sum;
|
|
|
|
SELECT * FROM decimal_sum;
|
2018-10-11 14:33:01 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
drop table decimal_sum;
|