Paweł Andrzej Hadam
Paweł Andrzej Hadam

Reputation: 161

Cannot COPY NULL into INT (TIMESTAMP) column in Cassandra

I have a table in Cassandra (cqlsh 5.0.1 | Cassandra 3.5.0):

CREATE TABLE IF NOT EXISTS tytandb.test1

( BS_CUSTOMER_ID INT,

CRM_CUSTOMER_ID INT,

ID INT,

PRIMARY KEY (BS_CUSTOMER_ID) );

And I have a CSV file:

"BS_CUSTOMER_ID","CRM_CUSTOMER_ID","ID"

"1179","4","4"

"1226","122","122"

"1237","161",""

And I am loading this file in CQLSH with this command:

COPY TEST1 (BS_CUSTOMER_ID, CRM_CUSTOMER_ID, ID) FROM 't_customers_13.csv' WITH HEADER = 'true' AND DELIMITER = ',' AND QUOTE = '"' AND NULL = '';

And I am receiving this error message:

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

It is the 3rd value (NULL) in the last line that causes the error.

Why I cannot copy NULL (empty value) into an INT column? And what I can do to copy NULL into INT columns?

I have the same problem with TIMESTAMP columns.

With VARCHAR it's OK and I can copy NULL values into VARCHAR columns.

Any ideas?

Upvotes: 0

Views: 1247

Answers (1)

Paweł Andrzej Hadam
Paweł Andrzej Hadam

Reputation: 161

I have found a bug description in JIRA:

https://issues.apache.org/jira/browse/CASSANDRA-11549

And the patch worked for me both on Linux and Windows:

https://github.com/stef1927/cassandra/commit/6e7664380bb6ddea37efd5f866b7631fdc84bdac

Upvotes: 0

Related Questions