Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 40C26200C53 for ; Tue, 11 Apr 2017 13:36:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3F579160BA3; Tue, 11 Apr 2017 11:36:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 873A8160B89 for ; Tue, 11 Apr 2017 13:36:45 +0200 (CEST) Received: (qmail 62946 invoked by uid 500); 11 Apr 2017 11:36:44 -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 62935 invoked by uid 99); 11 Apr 2017 11:36:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Apr 2017 11:36:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 37A2F18056F for ; Tue, 11 Apr 2017 11:36:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id IPokY2hT0WSa for ; Tue, 11 Apr 2017 11:36:43 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 016EB5FC83 for ; Tue, 11 Apr 2017 11:36:43 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6FA6FE0D3C for ; Tue, 11 Apr 2017 11:36:42 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id B334824066 for ; Tue, 11 Apr 2017 11:36:41 +0000 (UTC) Date: Tue, 11 Apr 2017 11:36:41 +0000 (UTC) From: "Christophe (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (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 archived-at: Tue, 11 Apr 2017 11:36:46 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-8675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15964228#comment-15964228 ] Christophe commented on CASSANDRA-8675: --------------------------------------- This COPY FROM issue should be considered a real bug. If someone runs COPY TO followed by COPY FROM, it is reasonable to expect that the data loaded should exactly matched the data extracted. But because if this issue, that's not the case when the original data contains string with escaped characters. > COPY TO/FROM broken for newline characters > ------------------------------------------ > > Key: CASSANDRA-8675 > URL: https://issues.apache.org/jira/browse/CASSANDRA-8675 > Project: Cassandra > Issue Type: Bug > 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: cqlsh > Fix For: 2.1.3 > > 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> 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, since we can't rename tables? -- This message was sent by Atlassian JIRA (v6.3.15#6346)