diff --git a/tests/queries/0_stateless/01114_clear_column_compact_parts.reference b/tests/queries/0_stateless/01114_clear_column_compact_parts.reference new file mode 100644 index 00000000000..e8c9b37ff3a --- /dev/null +++ b/tests/queries/0_stateless/01114_clear_column_compact_parts.reference @@ -0,0 +1,4 @@ +1 0 +2 3 +1 0 +2 0 diff --git a/tests/queries/0_stateless/01114_clear_column_compact_parts.sql b/tests/queries/0_stateless/01114_clear_column_compact_parts.sql new file mode 100644 index 00000000000..bdfed06ea9a --- /dev/null +++ b/tests/queries/0_stateless/01114_clear_column_compact_parts.sql @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS clear_column; + +CREATE TABLE clear_column(x UInt32, y UInt32) ENGINE MergeTree ORDER BY x PARTITION by x; +INSERT INTO clear_column VALUES (1, 1), (2, 3); + +ALTER TABLE clear_column CLEAR COLUMN y IN PARTITION 1; +SELECT * FROM clear_column ORDER BY x; +ALTER TABLE clear_column CLEAR COLUMN y IN PARTITION 2; +SELECT * FROM clear_column ORDER BY x; + +DROP TABLE clear_column; diff --git a/tests/queries/0_stateless/01114_materialize_clear_index_compact_parts.reference b/tests/queries/0_stateless/01114_materialize_clear_index_compact_parts.reference new file mode 100644 index 00000000000..083edaac248 --- /dev/null +++ b/tests/queries/0_stateless/01114_materialize_clear_index_compact_parts.reference @@ -0,0 +1,3 @@ +2 +2 +2 diff --git a/tests/queries/0_stateless/01114_materialize_clear_index_compact_parts.sql b/tests/queries/0_stateless/01114_materialize_clear_index_compact_parts.sql new file mode 100644 index 00000000000..404922f36bb --- /dev/null +++ b/tests/queries/0_stateless/01114_materialize_clear_index_compact_parts.sql @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS minmax_compact; + +CREATE TABLE minmax_compact +( + u64 UInt64, + i64 Int64, + i32 Int32 +) ENGINE = MergeTree() +PARTITION BY i32 +ORDER BY u64 +SETTINGS index_granularity = 2, min_rows_for_wide_part = 1000000; + +INSERT INTO minmax_compact VALUES (0, 2, 1), (1, 1, 1), (2, 1, 1), (3, 1, 1), (4, 1, 1), (5, 2, 1), (6, 1, 2), (7, 1, 2), (8, 1, 2), (9, 1, 2); + +SET mutations_sync = 1; +ALTER TABLE minmax_compact ADD INDEX idx (i64, u64 * i64) TYPE minmax GRANULARITY 1; + +ALTER TABLE minmax_compact MATERIALIZE INDEX idx IN PARTITION 1; +set max_rows_to_read = 8; +SELECT count() FROM minmax_compact WHERE i64 = 2; + +ALTER TABLE minmax_compact MATERIALIZE INDEX idx IN PARTITION 2; +set max_rows_to_read = 6; +SELECT count() FROM minmax_compact WHERE i64 = 2; + +ALTER TABLE minmax_compact CLEAR INDEX idx IN PARTITION 1; +ALTER TABLE minmax_compact CLEAR INDEX idx IN PARTITION 2; + +SELECT count() FROM minmax_compact WHERE i64 = 2; -- { serverError 158 } + +set max_rows_to_read = 10; +SELECT count() FROM minmax_compact WHERE i64 = 2;