2019-05-09 12:14:29 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2020-08-01 00:52:41 +00:00
|
|
|
. "$CURDIR"/mergetree_mutations.lib
|
2019-04-18 15:41:07 +00:00
|
|
|
|
2020-05-29 10:08:11 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS minmax_idx;"
|
2019-04-18 15:41:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT -n --query="
|
2020-05-29 10:08:11 +00:00
|
|
|
CREATE TABLE minmax_idx
|
2019-04-18 15:41:07 +00:00
|
|
|
(
|
|
|
|
u64 UInt64,
|
|
|
|
i64 Int64,
|
|
|
|
i32 Int32,
|
|
|
|
INDEX idx (i64, u64 * i64) TYPE minmax GRANULARITY 1
|
|
|
|
) ENGINE = MergeTree()
|
|
|
|
ORDER BY u64
|
|
|
|
SETTINGS index_granularity = 2;"
|
|
|
|
|
|
|
|
|
2020-05-29 10:08:11 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="INSERT INTO minmax_idx VALUES
|
2019-04-18 15:41:07 +00:00
|
|
|
(0, 1, 1),
|
|
|
|
(1, 1, 2),
|
|
|
|
(2, 1, 3),
|
|
|
|
(3, 1, 4),
|
|
|
|
(4, 1, 5),
|
|
|
|
(5, 1, 6),
|
|
|
|
(6, 1, 7),
|
|
|
|
(7, 1, 8),
|
|
|
|
(8, 1, 9),
|
|
|
|
(9, 1, 10)"
|
|
|
|
|
2020-05-29 10:08:11 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="SELECT count() FROM minmax_idx WHERE i64 = 1;"
|
|
|
|
$CLICKHOUSE_CLIENT --query="SELECT count() FROM minmax_idx WHERE i64 = 5;"
|
2019-04-18 15:41:07 +00:00
|
|
|
|
2020-05-29 10:08:11 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="ALTER TABLE minmax_idx UPDATE i64 = 5 WHERE i64 = 1;"
|
|
|
|
wait_for_mutation "minmax_idx" "mutation_2.txt" "$CLICKHOUSE_DATABASE"
|
2019-04-18 15:41:07 +00:00
|
|
|
|
2020-05-29 10:08:11 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="SELECT count() FROM minmax_idx WHERE i64 = 1;"
|
|
|
|
$CLICKHOUSE_CLIENT --query="SELECT count() FROM minmax_idx WHERE i64 = 5;"
|
2019-04-18 15:41:07 +00:00
|
|
|
|
2020-05-29 10:08:11 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query="DROP TABLE minmax_idx"
|