2018-08-20 19:24:39 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2018-08-20 19:24:39 +00:00
|
|
|
|
2020-08-01 00:52:41 +00:00
|
|
|
. "$CURDIR"/mergetree_mutations.lib
|
2018-08-20 19:24:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
${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
|
|
|
"
|