ClickHouse/tests/queries/0_stateless/02875_merge_engine_set_index.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.1 KiB
Bash
Raw Normal View History

2023-09-21 21:55:11 +00:00
#!/usr/bin/env bash
# Tags: long, no-tsan
# 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);
INSERT INTO t1 SELECT number, number FROM numbers_mt(1e6);
CREATE TABLE t2
(
a UInt32,
b UInt32
)
ENGINE = MergeTree
ORDER BY (a, b);
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 (query_id = '$query_id') AND (type = 'QueryFinish');
"