Question

AM using the copy method for cpying the .csv file into the cassandra tables.. But am getting records mismatch error..

Record 41(Line 41) has mismatched number of records (85 instead of 82)

This is happening for all the .csv files & all the .csv files are system generated..

Any work around for this error..?

Was it helpful?

Solution

Based on your error message, it sounds like the copy command is working for you, until record 41. What are you using as a delimiter? The default delimiter for the COPY command is a comma, and I'll bet that your data has some additional commas in it on line 41.

A few options:

  • Edit your data and remove the extra commas.
  • Alter your .csv file to encapsulate the values of all of your fields in double-quotes, as COPY's default QUOTE value is ". This will allow you to leave the in-text commas.
  • Alter your .csv file to delimit with pipes | instead of a comma, and set the COPY command's DELIMITER option to |.
  • Try using either the Cassandra bulk loader or json2sstable utility to import your data. I've never used them, but I would bet you'll have similar problems if you have commas in your data set.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top