I’m using the COPY FROM cqlsh command to import Tab Separated Values.
If I use DELIMITER='t'
cassandra shows the error "delimiter" must be a 1-character string
.
I found this old question from 2014 and it appeared that this was a bug fixed 10 years ago. Maybe reintroduced? how to load .tsv files into cassandra
I’m using the latest cassandra docker image.
I can reproduce it like this test.cql
:
CREATE KEYSPACE IF NOT EXISTS test WITH
REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : '1' };
CREATE TABLE IF NOT EXISTS test.simple_table (
id int PRIMARY KEY,
value text
);
COPY test.simple_table (id, value) FROM '/tmp/import_data.tsv' WITH HEADER=false AND DELIMITER='t';
Create a simple test file and run the previous script:
$ echo -e "1tval1n2tval2" > test.tsv
$ docker run --rm --network cassandra-net -v "$(pwd)/test.cql:/scripts/import_cmd.cql" -v "$(pwd)/test.tsv:/tmp/import_data.tsv" -e CQLSH_HOST=cassandra-host -e CQLSH_PORT=9042 cassandra /opt/cassandra/bin/cqlsh -f "/scripts/import_cmd.cql"
WARNING: cqlsh was built against 5.0.0, but this server is 4.1.6. All features may not work!
Using 3 child processes
Starting copy of test.simple_table with columns [id, value].
/scripts/import_cmd.cql:12:"delimiter" must be a 1-character string
If I change the data to use another character as delimiter it works, but it’s not ideal.
1
Thanks for bringing this to our attention. It appears to be a bug, possibly a regression since it used to work in older versions.
It would be great if you could log a Jira ticket so we can fix it. Cheers!