0
votes

Here is the custom UDT I created in cassandra, But I'm not able to frame correct insert query for the UDT.

CREATE TYPE IF NOT EXISTS three ( a text, b text );

CREATE TYPE IF NOT EXISTS two ( c text, d frozen < list< frozen < three > > > );

CREATE TABLE IF NOT EXISTS one ( id text PRIMARY KEY, main frozen < two > );

the following insert query is giving column type incompatible error in datastax dev centerinsert into one (id, main) values ('something', [ { 'c' : 'something', 'three': [{'a':'something', 'b': 'something'}] } ]);

1

1 Answers

1
votes

You might want to try

insert into one (id, main) values ('something', {       
    c : 'something',
    d : [ {a:'something', b: 'something'}]
    }
);

You have gone wrong at multiple places.

  1. definition of one doesn't have a list.
  2. definition of two contains c,d - not c, three.
  3. Please use c or "c" instead of 'c'

I hope you try more before you post it on stack-overflow.