From acb2cc90f7884c8f64e29981b867aaf2022f368a Mon Sep 17 00:00:00 2001 From: Anton Popov Date: Tue, 10 Dec 2024 13:25:49 +0000 Subject: [PATCH] add test for mutations with block numbers --- ...282_block_number_otehr_mutations.reference | 2 ++ .../03282_block_number_otehr_mutations.sql | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/queries/0_stateless/03282_block_number_otehr_mutations.reference create mode 100644 tests/queries/0_stateless/03282_block_number_otehr_mutations.sql diff --git a/tests/queries/0_stateless/03282_block_number_otehr_mutations.reference b/tests/queries/0_stateless/03282_block_number_otehr_mutations.reference new file mode 100644 index 00000000000..476aaa09b61 --- /dev/null +++ b/tests/queries/0_stateless/03282_block_number_otehr_mutations.reference @@ -0,0 +1,2 @@ +5 5 +2100-10-10 1 1 diff --git a/tests/queries/0_stateless/03282_block_number_otehr_mutations.sql b/tests/queries/0_stateless/03282_block_number_otehr_mutations.sql new file mode 100644 index 00000000000..4f88b953a60 --- /dev/null +++ b/tests/queries/0_stateless/03282_block_number_otehr_mutations.sql @@ -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;