ClickHouse/tests/queries/0_stateless/02118_deserialize_whole_text.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
4.4 KiB
Bash
Raw Normal View History

2021-11-16 13:16:13 +00:00
#!/usr/bin/env bash
# Tags: no-fasttest, no-parallel, no-replicated-database
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
USER_FILES_PATH=$($CLICKHOUSE_CLIENT_BINARY --query "select _path,_file from file('nonexist.txt', 'CSV', 'val1 char')" 2>&1 | grep Exception | awk '{gsub("/nonexist.txt","",$9); print $9}')
2021-11-16 13:16:13 +00:00
DATA_FILE=$USER_FILES_PATH/data_02118
echo "[\"[1,2,3]trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x Array(UInt32)')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"1970-01-02trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x Date')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"1970-01-02trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x Date32')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"1970-01-01 03:00:01trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x DateTime')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"1970-01-01 03:00:01.0000trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x DateTime64(4)')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"42trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x UInt32')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"42.4242trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x Decimal32(4)')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"255.255.255.255trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x IPv4')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "255.255.255.255trash" > $DATA_FILE
2023-01-19 15:55:30 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'TSV', 'x IPv4')" 2>&1 | grep -F -q "CANNOT_PARSE_INPUT_ASSERTION_FAILED" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "255.255.255.255trash" > $DATA_FILE
2023-01-19 15:55:30 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'CSV', 'x IPv4')" 2>&1 | grep -F -q "INCORRECT_DATA" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"255.255.255.255trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactEachRow', 'x IPv4')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
2022-03-24 12:45:04 +00:00
echo "[\"0000:0000:0000:0000:0000:ffff:192.168.100.228b1trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x IPv6')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
2022-03-24 12:45:04 +00:00
echo "0000:0000:0000:0000:0000:ffff:192.168.100.228b1trash" > $DATA_FILE
2023-01-19 15:55:30 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'TSV', 'x IPv6')" 2>&1 | grep -F -q "CANNOT_PARSE_INPUT_ASSERTION_FAILED" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
2022-03-24 12:45:04 +00:00
echo "0000:0000:0000:0000:0000:ffff:192.168.100.228b1trash" > $DATA_FILE
2023-01-19 15:55:30 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'CSV', 'x IPv6')" 2>&1 | grep -F -q "INCORRECT_DATA" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
2022-03-24 12:45:04 +00:00
echo "[\"0000:0000:0000:0000:0000:ffff:192.168.100.228b1trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactEachRow', 'x IPv6')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"{1:2, 2:3}trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x Map(UInt32, UInt32)')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"(1, 2)trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x Tuple(UInt32, UInt32)')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
echo "[\"ed9fd45d-6287-47c1-ad9f-d45d628767c1trash\"]" > $DATA_FILE
2021-11-19 14:58:05 +00:00
$CLICKHOUSE_CLIENT -q "SELECT * FROM file('data_02118', 'JSONCompactStringsEachRow', 'x UUID')" 2>&1 | grep -F -q "UNEXPECTED_DATA_AFTER_PARSED_VALUE" && echo 'OK' || echo 'FAIL'
2021-11-16 13:16:13 +00:00
rm $DATA_FILE