diff --git a/dbms/tests/queries/0_stateless/00975_indices_mutation_replicated_zookeeper.reference b/dbms/tests/queries/0_stateless/00975_indices_mutation_replicated_zookeeper.reference new file mode 100644 index 00000000000..9c5382e5cbe --- /dev/null +++ b/dbms/tests/queries/0_stateless/00975_indices_mutation_replicated_zookeeper.reference @@ -0,0 +1,6 @@ +2 + "rows_read": 4, +2 + "rows_read": 6, +2 + "rows_read": 4, diff --git a/dbms/tests/queries/0_stateless/00975_indices_mutation_replicated_zookeeper.sh b/dbms/tests/queries/0_stateless/00975_indices_mutation_replicated_zookeeper.sh new file mode 100644 index 00000000000..4490487663f --- /dev/null +++ b/dbms/tests/queries/0_stateless/00975_indices_mutation_replicated_zookeeper.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CURDIR/../shell_config.sh + +$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.minmax_idx;" + + +$CLICKHOUSE_CLIENT -n --query=" +SET allow_experimental_data_skipping_indices=1; +CREATE TABLE test.indices_mutaions1 +( + u64 UInt64, + i64 Int64, + i32 Int32, + INDEX idx (i64, u64 * i64) TYPE minmax GRANULARITY 1 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/indices_mutaions', 'r1') +PARTITION BY i32 +ORDER BY u64 +SETTINGS index_granularity = 2; +CREATE TABLE test.indices_mutaions2 +( + u64 UInt64, + i64 Int64, + i32 Int32, + INDEX idx (i64, u64 * i64) TYPE minmax GRANULARITY 1 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/indices_mutaions', 'r2') +PARTITION BY i32 +ORDER BY u64 +SETTINGS index_granularity = 2;" + + +$CLICKHOUSE_CLIENT --query="INSERT INTO test.indices_mutaions1 VALUES +(0, 2, 1), +(1, 1, 1), +(2, 1, 1), +(3, 1, 1), +(4, 1, 1), +(5, 2, 1), +(6, 1, 2), +(7, 1, 2), +(8, 1, 2), +(9, 1, 2)" + +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.indices_mutaions2 WHERE i64 = 2;" +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.indices_mutaions2 WHERE i64 = 2 FORMAT JSON" | grep "rows_read" + +$CLICKHOUSE_CLIENT --query="ALTER TABLE test.indices_mutaions1 CLEAR INDEX idx IN PARTITION 1;" +sleep 1 + +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.indices_mutaions2 WHERE i64 = 2;" +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.indices_mutaions2 WHERE i64 = 2 FORMAT JSON" | grep "rows_read" + +$CLICKHOUSE_CLIENT --query="ALTER TABLE test.indices_mutaions1 MATERIALIZE INDEX idx IN PARTITION 1;" +sleep 1 + +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.indices_mutaions2 WHERE i64 = 2;" +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.indices_mutaions2 WHERE i64 = 2 FORMAT JSON" | grep "rows_read" + +$CLICKHOUSE_CLIENT --query="DROP TABLE test.indices_mutaions1" +$CLICKHOUSE_CLIENT --query="DROP TABLE test.indices_mutaions2"