That looks like it may be a bug, can you raise a ticket at https://issues.apache.org/jira/browse/CASSANDRA
Cheers ----------------- Aaron Morton Freelance Cassandra Consultant New Zealand @aaronmorton http://www.thelastpickle.com On 21/06/2013, at 1:56 AM, hiroshi.kise...@hitachi.com wrote: > > Dear everyone. > > I'm Hiroshi Kise. > I will confirm with cqlsh of Cassandra-1.2.5, the behavior of the export / > import of data. > Using the Copy of cqlsh, the data included the “{“ and “[“ (= CollectionType) > case, > I think in the export / import process, data integrity is compromised. > How about? > > Such as the definition of create table, if there is an error in courtesy, > please tell me the right way. > > > Concrete operation is as follows. > ---------*---------*---------*---------*---------*---------*---------*---------* > (1)map type's export/import > <export> > [root@castor bin]# ./cqlsh > Connected to Test Cluster at localhost:9160. > [cqlsh 3.0.2 | Cassandra 1.2.5 | CQL spec 3.0.0 | Thrift protocol 19.36.0] > Use HELP for help. > cqlsh> create keyspace maptestks with replication = { 'class' : > 'SimpleStrategy', 'replication_factor' : '1' }; > cqlsh> use maptestks; > cqlsh:maptestks> create table maptestcf (rowkey varchar PRIMARY KEY, > targetmap map<varchar,varchar>); > cqlsh:maptestks> insert into maptestcf (rowkey, targetmap) values > ('rowkey',{'mapkey':'mapvalue'}); > cqlsh:maptestks> select * from maptestcf; > > rowkey | targetmap > --------+-------------------- > rowkey | {mapkey: mapvalue} > cqlsh:maptestks> copy maptestcf to 'maptestcf-20130619.txt'; > 1 rows exported in 0.008 seconds. > cqlsh:maptestks> exit; > > [root@castor bin]# cat maptestcf-20130619.txt > rowkey,{mapkey: mapvalue} > <------------------------(a) > <import> > [root@castor bin]# ./cqlsh > Connected to Test Cluster at localhost:9160. > [cqlsh 3.0.2 | Cassandra 1.2.5 | CQL spec 3.0.0 | Thrift protocol 19.36.0] > Use HELP for help. > cqlsh> create keyspace mapimptestks with replication = { 'class' : > 'SimpleStrategy', 'replication_factor' : '1' }; > cqlsh> use mapimptestks; > cqlsh:mapimptestks> create table mapimptestcf (rowkey varchar PRIMARY KEY, > targetmap map<varchar,varchar>); > > cqlsh:mapimptestks> copy mapimptestcf from ' maptestcf-20130619.txt '; > Bad Request: line 1:83 no viable alternative at input '}' > Aborting import at record #0 (line 1). Previously-inserted values still > present. > 0 rows imported in 0.025 seconds. > ---------*---------*---------*---------*---------*---------*---------*---------* > (2)list type's export/import > <export> > [root@castor bin]#./cqlsh > Connected to Test Cluster at localhost:9160. > [cqlsh 3.0.2 | Cassandra 1.2.5 | CQL spec 3.0.0 | Thrift protocol 19.36.0] > Use HELP for help. > cqlsh> create keyspace listtestks with replication = { 'class' : > 'SimpleStrategy', 'replication_factor' : '1' }; > cqlsh> use listtestks; > cqlsh:listtestks> create table listtestcf (rowkey varchar PRIMARY KEY, value > list<varchar>); > cqlsh:listtestks> insert into listtestcf (rowkey,value) values > ('rowkey',['value1','value2']); > cqlsh:listtestks> select * from listtestcf; > > rowkey | value > --------+------------------ > rowkey | [value1, value2] > > cqlsh:listtestks> copy listtestcf to 'listtestcf-20130619.txt'; > 1 rows exported in 0.014 seconds. > cqlsh:listtestks> exit; > > [root@castor bin]# cat listtestcf-20130619.txt > rowkey,"[value1, value2]" > <------------------------(b) > <export> > [root@castor bin]# ./cqlsh > Connected to Test Cluster at localhost:9160. > [cqlsh 3.0.2 | Cassandra 1.2.5 | CQL spec 3.0.0 | Thrift protocol 19.36.0] > Use HELP for help. > cqlsh> create keyspace listimptestks with replication = { 'class' : > 'SimpleStrategy', 'replication_factor' : '1' }; > cqlsh> use listimptestks; > cqlsh:listimptestks> create table listimptestcf (rowkey varchar PRIMARY KEY, > value list<varchar>); > cqlsh:listimptestks> copy listimptestcf from ' listtestcf-20130619.txt '; > Bad Request: line 1:79 no viable alternative at input ']' > Aborting import at record #0 (line 1). Previously-inserted values still > present. > 0 rows imported in 0.030 seconds. > ---------*---------*---------*---------*---------*---------*---------*---------* > Reference: (correct, or error, in another dimension) > > Manually, I have rewritten the export file. > [root@castor bin]# cat nlisttestcf-20130619.txt > rowkey,"['value1',' value2']" > > .... > cqlsh:listimptestks> copy listimptestcf from 'nlisttestcf-20130619.txt'; > 1 rows imported in 0.035 seconds. > > cqlsh:listimptestks> select * from implisttestcf; > rowkey | value > --------+------------------ > rowkey | [value1, value2] > cqlsh:implisttestks> exit; > > [root@castor bin]# cat nmaptestcf-20130619.txt > rowkey,”{'mapkey': 'mapvalue'}” > > [root@castor bin]# ./cqlsh > Connected to Test Cluster at localhost:9160. > [cqlsh 3.0.2 | Cassandra 1.2.5 | CQL spec 3.0.0 | Thrift protocol 19.36.0] > Use HELP for help. > cqlsh> use mapimptestks; > cqlsh:mapimptestks> copy mapimptestcf from 'nmaptestcf-20130619.txt'; > 1 rows imported in 0.023 seconds. > cqlsh:mapimptestks> select * from mapimptestcf; > > rowkey | targetmap > --------+-------------------- > rowkey | {mapkey: mapvalue} > > (It appears to be as normal processing.) > ---------*---------*---------*---------*---------*---------*---------*---------* > Please confirm from the operation described above. > Comparing the above (a) and (b), in the data format of export file, > only the presence or absence of ("), > it suggests a lack of consistency of the treatment(?). > > > > Yours sincerely > ---------- > Hiroshi Kise > > > > > > > > >