Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C7BCA17A01 for ; Fri, 23 Jan 2015 15:41:35 +0000 (UTC) Received: (qmail 52818 invoked by uid 500); 23 Jan 2015 15:41:35 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 52784 invoked by uid 500); 23 Jan 2015 15:41:35 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 52575 invoked by uid 99); 23 Jan 2015 15:41:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jan 2015 15:41:35 +0000 Date: Fri, 23 Jan 2015 15:41:35 +0000 (UTC) From: "Lex Lythius (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CASSANDRA-8675) COPY TO/FROM broken for newline characters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-8675?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Lex Lythius updated CASSANDRA-8675: ----------------------------------- Attachment: copytest.csv > COPY TO/FROM broken for newline characters > ------------------------------------------ > > Key: CASSANDRA-8675 > URL: https://issues.apache.org/jira/browse/CASSANDRA-8675 > Project: Cassandra > Issue Type: Bug > Components: Core > Environment: [cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3] > Ubuntu 14.04 64-bit > Reporter: Lex Lythius > Labels: cql > Attachments: copytest.csv > > > Exporting/importing does not preserve contents when texts containing newline (and possibly other) characters are involved: > {code:sql} > cqlsh:test> create table if not exists copytest (id int primary key, t text); > cqlsh:test> insert into copytest (id, t) values (1, 'This has a newline > ... character'); > cqlsh:test> insert into copytest (id, t) values (2, 'This has a quote " character'); > cqlsh:test> insert into copytest (id, t) values (3, 'This has a fake tab \t character (typed backslash, t)'); > cqlsh:test> select * from copytest; > id | t > ----+--------------------------------------------------------- > 1 | This has a newline\ncharacter > 2 | This has a quote " character > 3 | This has a fake tab \t character (entered slash-t text) > (3 rows) > cqlsh:test> copy copytest to '/tmp/copytest.csv'; > 3 rows exported in 0.034 seconds. > cqlsh:test> > cqlsh:test> copy copytest to '/tmp/copytest.csv'; > 3 rows exported in 0.034 seconds. > cqlsh:test> copy copytest from '/tmp/copytest.csv'; > 3 rows imported in 0.005 seconds. > cqlsh:test> select * from copytest; > id | t > ----+------------------------------------------------------- > 1 | This has a newlinencharacter > 2 | This has a quote " character > 3 | This has a fake tab \t character (typed backslash, t) > (3 rows) > {code} > I tried replacing \n in the CSV file with \\n, which just expands to \n in the table; and with an actual newline character, which fails with error since it prematurely terminates the record. > It seems backslashes are only used to take the following character as a literal > Until this is fixed, what would be the best way to refactor an old table with a new, incompatible structure maintaining its content and name? -- This message was sent by Atlassian JIRA (v6.3.4#6332)