Added test for parsing NULLs in various formats [#METR-19266].

This commit is contained in:
Alexey Milovidov 2016-12-30 09:18:57 +03:00
parent 81a08bcd87
commit 9a17c907b0
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,11 @@
\tHello 123 \N
\N 0 2000-01-01 00:00:00
Hello 123 \N
\N 0 2000-01-01 00:00:00
\\Hello 123 \N
\\N 0 2000-01-01 00:00:00
\N 123 \N
N \N 2000-01-01 00:00:00
\N 111 2000-01-01 00:00:00
\N \N
ab \N \N

View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e
echo -ne '\\tHello\t123\t\\N\n\\N\t\t2000-01-01 00:00:00\n' | clickhouse-local --format=TabSeparated --structure='s Nullable(String), x Nullable(UInt64), t Nullable(DateTime)' --query="SELECT * FROM table" 2>/dev/null
echo -ne 'Hello,123,\\N\n\\N,0,"2000-01-01 00:00:00"' | clickhouse-local --input-format=CSV --structure='s Nullable(String), x Nullable(UInt64), t Nullable(DateTime)' --query="SELECT * FROM table" 2>/dev/null
echo -ne '"\\Hello",123,\\N\n"\\N",0,"2000-01-01 00:00:00"' | clickhouse-local --input-format=CSV --structure='s Nullable(String), x Nullable(UInt64), t Nullable(DateTime)' --query="SELECT * FROM table" 2>/dev/null
echo -ne '{"s" : null, "x" : 123}, {"s" : "\N", "t":"2000-01-01 00:00:00"}' | clickhouse-local --input-format=JSONEachRow --structure='s Nullable(String), x Nullable(UInt64), t Nullable(DateTime)' --query="SELECT * FROM table" 2>/dev/null
echo "(NULL, 111, '2000-01-01 00:00:00'), ('\N', NULL, NULL), ('a\Nb', NULL, NULL)" | clickhouse-local --input-format=Values --structure='s Nullable(String), x Nullable(UInt64), t Nullable(DateTime)' --query="SELECT * FROM table" 2>/dev/null