Alexandre S.
Alexandre S.

Reputation: 540

Invalid map literal with Cassandra Query

I'm trying to do this query :

insert into test (id, identifiers) values('1', {'id':'test', 'id_bin':{'\x3500000000000050a0'}, 'oidcatref':'1', 'otype_bin':'1', 'id_qaul':'test', 'id_flag':'1'});

That's my identifier type :

create type identifier(id text, id_bin list<blob>, oidcatref bigint, otype_bin int, id_qaul text, id_flag smallint);

And my table structure :

create table test (id int primary key, identifiers frozen<identifier>);

I really don't know what is wrong, thanks for your help

Upvotes: 1

Views: 2053

Answers (1)

Ashraful Islam
Ashraful Islam

Reputation: 12830

Only enclose string value with single quote. And for UDT field remove quote from field name

insert into test (id, identifiers) values 
(
   1,
   { 
       id     :'test', 
       id_bin : [0x3500000000000050a0], 
       oidcatref : 1, 
       otype_bin : 1, 
       id_qaul : 'test', 
       id_flag : 1
    }
);

Upvotes: 2

Related Questions