Add stateless test for JSONCompactWithProgress output format

This commit is contained in:
Alexey Korepanov 2024-07-23 15:04:05 +01:00
parent ef4ad01d7d
commit f3710e9a29
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,14 @@
1
{"meta": [{"name":"value", "type":"UInt8"}, {"name":"name", "type":"String"}]}}
{"data":[1, "a"]}
{"data":[2, "b"]}
{"data":[3, "c"]}
{"progress":{"read_rows":"3","read_bytes":"33","written_rows":"0","written_bytes":"0","total_rows_to_read":"3","result_rows":"0","result_bytes":"0","elapsed_ns":"ELAPSED_NS"}}
{"statistics": {"rows":3, "elapsed":ELAPSED, "rows_read":3, "bytes_read":33}}
2
{"meta": [{"name":"name", "type":"String"}, {"name":"c", "type":"UInt64"}]}}
{"data":["a", "1"]}
{"data":["b", "1"]}
{"data":["c", "1"]}
{"totals": ["", "3"]}}
{"statistics": {"rows":3, "elapsed":ELAPSED, "rows_read":3, "bytes_read":30}}

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Tags: no-fasttest, no-parallel
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 test_table;"
$CLICKHOUSE_CLIENT -q "SELECT 1;"
# Check JSONCompactWithProgress Output
$CLICKHOUSE_CLIENT -q "CREATE TABLE test_table (value UInt8, name String) ENGINE = MergeTree() ORDER BY value;"
$CLICKHOUSE_CLIENT -q "INSERT INTO test_table VALUES (1, 'a'), (2, 'b'), (3, 'c');"
$CLICKHOUSE_CLIENT -q "SELECT * FROM test_table FORMAT JSONCompactWithProgress settings max_block_size=2;" | sed -E 's/"elapsed_ns":"[0-9]+"/"elapsed_ns":"ELAPSED_NS"/g; s/"elapsed":[0-9]+\.[0-9]+/"elapsed":ELAPSED/g'
$CLICKHOUSE_CLIENT -q "SELECT 2;"
# Check Totals
$CLICKHOUSE_CLIENT -q "SELECT name, count() AS c FROM test_table GROUP BY name WITH TOTALS ORDER BY name FORMAT JSONCompactWithProgress settings max_block_size=2;" | sed -E 's/"elapsed_ns":"[0-9]+"/"elapsed_ns":"ELAPSED_NS"/g; s/"elapsed":[0-9]+\.[0-9]+/"elapsed":ELAPSED/g'
$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test_table;"