mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix tests involving index_granularity_bytes
This commit is contained in:
parent
ffb73adb11
commit
10c4178938
@ -8,7 +8,7 @@ CREATE TABLE zero_rows_per_granule (
|
||||
v2 Int64,
|
||||
Sign Int8
|
||||
) ENGINE CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=20, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes=20, min_index_granularity_bytes=10, write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
@ -39,7 +39,7 @@ CREATE TABLE four_rows_per_granule (
|
||||
v2 Int64,
|
||||
Sign Int8
|
||||
) ENGINE CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=110, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes=110, min_index_granularity_bytes=100, write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
@ -7,7 +7,7 @@ CREATE TABLE zero_rows_per_granule (
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 20, write_final_mark = 0;
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 20, min_index_granularity_bytes = 10, write_final_mark = 0;
|
||||
|
||||
INSERT INTO zero_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
@ -34,7 +34,7 @@ CREATE TABLE two_rows_per_granule (
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 40, write_final_mark = 0;
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 40, min_index_granularity_bytes = 10, write_final_mark = 0;
|
||||
|
||||
INSERT INTO two_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
@ -61,7 +61,7 @@ CREATE TABLE four_rows_per_granule (
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, write_final_mark = 0;
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, min_index_granularity_bytes = 10, write_final_mark = 0;
|
||||
|
||||
INSERT INTO four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
@ -126,7 +126,7 @@ CREATE TABLE adaptive_granularity_alter (
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, write_final_mark = 0;
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, min_index_granularity_bytes = 100, write_final_mark = 0;
|
||||
|
||||
INSERT INTO adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
@ -180,7 +180,9 @@ CREATE TABLE zero_rows_per_granule (
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=20, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes = 20,
|
||||
min_index_granularity_bytes = 10,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
@ -212,7 +214,9 @@ CREATE TABLE two_rows_per_granule (
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=40, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes=40,
|
||||
min_index_granularity_bytes = 10,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
@ -243,7 +247,9 @@ CREATE TABLE four_rows_per_granule (
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes = 110, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes = 110,
|
||||
min_index_granularity_bytes = 10,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
@ -316,7 +322,9 @@ CREATE TABLE adaptive_granularity_alter (
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE MergeTree() PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=110, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes=110,
|
||||
min_index_granularity_bytes = 100,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
@ -38,7 +38,9 @@ CREATE TABLE two_rows_per_granule (
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE ReplacingMergeTree() PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=40, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes = 40,
|
||||
min_index_granularity_bytes = 10,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
@ -69,7 +71,9 @@ CREATE TABLE four_rows_per_granule (
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE ReplacingMergeTree() PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes = 110, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes = 110,
|
||||
min_index_granularity_bytes=100,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
@ -151,7 +155,9 @@ CREATE TABLE adaptive_granularity_alter (
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE ReplacingMergeTree() PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=110, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes=110,
|
||||
index_granularity_bytes=40,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
@ -9,7 +9,9 @@ CREATE TABLE zero_rows_per_granule (
|
||||
Sign Int8,
|
||||
Version UInt8
|
||||
) ENGINE VersionedCollapsingMergeTree(Sign, Version) PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=20, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes = 20,
|
||||
min_index_granularity_bytes = 10,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
@ -41,7 +43,9 @@ CREATE TABLE four_rows_per_granule (
|
||||
Sign Int8,
|
||||
Version UInt8
|
||||
) ENGINE VersionedCollapsingMergeTree(Sign, Version) PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=120, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes=120,
|
||||
min_index_granularity_bytes = 100,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
@ -86,7 +90,9 @@ CREATE TABLE six_rows_per_granule (
|
||||
Sign Int8,
|
||||
Version UInt8
|
||||
) ENGINE VersionedCollapsingMergeTree(Sign, Version) PARTITION BY toYYYYMM(p) ORDER BY k
|
||||
SETTINGS index_granularity_bytes=170, write_final_mark = 0,
|
||||
SETTINGS index_granularity_bytes=170,
|
||||
min_index_granularity_bytes = 100,
|
||||
write_final_mark = 0,
|
||||
enable_vertical_merge_algorithm=1,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
@ -8,14 +8,14 @@ CREATE TABLE zero_rows_per_granule1 (
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/zero_rows_in_granule', '1') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 20, write_final_mark = 0;
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/zero_rows_in_granule', '1') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 20, index_granularity_bytes = 10, write_final_mark = 0;
|
||||
|
||||
CREATE TABLE zero_rows_per_granule2 (
|
||||
p Date,
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/zero_rows_in_granule', '2') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 20, write_final_mark = 0;
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/zero_rows_in_granule', '2') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 20, index_granularity_bytes = 10, write_final_mark = 0;
|
||||
|
||||
INSERT INTO zero_rows_per_granule1 (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
@ -68,14 +68,14 @@ CREATE TABLE four_rows_per_granule1 (
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/four_rows_in_granule', '1') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, write_final_mark = 0;
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/four_rows_in_granule', '1') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, index_granularity_bytes = 100, write_final_mark = 0;
|
||||
|
||||
CREATE TABLE four_rows_per_granule2 (
|
||||
p Date,
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/four_rows_in_granule', '2') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, write_final_mark = 0;
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/four_rows_in_granule', '2') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, index_granularity_bytes = 100 ,write_final_mark = 0;
|
||||
|
||||
INSERT INTO four_rows_per_granule1 (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
@ -135,14 +135,14 @@ CREATE TABLE adaptive_granularity_alter1 (
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/adaptive_granularity_alter', '1') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, write_final_mark = 0;
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/adaptive_granularity_alter', '1') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, index_granularity_bytes = 100, write_final_mark = 0;
|
||||
|
||||
CREATE TABLE adaptive_granularity_alter2 (
|
||||
p Date,
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
v2 Int64
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/adaptive_granularity_alter', '2') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, write_final_mark = 0;
|
||||
) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00926/adaptive_granularity_alter', '2') PARTITION BY toYYYYMM(p) ORDER BY k SETTINGS index_granularity_bytes = 110, index_granularity_bytes = 100, write_final_mark = 0;
|
||||
|
||||
INSERT INTO adaptive_granularity_alter1 (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
|
@ -143,7 +143,7 @@ CREATE TABLE mt_with_small_granularity (
|
||||
n Nested (Age UInt8, Name String),
|
||||
w Int16 DEFAULT 10
|
||||
) ENGINE = MergeTree()
|
||||
PARTITION BY toYYYYMM(d) ORDER BY (x, z) SETTINGS index_granularity_bytes=30, write_final_mark=1;
|
||||
PARTITION BY toYYYYMM(d) ORDER BY (x, z) SETTINGS index_granularity_bytes=30, min_index_granularity_bytes=20, write_final_mark=1;
|
||||
|
||||
INSERT INTO mt_with_small_granularity (d, x, y, z, `n.Age`, `n.Name`) VALUES (toDate('2018-10-01'), toDateTime('2018-10-01 12:57:57'), [1, 1, 1], 11, [77], ['Joe']), (toDate('2018-10-01'), toDateTime('2018-10-01 16:57:57'), [2, 2, 2], 12, [88], ['Mark']), (toDate('2018-10-01'), toDateTime('2018-10-01 19:57:57'), [3, 3, 3], 13, [99], ['Robert']);
|
||||
|
||||
|
@ -9,7 +9,7 @@ CREATE TABLE indexed_table
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY (tm)
|
||||
SETTINGS index_granularity_bytes = 50;
|
||||
SETTINGS index_granularity_bytes = 50, min_index_granularity_bytes = 40;
|
||||
|
||||
INSERT INTO indexed_table SELECT toDateTime('2019-05-27 10:00:00') + number % 100, 'h' FROM numbers(1000);
|
||||
|
||||
@ -36,6 +36,7 @@ CREATE TABLE another_indexed_table
|
||||
ENGINE = MergeTree
|
||||
ORDER BY (tm)
|
||||
SETTINGS index_granularity_bytes = 50,
|
||||
min_index_granularity_bytes = 40,
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
||||
|
@ -6,7 +6,7 @@ CREATE TABLE bad_skip_idx
|
||||
id UInt64,
|
||||
value String
|
||||
) ENGINE MergeTree()
|
||||
ORDER BY id SETTINGS index_granularity_bytes = 64, vertical_merge_algorithm_min_rows_to_activate = 0, vertical_merge_algorithm_min_columns_to_activate = 0; -- actually vertical merge is not required condition for this bug, but it's more easy to reproduce (becuse we don't recalc granularities)
|
||||
ORDER BY id SETTINGS index_granularity_bytes = 64, min_index_granularity_bytes = 10, vertical_merge_algorithm_min_rows_to_activate = 0, vertical_merge_algorithm_min_columns_to_activate = 0; -- actually vertical merge is not required condition for this bug, but it's more easy to reproduce (becuse we don't recalc granularities)
|
||||
|
||||
-- 7 rows per granule
|
||||
INSERT INTO bad_skip_idx SELECT number, concat('x', toString(number)) FROM numbers(1000);
|
||||
|
@ -1,6 +1,6 @@
|
||||
drop table if exists t50;
|
||||
|
||||
create table t50 (a Int, b Int, s String) engine = MergeTree order by a settings index_granularity = 50, index_granularity_bytes=1000;
|
||||
create table t50 (a Int, b Int, s String) engine = MergeTree order by a settings index_granularity = 50, index_granularity_bytes=1000, min_index_granularity_bytes=500;
|
||||
|
||||
-- some magic to satisfy conditions to run optimizations in MergeTreeRangeReader
|
||||
insert into t50 select 0, 1, repeat('a', 10000);
|
||||
|
@ -1,5 +1 @@
|
||||
--- CREATE TABLE with INVALID index_granularity_bytes i.e.index_granularity_bytes < min_index_granularity_bytes ---
|
||||
--- INSERT INTO TABLE invalid_min_index_granularity_bytes_setting ---
|
||||
--- CREATE TABLE with VALID index_granularity_bytes i.e index_granularity_bytes > min_index_granularity_bytes ---
|
||||
--- INSERT INTO TABLE valid_min_index_granularity_bytes_setting ---
|
||||
1
|
||||
|
@ -1,23 +1,16 @@
|
||||
DROP TABLE IF EXISTS invalid_min_index_granularity_bytes_setting;
|
||||
|
||||
SELECT '--- CREATE TABLE with INVALID index_granularity_bytes i.e.index_granularity_bytes < min_index_granularity_bytes ---';
|
||||
CREATE TABLE invalid_min_index_granularity_bytes_setting
|
||||
(
|
||||
id UInt64,
|
||||
value String
|
||||
) ENGINE MergeTree()
|
||||
ORDER BY id SETTINGS index_granularity_bytes = 1, min_index_granularity_bytes = 1024; -- should result in exception
|
||||
|
||||
SELECT '--- INSERT INTO TABLE invalid_min_index_granularity_bytes_setting ---';
|
||||
|
||||
INSERT INTO invalid_min_index_granularity_bytes_setting SELECT number, concat('xxxxxxxxxx', toString(number)) FROM numbers(1000,1000); -- should result in exception
|
||||
ORDER BY id SETTINGS index_granularity_bytes = 1, min_index_granularity_bytes = 1024; -- { serverError 36 }
|
||||
|
||||
DROP TABLE IF EXISTS invalid_min_index_granularity_bytes_setting;
|
||||
|
||||
DROP TABLE IF EXISTS valid_min_index_granularity_bytes_setting;
|
||||
|
||||
SELECT '--- CREATE TABLE with VALID index_granularity_bytes i.e index_granularity_bytes > min_index_granularity_bytes ---';
|
||||
|
||||
CREATE TABLE valid_min_index_granularity_bytes_setting
|
||||
(
|
||||
id UInt64,
|
||||
@ -25,8 +18,6 @@ CREATE TABLE valid_min_index_granularity_bytes_setting
|
||||
) ENGINE MergeTree()
|
||||
ORDER BY id SETTINGS index_granularity_bytes = 2024, min_index_granularity_bytes = 1024; -- should NOT result in exception
|
||||
|
||||
SELECT '--- INSERT INTO TABLE valid_min_index_granularity_bytes_setting ---';
|
||||
|
||||
INSERT INTO valid_min_index_granularity_bytes_setting SELECT number, concat('xxxxxxxxxx', toString(number)) FROM numbers(1000,1000); -- should result in exception
|
||||
|
||||
SELECT COUNT(*) from valid_min_index_granularity_bytes_setting WHERE value = 'xxxxxxxxxx1015';
|
||||
|
Loading…
Reference in New Issue
Block a user