Merge pull request #73017 from CurtizJ/add-test-for-block-number-mutation

Add tests for some mutations with enabled column `_block_number`
This commit is contained in:
Anton Popov 2024-12-10 23:18:26 +00:00 committed by GitHub
commit 34b7207b76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,2 @@
5 5
2100-10-10 1 1

View File

@ -0,0 +1,30 @@
SET mutations_sync = 2;
DROP TABLE IF EXISTS t_block_number_proj;
CREATE TABLE t_block_number_proj (a UInt64, b UInt64) ENGINE = MergeTree ORDER BY a
SETTINGS enable_block_number_column = 1, min_bytes_for_wide_part = 0, index_granularity = 128;
INSERT INTO t_block_number_proj SELECT number, number FROM numbers(1000);
OPTIMIZE TABLE t_block_number_proj FINAL;
ALTER TABLE t_block_number_proj ADD PROJECTION p (SELECT a, b ORDER BY b);
ALTER TABLE t_block_number_proj MATERIALIZE PROJECTION p;
SELECT a, b FROM t_block_number_proj WHERE b = 5 SETTINGS force_optimize_projection = 1;
DROP TABLE t_block_number_proj;
DROP TABLE IF EXISTS t_block_number_ttl;
CREATE TABLE t_block_number_ttl (d Date, a UInt64, b UInt64) ENGINE = MergeTree ORDER BY a
SETTINGS enable_block_number_column = 1, min_bytes_for_wide_part = 0, index_granularity = 128;
INSERT INTO t_block_number_ttl VALUES ('2000-10-10', 1, 1) ('2100-10-10', 1, 1);
OPTIMIZE TABLE t_block_number_ttl FINAL;
ALTER TABLE t_block_number_ttl MODIFY TTL d + INTERVAL 1 MONTH;
SELECT * FROM t_block_number_ttl ORDER BY a;
DROP TABLE t_block_number_ttl;