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

52 lines
1.4 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="
2019-06-03 17:36:27 +00:00
DROP TABLE IF EXISTS view_00699;
DROP TABLE IF EXISTS null_00699;
2018-08-20 19:24:39 +00:00
2019-06-03 17:36:27 +00:00
CREATE TABLE null_00699 (x UInt8) ENGINE = MergeTree ORDER BY tuple();
CREATE MATERIALIZED VIEW view_00699 ENGINE = MergeTree ORDER BY tuple() AS SELECT * FROM null_00699;
2018-08-20 19:24:39 +00:00
2019-06-03 17:36:27 +00:00
INSERT INTO null_00699 SELECT * FROM numbers(100);
SELECT count(), min(x), max(x) FROM null_00699;
SELECT count(), min(x), max(x) FROM view_00699;
2018-08-20 19:24:39 +00:00
2019-06-03 17:36:27 +00:00
ALTER TABLE null_00699 DELETE WHERE x % 2 = 0;"
2018-08-20 19:24:39 +00:00
2019-06-03 17:36:27 +00:00
wait_for_mutation null_00699 mutation_2.txt
2018-08-20 19:24:39 +00:00
${CLICKHOUSE_CLIENT} --multiquery --query="
2019-06-03 17:36:27 +00:00
SELECT count(), min(x), max(x) FROM null_00699;
SELECT count(), min(x), max(x) FROM view_00699;
2018-08-20 19:24:39 +00:00
2019-06-03 17:36:27 +00:00
ALTER TABLE view_00699 DELETE WHERE x % 2 = 0;
2018-08-20 19:24:39 +00:00
"
2019-06-03 17:36:27 +00:00
wait_for_mutation .inner.view_00699 mutation_2.txt
2018-08-20 19:24:39 +00:00
${CLICKHOUSE_CLIENT} --multiquery --query="
2019-06-03 17:36:27 +00:00
SELECT count(), min(x), max(x) FROM null_00699;
SELECT count(), min(x), max(x) FROM view_00699;
2018-08-20 19:24:39 +00:00
2019-06-03 17:36:27 +00:00
ALTER TABLE null_00699 DELETE WHERE x % 2 = 1;
ALTER TABLE view_00699 DELETE WHERE x % 2 = 1;
2018-08-20 19:24:39 +00:00
"
2019-06-03 17:36:27 +00:00
wait_for_mutation null_00699 mutation_3.txt
wait_for_mutation .inner.view_00699 mutation_3.txt
2018-08-20 19:24:39 +00:00
${CLICKHOUSE_CLIENT} --multiquery --query="
2019-06-03 17:36:27 +00:00
SELECT count(), min(x), max(x) FROM null_00699;
SELECT count(), min(x), max(x) FROM view_00699;
2018-08-20 19:24:39 +00:00
2019-06-03 17:36:27 +00:00
DROP TABLE view_00699;
DROP TABLE null_00699;
2018-08-20 19:24:39 +00:00
"