2022-06-22 13:05:07 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-10-28 23:26:06 +00:00
|
|
|
# Tags: no-random-merge-tree-settings
|
2022-06-22 13:05:07 +00:00
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck source=../shell_config.sh
|
|
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
|
2023-12-22 14:31:36 +00:00
|
|
|
echo "Test intersecting ranges"
|
|
|
|
|
2022-06-22 13:05:07 +00:00
|
|
|
test_random_values() {
|
|
|
|
layers=$1
|
|
|
|
$CLICKHOUSE_CLIENT -n -q "
|
2023-12-22 14:31:36 +00:00
|
|
|
drop table if exists tbl_8parts_${layers}granules_rnd;
|
2022-06-22 13:05:07 +00:00
|
|
|
create table tbl_8parts_${layers}granules_rnd (key1 UInt32, sign Int8) engine = CollapsingMergeTree(sign) order by (key1) partition by (key1 % 8);
|
|
|
|
insert into tbl_8parts_${layers}granules_rnd select number, 1 from numbers_mt($((layers * 8 * 8192)));
|
2022-07-24 22:54:03 +00:00
|
|
|
optimize table tbl_8parts_${layers}granules_rnd final;
|
2023-12-27 17:23:28 +00:00
|
|
|
explain pipeline select * from tbl_8parts_${layers}granules_rnd final settings max_threads = 16, do_not_merge_across_partitions_select_final = 0;
|
2023-12-22 14:31:36 +00:00
|
|
|
drop table tbl_8parts_${layers}granules_rnd;" 2>&1 |
|
2022-06-22 13:05:07 +00:00
|
|
|
grep -c "CollapsingSortedTransform"
|
|
|
|
}
|
|
|
|
|
|
|
|
for layers in 2 3 5 8; do
|
|
|
|
test_random_values $layers
|
|
|
|
done;
|
|
|
|
|
2023-12-22 14:31:36 +00:00
|
|
|
echo "Test intersecting ranges finished"
|
|
|
|
|
|
|
|
echo "Test non intersecting ranges"
|
|
|
|
|
2022-06-22 13:05:07 +00:00
|
|
|
test_sequential_values() {
|
|
|
|
layers=$1
|
|
|
|
$CLICKHOUSE_CLIENT -n -q "
|
2023-12-22 14:31:36 +00:00
|
|
|
drop table if exists tbl_8parts_${layers}granules_seq;
|
2022-06-22 13:05:07 +00:00
|
|
|
create table tbl_8parts_${layers}granules_seq (key1 UInt32, sign Int8) engine = CollapsingMergeTree(sign) order by (key1) partition by (key1 / $((layers * 8192)))::UInt64;
|
|
|
|
insert into tbl_8parts_${layers}granules_seq select number, 1 from numbers_mt($((layers * 8 * 8192)));
|
2022-07-24 22:54:03 +00:00
|
|
|
optimize table tbl_8parts_${layers}granules_seq final;
|
2023-12-27 17:23:28 +00:00
|
|
|
explain pipeline select * from tbl_8parts_${layers}granules_seq final settings max_threads = 8, do_not_merge_across_partitions_select_final = 0;
|
2023-12-22 14:31:36 +00:00
|
|
|
drop table tbl_8parts_${layers}granules_seq;" 2>&1 |
|
2022-06-22 13:05:07 +00:00
|
|
|
grep -c "CollapsingSortedTransform"
|
|
|
|
}
|
|
|
|
|
|
|
|
for layers in 2 3 5 8 16; do
|
|
|
|
test_sequential_values $layers
|
|
|
|
done;
|
2023-12-22 14:31:36 +00:00
|
|
|
|
|
|
|
echo "Test non intersecting ranges finished"
|