2021-05-09 09:12:21 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck source=../shell_config.sh
|
|
|
|
. "$CUR_DIR"/../shell_config.sh
|
|
|
|
|
2023-01-18 10:51:27 +00:00
|
|
|
|
|
|
|
# In [1] PREALLOCATE attribute had been added for HASHED dictionaries,
|
|
|
|
# but it had been removed in [2].
|
|
|
|
#
|
|
|
|
# [1]: https://github.com/ClickHouse/ClickHouse/pull/23979
|
|
|
|
# [2]: https://github.com/ClickHouse/ClickHouse/pull/45388
|
|
|
|
#
|
|
|
|
# This is a backward compatiblity test that you can create dictionary with
|
|
|
|
# PREALLOCATE attribute (and also for the history/greppability, that it was
|
|
|
|
# such).
|
|
|
|
|
2021-05-09 09:12:21 +00:00
|
|
|
$CLICKHOUSE_CLIENT -nm -q "
|
|
|
|
DROP TABLE IF EXISTS data_01509;
|
|
|
|
DROP DICTIONARY IF EXISTS dict_01509;
|
|
|
|
CREATE TABLE data_01509
|
|
|
|
(
|
|
|
|
key UInt64,
|
|
|
|
value String
|
|
|
|
)
|
|
|
|
ENGINE = MergeTree()
|
|
|
|
ORDER BY key;
|
|
|
|
INSERT INTO data_01509 SELECT number key, toString(number) value FROM numbers(10e3);
|
|
|
|
|
|
|
|
CREATE DICTIONARY dict_01509
|
|
|
|
(
|
|
|
|
key UInt64,
|
|
|
|
value String DEFAULT '-'
|
|
|
|
)
|
|
|
|
PRIMARY KEY key
|
|
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() TABLE 'data_01509'))
|
|
|
|
LAYOUT(SPARSE_HASHED(PREALLOCATE 1))
|
|
|
|
LIFETIME(0);
|
2023-01-18 10:51:27 +00:00
|
|
|
SYSTEM RELOAD DICTIONARY dict_01509;
|
|
|
|
" |& grep -o "HashedDictionary: .*"
|