mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
add tests for ALTER CLEAR COLUMN/INDEX with compact parts
This commit is contained in:
parent
d018977f4b
commit
9b6f7af7f6
@ -0,0 +1,4 @@
|
||||
1 0
|
||||
2 3
|
||||
1 0
|
||||
2 0
|
@ -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;
|
@ -0,0 +1,3 @@
|
||||
2
|
||||
2
|
||||
2
|
@ -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;
|
Loading…
Reference in New Issue
Block a user