Inserting empty columns

271 views
Skip to first unread message

Saptarshi Gan

unread,
Feb 11, 2018, 5:04:59 AM2/11/18
to ClickHouse
How to insert into table even if data has empty columns?

 echo "ATY,2018-02-01,64.76,66.25,64.63,,65.8,685750.0,\n"|clickhouse-client --query="INSERT INTO data FORMAT CSV"
so the column after 64.63 is empty as but the parser is not parsing it as empty, rather it's parsing the value as comma.

Code: 72. DB::Exception: Cannot read floating point value: (at row 1)

Row 1:
Column 0,   name: symbol,     type: String,  parsed text: "ATY"
Column 1,   name: date,       type: Date,    parsed text: "2018-02-01"
Column 2,   name: open,       type: Float64, parsed text: "64.76"
Column 3,   name: high,       type: Float64, parsed text: "66.25"
Column 4,   name: low,        type: Float64, parsed text: "64.63"
Column 5,   name: settlement, type: Float64, ERROR: text ",65.8,6857" is not like Float64

How to insert even if it has empty column?

Saptarshi Gan

unread,
Feb 12, 2018, 1:32:20 AM2/12/18
to ClickHouse
Also I think the behaviour has changed in some recent version of clickhouse. Previously it accepted blank columns..but now it complains about it

Alex Zatelepin

unread,
Feb 12, 2018, 10:57:01 AM2/12/18
to ClickHouse
Yes, in recent versions empty strings for floating-point values generate exceptions instead of being parsed as zero values. The culprit is the new parsing code for floats introduced in the issue #1665.

The documentation states that parsing of empty strings is implementation-specific. But as our users are accustomed to empty strings being parsed as the corresponding zero values, we should probably bring this behaviour back. You can track progress here: https://github.com/yandex/ClickHouse/issues/1832
Reply all
Reply to author
Forward
0 new messages