Add test.

This commit is contained in:
Nikolai Kochetov 2021-04-08 18:19:49 +03:00
parent 794d7c89b6
commit 0a43b729b1
2 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,71 @@
ReadFromMergeTree
ReadType: Default
Indexes:
None
Parts: 5
Granules: 12
MinMax
Description: unknown, unknown, and, (column 0 in [1, +inf)), unknown, and, unknown, and, and, unknown, unknown, and, and
Parts: 4
Granules: 11
Partition
Description: unknown, unknown, and, (column 0 in [1, +inf)), (column 1 not in [1, 1]), and, unknown, and, and, unknown, unknown, and, and
Parts: 3
Granules: 10
PrimaryKey
Description: unknown, unknown, and, (column 1 in [1, +inf)), unknown, and, (column 0 in [11, +inf)), and, and, unknown, unknown, and, and
Parts: 2
Granules: 6
Skip
Name: t_minmax
Description: minmax GRANULARITY 2
Parts: 1
Granules: 2
Skip
Name: t_set
Description: set GRANULARITY 2
Parts: 1
Granules: 1
-----------------
ReadFromMergeTree
ReadType: InOrder
Indexes:
None
Parts: 5
Granules: 12
MinMax
Description: unknown
Parts: 5
Granules: 12
Partition
Description: unknown
Parts: 5
Granules: 12
PrimaryKey
Description: (column 0 in [11, +inf))
Parts: 2
Granules: 6
ReadFromMergeTree
ReadType: InOrder
-----------------
ReadFromMergeTree
ReadType: InReverseOrder
Indexes:
None
Parts: 5
Granules: 12
MinMax
Description: unknown
Parts: 5
Granules: 12
Partition
Description: unknown
Parts: 5
Granules: 12
PrimaryKey
Description: (column 0 in [11, +inf))
Parts: 2
Granules: 6
ReverseRows
ReadFromMergeTree
ReadType: InReverseOrder

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "create table test_index (x UInt32, y UInt32, z UInt32, t UInt32, index t_minmax t % 20 TYPE minmax GRANULARITY 2, index t_set t % 19 type set(4) granularity 2) engine = MergeTree order by (x, y) partition by (y, bitAnd(z, 3), intDiv(t, 15)) settings index_granularity = 2"
$CLICKHOUSE_CLIENT -q "insert into test_index select number, number > 3 ? 3 : number, number = 1 ? 1 : 0, number from numbers(20)"
$CLICKHOUSE_CLIENT -q "
explain actions = 1 select *, _part from test_index where t % 19 = 16 and y > 0 and bitAnd(z, 3) != 1 and x > 10 and t % 20 > 14;
" | grep -A 100 "ReadFromMergeTree"
echo "-----------------"
$CLICKHOUSE_CLIENT -q "
explain actions = 1 select x from test_index where x > 10 order by x;
" | grep -A 100 "ReadFromMergeTree"
echo "-----------------"
$CLICKHOUSE_CLIENT -q "
explain actions = 1 select x from test_index where x > 10 order by x desc;
" | grep -A 100 "ReadFromMergeTree"