ClickHouse/tests/queries/0_stateless/02419_keeper_map_primary_key.sh

24 lines
808 B
Bash
Raw Normal View History

2022-09-08 12:45:36 +00:00
#!/usr/bin/env bash
2022-09-09 12:24:26 +00:00
# Tags: no-ordinary-database, no-fasttest, long
2022-09-08 12:45:36 +00:00
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS 02419_test SYNC;"
test_primary_key()
{
$CLICKHOUSE_CLIENT -nm -q "
CREATE TABLE 02419_test (key UInt64, value Float64) Engine=KeeperMap('/' || currentDatabase() || '/test2418', 3) PRIMARY KEY($1);
INSERT INTO 02419_test VALUES (1, 1.1), (2, 2.2);
SELECT value FROM 02419_test WHERE key = 1;
SELECT value FROM 02419_test WHERE key IN (2, 3);
DROP TABLE 02419_test SYNC;
"
}
test_primary_key "sipHash64(key + 42) * 12212121212121"
test_primary_key "reverse(concat(CAST(key, 'String'), 'some string'))"
test_primary_key "hex(toFloat32(key))"