2018-08-20 19:24:39 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
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
|
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
|
|
|
|
2020-09-03 23:28:44 +00:00
|
|
|
ALTER TABLE null_00699 DELETE WHERE x % 2 = 0;" --mutations_sync=1
|
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;
|
2020-09-03 23:28:44 +00:00
|
|
|
" --mutations_sync=1
|
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;
|
2020-09-03 23:28:44 +00:00
|
|
|
" --mutations_sync=1
|
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
|
|
|
"
|