× Heads up!

Aqua Data Studio / nhilam

Follow
IDE for Relational Databases
×
tariqrahiman reported 2013-10-07T21:03:53Z  · last modified 2013-10-08T17:18:15Z

Datatype with List of integers gets stored with quotes


Dev
Fun Fun
funfun
QA
Sachin Prakash
SachinPrakash
Priority Low
Complexity Unknown
Component DB - Cassandra
Version 14.0

 

Version: 14.0.0-rc-45
Build #: 34323
Build Date: 2013-Oct-04 02:46:59 PM
 
 
Datatype with List of integers gets stored with quotes. So an export of the table and import into another table with the same column data types wont work.
 
1. Open a query window to Apache Cassandra and create the below 2 tables
 

CREATE TABLE list_map_set_1 ( 

        id      int,

        list1   list<int>,

        map1    map<int,text>,

        set1    set<uuid>,

        PRIMARY KEY(id)

) WITH

        "bloom_filter_fp_chance"='0.01' AND "caching"='KEYS_ONLY' AND "dclocal_read_repair_chance"='0.0' AND "gc_grace_seconds"='864000' AND "read_repair_chance"='0.1' AND "replicate_on_write"='true'

        AND compaction = {'class':'SizeTieredCompactionStrategy'}

        AND compression = {'sstable_compression':'SnappyCompressor'}

go
 

CREATE TABLE list_map_set_2 ( 

        id      int,

        list1   list<int>,

        map1    map<int,text>,

        set1    set<uuid>,

        PRIMARY KEY(id)

) WITH

        "bloom_filter_fp_chance"='0.01' AND "caching"='KEYS_ONLY' AND "dclocal_read_repair_chance"='0.0' AND "gc_grace_seconds"='864000' AND "read_repair_chance"='0.1' AND "replicate_on_write"='true'

        AND compaction = {'class':'SizeTieredCompactionStrategy'}

        AND compression = {'sstable_compression':'SnappyCompressor'}

go
 
2. Next insert the first table with some values
 

INSERT INTO list_map_set_1 (id, list1, map1, set1) 

        VALUES(1, [101,201,301], {1:'cassandra'}, {01234567-0123-0123-0123-0123456789ab})

GO

INSERT INTO list_map_set_1 (id, list1, map1, set1) 

        VALUES(2, [102,201,301], {1:'hive'}, {01234567-0123-0123-0123-0123456789ab})

GO

INSERT INTO list_map_set_1 (id, list1, map1, set1) 

        VALUES(3, [103,201,301], {1:'mongo'}, {01234567-0123-0123-0123-0123456789ab})

GO

INSERT INTO list_map_set_1 (id, list1, map1, set1) 

        VALUES(4, [104,201,301], {1:'tariq'}, {01234567-0123-0123-0123-0123456789ab})

GO

INSERT INTO list_map_set_1 (id, list1, map1, set1) 

        VALUES(5, [105,201,301], {1:'sahil'}, {01234567-0123-0123-0123-0123456789ab})

GO

INSERT INTO list_map_set_1 (id, list1, map1, set1) 

        VALUES(6, [106,201,301], {1:'asif'}, {01234567-0123-0123-0123-0123456789ab})

GO

INSERT INTO list_map_set_1 (id, list1, map1, set1) 

        VALUES(7, [107,201,301], {1:'jon'}, {01234567-0123-0123-0123-0123456789ab})

GO

 
3. Now export the values of the table list_map_set_1 into a delimited text file
4. Now try to import the values to the second table and you get the below error message 
 

java.sql.SQLSyntaxErrorException: Invalid list literal for list1: value '101' is not of type int

'INSERT INTO "cass"."list_map_set_imp"("id", "list1", "map1", "set1")   VALUES(5, ['101', '201', '301'], {'1':'cassandra'}, {'01234567-0123-0123-0123-0123456789ab'})'

        at org.apache.cassandra.cql.jdbc.CassandraStatement.doExecute(Unknown Source)

        at org.apache.cassandra.cql.jdbc.CassandraStatement.executeUpdate(Unknown Source)

        at \\...\\ .\\हिñçêČάй語简??한\\.Kꎸᛗꅁꇊ transient.executeUpdate(Unknown Source)

        at \\...\\ .\\हिñçêČάй語简??한\\.Rᛃᡱ̈ꀌ.process(Unknown Source)

        at \\...\\ .\\हिñçêČάй語简??한\\.Rᛃᡱ̈ꀌ.run(Unknown Source)

Caused by: InvalidRequestException(why:Invalid list literal for list1: value '101' is not of type int)

        at org.apache.cassandra.thrift.Cassandra$execute_cql3_query_result.read(Cassandra.java:37849)

        at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)

        at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_cql3_query(Cassandra.java:1562)

        at org.apache.cassandra.thrift.Cassandra$Client.execute_cql3_query(Cassandra.java:1547)

        at org.apache.cassandra.cql.jdbc.CassandraConnection.execute(Unknown Source)

        at org.apache.cassandra.cql.jdbc.CassandraConnection.execute(Unknown Source)

        ... 5 more

 

 

1 attachment

Issue #10345

Closed
Fixed
Resolved 2013-10-08T04:58:37Z
 
 
Completion
No due date
Fixed Build 14.0.0-rc-46/15.0.0-dev-22
No time estimate

About AquaClusters Privacy Policy Support Version - 19.0.2-4 AquaFold, Inc Copyright © 2007-2017