You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Aleksey Yeschenko (JIRA)" <ji...@apache.org> on 2012/11/12 17:35:12 UTC

[jira] [Resolved] (CASSANDRA-4923) cqlsh COPY FROM command requires primary key in first column of CSV

     [ https://issues.apache.org/jira/browse/CASSANDRA-4923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksey Yeschenko resolved CASSANDRA-4923.
------------------------------------------

    Resolution: Won't Fix

The issue is caused by a CQL2 limitation (the primary key must come first in the INSERT query) and doesn't affect cqlsh in CQL3 mode.
Making this work with CQL2 will require some nasty special-casing. It's not worth the extra complexity.
Users affected by this will have to rearrange the csv file before importing it.
                
> cqlsh COPY FROM command requires primary key in first column of CSV
> -------------------------------------------------------------------
>
>                 Key: CASSANDRA-4923
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4923
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 1.1.5, 1.2.0 beta 1
>            Reporter: J.B. Langston
>            Assignee: Aleksey Yeschenko
>              Labels: cqlsh
>
> The cqlsh COPY FROM command requires the primary key to be in the first column of the CSV, even if the field list shows that the primary key is in a different position.
> Test data available from ftp://ftp.census.gov/Econ2001_And_Earlier/CBP_CSV/cbp01us.txt
> CREATE TABLE cbp01us ( 
>            naics text PRIMARY KEY 
>            ) WITH 
>            comment='' AND 
>            comparator=text AND 
>            read_repair_chance=0.100000 AND 
>            gc_grace_seconds=864000 AND 
>            default_validation=text AND 
>            min_compaction_threshold=4 AND 
>            max_compaction_threshold=32 AND 
>            replicate_on_write='true' AND 
>            compaction_strategy_class='SizeTieredCompactionStrategy' AND 
>            compression_parameters:sstable_compression='SnappyCompressor';
> copy cbp01us (uscode,naics,empflag,emp,qp1,ap,est,f1_4,e1_4,q1_4,a1_4,n1_4,f5_9,e5_9,q5_9,a5_9,n5_9,f10_19,e10_19,q10_19,a10_19,n10_19,f20_49,e20_49,q20_49,a20_49,n20_49,f50_99,e50_99,q50_99,a50_99,n50_99,f100_249,e100_249,q100_249,a100_249,n100_249,f250_499,e250_499,q250_499,a250_499,n250_499,f500_999,e500_999,q500_999,a500_999,n500_999,f1000,e1000,q1000,a1000,n1000) from 'cbp01us.txt' with header=true;
> Bad Request: Expected key 'NAICS' to be present in WHERE clause for 'cbp01us'
> Aborting import at record #0 (line 1). Previously-inserted values still present.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira