mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
5c87a91aaf
This fixes a variant of SummingMergeTree() in which the columns to sum are explicitly configured. Previously columns not in that list were ignored, instead of writing last value. This also fixes summation of invalid maps with with only one key column and no value columns. Modified test to work around compaction limitation in which a zero-value column isn’t compacted immediately if the inputs are non-zero but the output is zero (+1 -1).
19 lines
761 B
SQL
19 lines
761 B
SQL
CREATE DATABASE IF NOT EXISTS test;
|
|
DROP TABLE IF EXISTS test.empty_summing;
|
|
CREATE TABLE test.empty_summing (d Date, k UInt64, v Int8) ENGINE=SummingMergeTree(d, k, 8192);
|
|
|
|
INSERT INTO test.empty_summing VALUES ('2015-01-01', 1, 10);
|
|
INSERT INTO test.empty_summing VALUES ('2015-01-01', 1, -10);
|
|
|
|
OPTIMIZE TABLE test.empty_summing;
|
|
SELECT * FROM test.empty_summing;
|
|
|
|
INSERT INTO test.empty_summing VALUES ('2015-01-01', 1, 4),('2015-01-01', 2, -9),('2015-01-01', 3, -14);
|
|
INSERT INTO test.empty_summing VALUES ('2015-01-01', 1, -2),('2015-01-01', 1, -2),('2015-01-01', 3, 14);
|
|
INSERT INTO test.empty_summing VALUES ('2015-01-01', 1, 0),('2015-01-01', 3, 0);
|
|
|
|
OPTIMIZE TABLE test.empty_summing;
|
|
SELECT * FROM test.empty_summing;
|
|
|
|
DROP TABLE test.empty_summing;
|