Merge pull request #34454 from kitaisreal/dictionary-get-http-json-test

Added test 33734
This commit is contained in:
Maksim Kita 2022-02-09 17:21:03 +01:00 committed by GitHub
commit e0dfc9cd38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,24 @@
0 Value
{
"meta":
[
{
"name": "dictGet(02154_test_dictionary, 'value', toUInt64(0))",
"type": "String"
},
{
"name": "dictGet(02154_test_dictionary, 'value', toUInt64(1))",
"type": "String"
}
],
"data":
[
{
"dictGet(02154_test_dictionary, 'value', toUInt64(0))": "Value",
"dictGet(02154_test_dictionary, 'value', toUInt64(1))": ""
}
],
"rows": 1
}

View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS 02154_test_source_table"
$CLICKHOUSE_CLIENT -q """
CREATE TABLE 02154_test_source_table
(
id UInt64,
value String
) ENGINE=TinyLog;
"""
$CLICKHOUSE_CLIENT -q "INSERT INTO 02154_test_source_table VALUES (0, 'Value')"
$CLICKHOUSE_CLIENT -q "SELECT * FROM 02154_test_source_table"
$CLICKHOUSE_CLIENT -q "DROP DICTIONARY IF EXISTS 02154_test_dictionary"
$CLICKHOUSE_CLIENT -q """
CREATE DICTIONARY 02154_test_dictionary
(
id UInt64,
value String
)
PRIMARY KEY id
LAYOUT(HASHED())
LIFETIME(0)
SOURCE(CLICKHOUSE(TABLE '02154_test_source_table'))
"""
echo """
SELECT dictGet(02154_test_dictionary, 'value', toUInt64(0)), dictGet(02154_test_dictionary, 'value', toUInt64(1))
FORMAT JSON
""" | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL}&wait_end_of_query=1&output_format_write_statistics=0" -d @-
$CLICKHOUSE_CLIENT -q "DROP DICTIONARY 02154_test_dictionary"
$CLICKHOUSE_CLIENT -q "DROP TABLE 02154_test_source_table"