Cassandra: Unable to import null value from csv

2019-07-25 12:54发布

I am trying to import a csv file to Cassandra. The csv file has been generated from Postgres and it contains some null values.

Cassandra version:

[cqlsh 5.0.1 | Cassandra 3.5 | CQL spec 3.4.0 | Native protocol v4]

I am using this query to import:

copy reports (id,name,user_id,user_name,template_id,gen_epoch,exp_epoch,file_name,format,refile_size,is_sch,job_id,status,status_msg) from '/home/reports.csv' with NULL='' and header=true and DELIMITER = ',';

I keep on receiving this error:

Failed to import 66 rows: ParseError - invalid literal for int() with base 10: '', given up without retries

However, when I changed all the null values to some random value, I was able to import that row using the same command. I have already tried all the solutions I found on internet. Please advise.

1条回答
冷血范
2楼-- · 2019-07-25 13:35

This looks like a Cassandra bug (see https://issues.apache.org/jira/browse/CASSANDRA-11549). I haven't been able to find a way to get Cassandra to accept the nulls. You may have to stick with a workaround for now substitute some sentinel value for the nulls.

查看更多
登录 后发表回答