diff --git a/dbms/tests/queries/0_stateless/00943_materialize_index.reference b/dbms/tests/queries/0_stateless/00943_materialize_index.reference index 8cc6d8ad18e..00aa71e8bd1 100644 --- a/dbms/tests/queries/0_stateless/00943_materialize_index.reference +++ b/dbms/tests/queries/0_stateless/00943_materialize_index.reference @@ -1,4 +1,8 @@ 5 "rows_read": 10, +5 + "rows_read": 8, +5 + "rows_read": 6, 5 "rows_read": 6, diff --git a/dbms/tests/queries/0_stateless/00943_materialize_index.sh b/dbms/tests/queries/0_stateless/00943_materialize_index.sh index 4625025da20..4ab061d9347 100755 --- a/dbms/tests/queries/0_stateless/00943_materialize_index.sh +++ b/dbms/tests/queries/0_stateless/00943_materialize_index.sh @@ -13,21 +13,22 @@ CREATE TABLE test.minmax_idx i64 Int64, i32 Int32 ) ENGINE = MergeTree() +PARTITION BY i32 ORDER BY u64 SETTINGS index_granularity = 2;" $CLICKHOUSE_CLIENT --query="INSERT INTO test.minmax_idx VALUES (0, 2, 1), -(1, 1, 2), -(2, 1, 3), -(3, 1, 4), -(4, 2, 5), -(5, 2, 6), -(6, 2, 7), -(7, 2, 8), -(8, 1, 9), -(9, 1, 10)" +(1, 1, 1), +(2, 1, 1), +(3, 1, 1), +(4, 2, 2), +(5, 2, 2), +(6, 2, 2), +(7, 2, 2), +(8, 1, 2), +(9, 1, 2)" $CLICKHOUSE_CLIENT --query="SELECT count() FROM test.minmax_idx WHERE i64 = 2;" $CLICKHOUSE_CLIENT --query="SELECT count() FROM test.minmax_idx WHERE i64 = 2 FORMAT JSON" | grep "rows_read" @@ -36,6 +37,16 @@ $CLICKHOUSE_CLIENT -n --query=" SET allow_experimental_data_skipping_indices=1; ALTER TABLE test.minmax_idx ADD INDEX idx (i64, u64 * i64) TYPE minmax GRANULARITY 1;" +$CLICKHOUSE_CLIENT --query="ALTER TABLE test.minmax_idx MATERIALIZE INDEX idx IN PARTITION 1;" + +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.minmax_idx WHERE i64 = 2;" +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.minmax_idx WHERE i64 = 2 FORMAT JSON" | grep "rows_read" + +$CLICKHOUSE_CLIENT --query="ALTER TABLE test.minmax_idx MATERIALIZE INDEX idx IN PARTITION 2;" + +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.minmax_idx WHERE i64 = 2;" +$CLICKHOUSE_CLIENT --query="SELECT count() FROM test.minmax_idx WHERE i64 = 2 FORMAT JSON" | grep "rows_read" + $CLICKHOUSE_CLIENT --query="ALTER TABLE test.minmax_idx MATERIALIZE INDEX idx;" $CLICKHOUSE_CLIENT --query="SELECT count() FROM test.minmax_idx WHERE i64 = 2;"