bigdata123
bigdata123

Reputation: 463

Cassandra COPY command failing

When i'm trying to insert data which is csv file delimited by ; into a cassandra table using COPY command i'm facing below error:

ErrorMessage code=000a [Protocol error] message="Cannot decode string as UTF8:

'e23fa22f2[...truncated by author...]6f742c2e2729';

java.nio.charset.MalformedInputException: Input length = 1"> Aborting
import at record #252. Previously inserted records are still present,
and some records after that may be present as well.

My CQL query is

copy retail.products_by_id (product_id,product_name,price,supplier_id,supplier_name,category_id,category_name,release_date,description) FROM '/home/centos/retail_data/prod1_new.txt' WITH DELIMITER = ';' AND HEADER=true;

Not sure what's wrong.Is there any issue with data? My file size is 20MB Need suggestions as how to fix this issue

Upvotes: 0

Views: 476

Answers (2)

Mandraenke
Mandraenke

Reputation: 3266

Open your CSV in a good editor and have a deep look at the 252th line of your data (start counting after the headers). There or a line bevore will be an error - and/or your data is not text but a blob.

Upvotes: 0

Chris Lohfink
Chris Lohfink

Reputation: 16400

The 252nd record in /home/centos/retail_data/prod1_new.txt is invalid. Should be able to open it up in an editor and go to that line to see it.

Upvotes: 0

Related Questions