ClickHouse/dbms/tests/queries/0_stateless/00699_materialized_view_mutations.sh

52 lines
1.3 KiB
Bash
Raw Normal View History

2018-08-20 19:24:39 +00:00
#!/usr/bin/env bash
set -e
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
. $CURDIR/mergetree_mutations.lib
${CLICKHOUSE_CLIENT} --multiquery --query="
DROP TABLE IF EXISTS view;
DROP TABLE IF EXISTS null;
2018-08-20 19:24:39 +00:00
CREATE TABLE null (x UInt8) ENGINE = MergeTree ORDER BY tuple();
CREATE MATERIALIZED VIEW view ENGINE = MergeTree ORDER BY tuple() AS SELECT * FROM null;
2018-08-20 19:24:39 +00:00
INSERT INTO null SELECT * FROM numbers(100);
SELECT count(), min(x), max(x) FROM null;
SELECT count(), min(x), max(x) FROM view;
2018-08-20 19:24:39 +00:00
ALTER TABLE null DELETE WHERE x % 2 = 0;"
2018-08-20 19:24:39 +00:00
wait_for_mutation null mutation_2.txt
${CLICKHOUSE_CLIENT} --multiquery --query="
SELECT count(), min(x), max(x) FROM null;
SELECT count(), min(x), max(x) FROM view;
2018-08-20 19:24:39 +00:00
ALTER TABLE view DELETE WHERE x % 2 = 0;
2018-08-20 19:24:39 +00:00
"
wait_for_mutation .inner.view mutation_2.txt
${CLICKHOUSE_CLIENT} --multiquery --query="
SELECT count(), min(x), max(x) FROM null;
SELECT count(), min(x), max(x) FROM view;
2018-08-20 19:24:39 +00:00
ALTER TABLE null DELETE WHERE x % 2 = 1;
ALTER TABLE view DELETE WHERE x % 2 = 1;
2018-08-20 19:24:39 +00:00
"
wait_for_mutation null mutation_3.txt
wait_for_mutation .inner.view mutation_3.txt
${CLICKHOUSE_CLIENT} --multiquery --query="
SELECT count(), min(x), max(x) FROM null;
SELECT count(), min(x), max(x) FROM view;
2018-08-20 19:24:39 +00:00
DROP TABLE view;
DROP TABLE null;
2018-08-20 19:24:39 +00:00
"