ClickHouse/tests/queries/0_stateless/02875_merge_engine_set_index.sh
Nikita Taranov f7d70d1c32 fix test
2023-09-25 23:58:29 +02:00

66 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# shellcheck disable=SC2154
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -nq "
CREATE TABLE t1
(
a UInt32,
b UInt32
)
ENGINE = MergeTree
ORDER BY (a, b)
SETTINGS index_granularity = 8192;
INSERT INTO t1 SELECT number, number FROM numbers_mt(1e6);
CREATE TABLE t2
(
a UInt32,
b UInt32
)
ENGINE = MergeTree
ORDER BY (a, b)
SETTINGS index_granularity = 8192;
INSERT INTO t2 VALUES (1, 1) (2, 2) (3, 3);
CREATE TABLE t
(
a UInt32,
b UInt32
)
ENGINE = Merge(currentDatabase(), 't*');"
query_id="${CLICKHOUSE_DATABASE}_merge_engine_set_index_$RANDOM$RANDOM"
$CLICKHOUSE_CLIENT --query_id="$query_id" --multiquery -q "
SELECT
a,
b
FROM t
WHERE (a, b) IN (
SELECT DISTINCT
a,
b
FROM t2
)
GROUP BY
a,
b
ORDER BY
a ASC,
b DESC
FORMAT Null;"
$CLICKHOUSE_CLIENT -nq "
SYSTEM FLUSH LOGS;
SELECT ProfileEvents['SelectedMarks']
FROM system.query_log
WHERE event_date >= yesterday() AND current_database = currentDatabase() AND (query_id = '$query_id') AND (type = 'QueryFinish');"