Jens Geyer created CASSANDRA-21131:
--------------------------------------

             Summary: CSV Export and Import changes data unexpectedly
                 Key: CASSANDRA-21131
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21131
             Project: Apache Cassandra
          Issue Type: Bug
            Reporter: Jens Geyer


I'm following the example gine at the docs, just slightly changed: 
https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlshCopy.html

{code}
CREATE KEYSPACE cycling  WITH REPLICATION = { 'class' : 
'NetworkTopologyStrategy', 'datacenter1' : 1 } ;
CREATE TABLE cycling.cyclist_name ( id UUID PRIMARY KEY, lastname text, 
firstname text ) ;

INSERT INTO cycling.cyclist_name (id, lastname, firstname) 
   VALUES (5b6962dd-3f90-4c93-8f61-eabfa4a803e2, 'VOS','Marianne');

INSERT INTO cycling.cyclist_name (id, lastname, firstname) 
   VALUES (88888888-8888-8888-8888-888888888888, 'V\S','\"Marianne"\');

SELECT * FROM cycling.cyclist_name ;
{code}

This gives:
{code}
 id                                   | firstname      | lastname
--------------------------------------+----------------+----------
 5b6962dd-3f90-4c93-8f61-eabfa4a803e2 |       Marianne |      VOS
 88888888-8888-8888-8888-888888888888 | \\"Marianne"\\ |     V\\S

(2 rows)
{code}

Now export to a file, then import from the very same file:

{code}
COPY cycling.cyclist_name TO 'cyclist.csv' WITH HEADER = TRUE ;
TRUNCATE cycling.cyclist_name ;
COPY cycling.cyclist_name FROM 'cyclist.csv' WITH HEADER = TRUE ;
SELECT * FROM cycling.cyclist_name ;
{code}

Now the result is this:
{code}
 id                                   | firstname          | lastname
--------------------------------------+--------------------+----------
 5b6962dd-3f90-4c93-8f61-eabfa4a803e2 |           Marianne |      VOS
 88888888-8888-8888-8888-888888888888 | \\\\"Marianne"\\\\ |   V\\\\S

(2 rows)
{code}

I did not change any data in between. Just export and reimport.






--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to