mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
7d046b24e6
With '\n...' after the query [1] clickhouse-client prefer data from the INSERT over from stdin, and produce very tricky message: Code: 27. DB::Exception: Cannot parse input: expected '\n' before: ' ': (at row 1) Well for TSV it is ok, but for RowBinary: Code: 33. DB::Exception: Cannot read all data. Bytes read: 1. Bytes expected: 4. So improve error message by adding the source of data for INSERT. [1]: clickhouse-client -q "INSERT INTO data FORMAT TSV\n " <<<2
16 lines
959 B
Bash
Executable File
16 lines
959 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
${CLICKHOUSE_CLIENT} -q "DROP TABLE IF EXISTS data"
|
|
${CLICKHOUSE_CLIENT} -q "CREATE TABLE data (key Int) Engine=Memory()"
|
|
${CLICKHOUSE_CLIENT} --input_format_parallel_parsing=0 -q "INSERT INTO data SELECT key FROM input('key Int') FORMAT TSV" <<<10
|
|
# with '\n...' after the query clickhouse-client prefer data from the query over data from stdin, and produce very tricky message:
|
|
# Code: 27. DB::Exception: Cannot parse input: expected '\n' before: ' ': (at row 1)
|
|
# well for TSV it is ok, but for RowBinary:
|
|
# Code: 33. DB::Exception: Cannot read all data. Bytes read: 1. Bytes expected: 4.
|
|
# so check that the exception message contain the data source.
|
|
${CLICKHOUSE_CLIENT} --input_format_parallel_parsing=0 -q "INSERT INTO data FORMAT TSV
|
|
" <<<2 |& grep -F -c 'data for INSERT was parsed from query'
|
|
${CLICKHOUSE_CLIENT} -q "SELECT * FROM data"
|