diff --git a/dbms/tests/queries/0_stateless/01055_compact_parts_1.reference b/dbms/tests/queries/0_stateless/01055_compact_parts_1.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dbms/tests/queries/0_stateless/01055_compact_parts_1.sql b/dbms/tests/queries/0_stateless/01055_compact_parts_1.sql new file mode 100644 index 00000000000..a3725ea16cf --- /dev/null +++ b/dbms/tests/queries/0_stateless/01055_compact_parts_1.sql @@ -0,0 +1,10 @@ +drop table if exists mt_compact; + +create table mt_compact (a Int, s String) engine = MergeTree order by a partition by a +settings index_granularity_bytes = 0; +alter table mt_compact modify setting min_rows_for_wide_part = 1000; -- { serverError 48 } + +create table mt_compact_2 (a Int, s String) engine = MergeTree order by a partition by a +settings min_rows_for_wide_part = 1000; +insert into mt_compact_2 values (1, 'a'); +alter table mt_compact attach partition 1 from mt_compact_2; -- { serverError 36 } diff --git a/dbms/tests/queries/0_stateless/01055_compact_parts_granularity.reference b/dbms/tests/queries/0_stateless/01055_compact_parts_granularity.reference new file mode 100644 index 00000000000..543593fb9b0 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01055_compact_parts_granularity.reference @@ -0,0 +1,2 @@ +100 +1 9 diff --git a/dbms/tests/queries/0_stateless/01055_compact_parts_granularity.sql b/dbms/tests/queries/0_stateless/01055_compact_parts_granularity.sql new file mode 100644 index 00000000000..8828ffc2da8 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01055_compact_parts_granularity.sql @@ -0,0 +1,21 @@ +drop table if exists mt_compact; + +-- Checks that granularity correctly computed from small parts. + +create table mt_compact(a Int, s String) engine = MergeTree order by a +settings min_rows_for_wide_part = 1000, +index_granularity = 14; + +system stop merges mt_compact; +set max_block_size = 1; +set min_insert_block_size_rows=1; +insert into mt_compact select number, 'aaa' from numbers(100); + +select count() from system.parts where table = 'mt_compact' and database = currentDatabase() and active; + +system start merges mt_compact; +optimize table mt_compact final; + +select count(), sum(marks) from system.parts where table = 'mt_compact' and database = currentDatabase() and active; + +drop table mt_compact;