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
For numeric types and String, empty is parsed as zero/empty string (this behaviour was from the beginning).
Example:
:) CREATE TABLE test.csv (a String, b UInt64, c Int64, d String) ENGINE = Log
...
$ echo ',,,' | clickhouse-client --query="INSERT INTO test.csv FORMAT CSV"
...
:) SELECT * FROM test.csv
┌─a─┬─b─┬─c─┬─d─┐
│ │ 0 │ 0 │ │
└───┴───┴───┴───┘
But it is not implemented for Date, DateTime, Array and other data types.
If you have empty instead of Date/DateTime, parser will look for next field at 10/19 bytes forward, and will be confused with it.
I am going to implement the intended behaviour for Date, DateTime too.
We have implicit default values for Date and DateTime - 0000-00-00 and 0000-00-00 00:00:00.
The problem is not with default values, but that empty string is not parsed as default in CSV.
In TSV Nulls are represened as \N
Usually you can check exactly which format clickhouse expect to see by writing few rows in that format by clickhouse. I.e.
Trying to load data into the table and its throwing error which is not in specific
Table:
CREATE TABLE i2.company_temp (
a UInt32,
b String,
c String,
.....
......
) ENGINE = MergeTree PARTITION BY state_province_code
ORDER BY
domain SETTINGS index_granularity = 8192
Insert statement:
clickhouse-client -h1.0.1.2.3 -u default --password xxxx --query="INSERT INTO insightbasev2.company_temp FORMAT CSV" </temp/company_1/3.csv
Error:
Syntax error: failed at position 1:
clickhouse-client -h1.0.1.2.3 -u default --password xxxx --query="INSERT INTO insightbasev2.company_temp FORMAT CSV" </temp/company_1/4.csv
Expected one of: CREATE, ATTACH, DETACH, DROP, SHOW, SELECT, WITH, DESC, SYSTEM query, AST, list of elements, ALTER query, ALTER TABLE, CREATE TABLE or ATTACH TABLE query, Query with output, SHOW PROCESSLIST query, SHOW PROCESSLIST, RENAME query, RENAME TABLE, SELECT query, possibly with UNION, SET query, SHOW [TEMPORARY] TABLES|DATABASES [[NOT] LIKE 'str'], EXISTS or SHOW CREATE query, SELECT query, subquery, possibly with UNION, USE query, SELECT subquery, CHECK TABLE, DESCRIBE query, DROP query, EXISTS, TRUNCATE, INSERT query, INSERT INTO, KILL QUERY query, KILL QUERY, OPTIMIZE query, OPTIMIZE TABLE, SELECT query, DESCRIBE, Query, USE, SET
Activity
alexey-milovidov commentedon Aug 22, 2016
Acknowledged. Will do.
alexey-milovidov commentedon Aug 22, 2016
It is already supported for numeric types and String. But not for Date, DateTime.
trivita commentedon Aug 23, 2016
thanks, you mean the git version?
i'm still getting this
'Column 10, name: IsStored, type: UInt8, ERROR: text "22" is not like UInt8'
imho, this shouldnt be a problem. IsStored should be zero(default value)
alexey-milovidov commentedon Aug 23, 2016
For numeric types and String, empty is parsed as zero/empty string (this behaviour was from the beginning).
Example:
But it is not implemented for Date, DateTime, Array and other data types.
If you have empty instead of Date/DateTime, parser will look for next field at 10/19 bytes forward, and will be confused with it.
I am going to implement the intended behaviour for Date, DateTime too.
trivita commentedon Aug 24, 2016
ehh, yeah, but not seem to work with TabSeparatedWithNames
Column 10, name: IsStored, type: UInt8, ERROR: text "<TAB><TAB>2<TAB>2<TAB><TAB><TAB><TAB><TAB>" is not like UInt8alexey-milovidov commentedon Aug 24, 2016
Could you please provide complete example, because trivial examples working:
CREATE TABLE test.tsv (a String, b UInt64, c Int64, d String) ENGINE = LogMaybe it works just accidently.
seufagner commentedon Jul 27, 2017
@alexey-milodov Do you just implements default value to Date, DateTime? I can do this :)
alexey-milovidov commentedon Jul 27, 2017
We have implicit default values for Date and DateTime -
0000-00-00and0000-00-00 00:00:00.The problem is not with default values, but that empty string is not parsed as default in CSV.
sunsingerus commentedon Oct 31, 2017
Hello!
It looks like Data type is still have issues with default values while reading from CSV file.
Have the following situation right now:
CSV file
All is OK
CSV file with empty Date field
run
clickhouse-client installed of the following version
Please, advise...
Thanks!
kmatt commentedon Feb 23, 2018
I'm also seeing the error when tab delimited data to numeric types is not parsed when column values are empty:
ERROR: text "<TAB><TAB><TAB><TAB><TAB><TAB>5135" is not like UInt64abdrakhmanov commentedon May 2, 2018
i have similar problem. For example:
Insertion in tabix work fine:
Insert query in command-line doesn't work:
What am I doing wrong?
filimonov commentedon May 10, 2018
In TSV Nulls are represened as \N
Usually you can check exactly which format clickhouse expect to see by writing few rows in that format by clickhouse. I.e.
Crazylearner30 commentedon Dec 17, 2018
Trying to load data into the table and its throwing error which is not in specific
Table:
CREATE TABLE i2.company_temp (
a UInt32,
b String,
c String,
.....
......
) ENGINE = MergeTree PARTITION BY state_province_code
ORDER BY
domain SETTINGS index_granularity = 8192
Insert statement:
clickhouse-client -h1.0.1.2.3 -u default --password xxxx --query="INSERT INTO insightbasev2.company_temp FORMAT CSV" </temp/company_1/3.csv
Error:
Syntax error: failed at position 1:
clickhouse-client -h1.0.1.2.3 -u default --password xxxx --query="INSERT INTO insightbasev2.company_temp FORMAT CSV" </temp/company_1/4.csv
Expected one of: CREATE, ATTACH, DETACH, DROP, SHOW, SELECT, WITH, DESC, SYSTEM query, AST, list of elements, ALTER query, ALTER TABLE, CREATE TABLE or ATTACH TABLE query, Query with output, SHOW PROCESSLIST query, SHOW PROCESSLIST, RENAME query, RENAME TABLE, SELECT query, possibly with UNION, SET query, SHOW [TEMPORARY] TABLES|DATABASES [[NOT] LIKE 'str'], EXISTS or SHOW CREATE query, SELECT query, subquery, possibly with UNION, USE query, SELECT subquery, CHECK TABLE, DESCRIBE query, DROP query, EXISTS, TRUNCATE, INSERT query, INSERT INTO, KILL QUERY query, KILL QUERY, OPTIMIZE query, OPTIMIZE TABLE, SELECT query, DESCRIBE, Query, USE, SET
any suggestion will be appreciated
filimonov commentedon Dec 17, 2018
@DivyaRao30 please don't duplicate your comments. I've answered you in #3847
filimonov commentedon May 10, 2019
Let's continue the discussion in #469 to have a clearer backlog.
elenbaskakova-DOCSUP-784 (#79)