From 0a7638fc9fbd86268bfe0365a3dac4722540cdb1 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Mon, 20 Aug 2018 22:24:39 +0300 Subject: [PATCH] Added test #2897 --- ...0699_materialized_view_mutations.reference | 8 +++ .../00699_materialized_view_mutations.sh | 51 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00699_materialized_view_mutations.reference create mode 100755 dbms/tests/queries/0_stateless/00699_materialized_view_mutations.sh diff --git a/dbms/tests/queries/0_stateless/00699_materialized_view_mutations.reference b/dbms/tests/queries/0_stateless/00699_materialized_view_mutations.reference new file mode 100644 index 00000000000..a12f6b91176 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00699_materialized_view_mutations.reference @@ -0,0 +1,8 @@ +100 0 99 +100 0 99 +50 1 99 +100 0 99 +50 1 99 +50 1 99 +0 0 0 +0 0 0 diff --git a/dbms/tests/queries/0_stateless/00699_materialized_view_mutations.sh b/dbms/tests/queries/0_stateless/00699_materialized_view_mutations.sh new file mode 100755 index 00000000000..f191ec3b77e --- /dev/null +++ b/dbms/tests/queries/0_stateless/00699_materialized_view_mutations.sh @@ -0,0 +1,51 @@ +#!/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 test.view; +DROP TABLE IF EXISTS test.null; + +CREATE TABLE test.null (x UInt8) ENGINE = MergeTree ORDER BY tuple(); +CREATE MATERIALIZED VIEW test.view ENGINE = MergeTree ORDER BY tuple() AS SELECT * FROM test.null; + +INSERT INTO test.null SELECT * FROM numbers(100); +SELECT count(), min(x), max(x) FROM test.null; +SELECT count(), min(x), max(x) FROM test.view; + +ALTER TABLE test.null DELETE WHERE x % 2 = 0;" + +wait_for_mutation null mutation_2.txt + +${CLICKHOUSE_CLIENT} --multiquery --query=" +SELECT count(), min(x), max(x) FROM test.null; +SELECT count(), min(x), max(x) FROM test.view; + +ALTER TABLE test.view DELETE WHERE x % 2 = 0; +" + +wait_for_mutation .inner.view mutation_2.txt + +${CLICKHOUSE_CLIENT} --multiquery --query=" +SELECT count(), min(x), max(x) FROM test.null; +SELECT count(), min(x), max(x) FROM test.view; + +ALTER TABLE test.null DELETE WHERE x % 2 = 1; +ALTER TABLE test.view DELETE WHERE x % 2 = 1; +" + +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 test.null; +SELECT count(), min(x), max(x) FROM test.view; + +DROP TABLE test.view; +DROP TABLE test.null; +"