2020-06-22 09:09:23 +00:00
#!/usr/bin/env bash
2021-09-12 12:35:27 +00:00
# Tags: long, no-parallel
2020-06-22 09:09:23 +00:00
CURDIR = $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd )
2020-12-28 11:46:53 +00:00
# shellcheck source=../shell_config.sh
2020-08-01 00:51:12 +00:00
. " $CURDIR " /../shell_config.sh
2020-06-22 09:09:23 +00:00
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS alter_mt"
$CLICKHOUSE_CLIENT --query "CREATE TABLE alter_mt (key UInt64, value String) ENGINE=MergeTree() ORDER BY key"
$CLICKHOUSE_CLIENT --query "INSERT INTO alter_mt SELECT number, toString(number) FROM numbers(5)"
2023-04-29 17:48:33 +00:00
$CLICKHOUSE_CLIENT --function_sleep_max_microseconds_per_block 10 --query "SELECT count(distinct concat(value, '_')) FROM alter_mt WHERE not sleepEachRow(2)" &
2020-06-22 09:09:23 +00:00
# to be sure that select took all required locks
sleep 2
$CLICKHOUSE_CLIENT --query "ALTER TABLE alter_mt MODIFY COLUMN value UInt64"
$CLICKHOUSE_CLIENT --query "SELECT sum(value) FROM alter_mt"
wait
$CLICKHOUSE_CLIENT --query "SHOW CREATE TABLE alter_mt"
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS alter_mt"