You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot parse Nan (but NULL in TabSeparated format) #700
:) create table t1(f1 Nullable(String),f2 Nullable(Float64),f3 Nullable(Int64),f4 Nullable(DateTime),f5 Nullable(Float64)) engine = TinyLog;
CREATE TABLE t1
(
f1 Nullable(String),
f2 Nullable(Float64),
f3 Nullable(Int64),
f4 Nullable(DateTime),
f5 Nullable(Float64)
) ENGINE = TinyLog
Ok.
0 rows in set. Elapsed: 0.015 sec.
:) insert into t1(f2,f5,f3,f1,f4) FORMAT TSV \N 7.8 1111 aaa \N
INSERT INTO t1 (f2, f5, f3, f1, f4) FORMAT TSV
Ok.
1 rows in set. Elapsed: 0.001 sec.
:)
The problem is with ';' character: because the remainder of the query after 'FORMAT TSV' is fed into the TabSeparated parser as is, the semicolon is parsed as part of the data, not as the end of query.
Activity
ztlpn commentedon Apr 15, 2017
You can use \N for NULL values.
egorlitvinenko commentedon Apr 15, 2017
Do you have an example?
:) INSERT INTO hello_world.hello_world_table(f2,f5,f3,f1,f4) FORMAT TabSeparated \N 7.81651003481571E8 1886081650 zlwwqlbkvrksdt \N;
INSERT INTO hello_world.hello_world_table (f2, f5, f3, f1, f4) FORMAT TabSeparated
Exception on client:
Code: 27. DB::Exception: Cannot parse input: expected \t before: 7.81651003481571E8 1886081650 zlwwqlbkvrksdt \N;: (at row 1)
Row 1:
Column 0, name: f2, type: Nullable(Float64), parsed text: "N"
ERROR: garbage after Nullable(Float64): " 7.8165100"
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.54189.
I checked tabs again and:
:) INSERT INTO hello_world.hello_world_table(f2,f5,f3,f1,f4) FORMAT TabSeparated \N 7.81651003481571E8 1886081650 zlwwqlbkvrksdt \N;
INSERT INTO hello_world.hello_world_table (f2, f5, f3, f1, f4) FORMAT TabSeparated
Exception on client:
Code: 27. DB::Exception: Cannot parse input: expected \n before: ;: (at row 1)
Row 1:
Column 0, name: f2, type: Nullable(Float64), parsed text: "N"
Column 1, name: f5, type: Nullable(Float64), parsed text: "7.81651003481571E8"
Column 2, name: f3, type: Nullable(Int64), parsed text: "1886081650"
Column 3, name: f1, type: Nullable(String), parsed text: "zlwwqlbkvrksdt"
Column 4, name: f4, type: Nullable(DateTime), parsed text: "N"
ERROR: garbage after Nullable(DateTime): ";"
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.54189.
:)
egorlitvinenko commentedon Apr 15, 2017
Example data:
What choises are available to import it?
ztlpn commentedon Apr 15, 2017
Sure:
The problem is with ';' character: because the remainder of the query after 'FORMAT TSV' is fed into the TabSeparated parser as is, the semicolon is parsed as part of the data, not as the end of query.
ztlpn commentedon Apr 15, 2017
CSV parser does not recognize empty string as a NULL value, so you will have to manually insert '\N' where you want NULLs to be.
egorlitvinenko commentedon Apr 15, 2017
@ztlpn thanks for your help :)
alexey-milovidov commentedon Apr 20, 2017
We should implement
empty_as_null,null_string_as_nulland similar options.Merge pull request ClickHouse#700 from Altinity/fix_s3_path_style_no_…
NightlyChangelog: let an unplaced re-apply entry be merged on restora…
NightlyChangelog: a re-apply entry is optional when nothing it put ba…