How to create a map of a nested collection <text, list <text >> enter into cassandra 2.2.1 database

create table tbl_master_values (
  dbid int primary key,
  user_dbid int, reg_dbid int,
  module_dbid int,
  fields_value map<text,list<text>>,
  created_date timestamp,
  modified_date timestamp);

It returns this error:

InvalidRequest: code=2200 [Invalid query] 
message="Non-frozen collections are not allowed inside collections: map<text, list<text>>"
+4
source share
3 answers

In Cassandra, you can use non-freezing collections if you intend to add or remove entries through a Cassandra request. But when you intend to use UDT or a nested collection inside your map, you must declare the former as frozen. For example, in your case:

    create table tbl_master_values (
    dbid int primary key,
    user_dbid int, reg_dbid int,
    module_dbid int,
    fields_value map<text,frozen<list<text>>>,
    created_date timestamp,
    modified_date timestamp);

If you use Map to store and retrieve information, and not to update a string, you can declare it as:

    frozen<map<text, list<text>>>

frozen < > blob. :

https://docs.datastax.com/en/cql/3.3/cql/cql_using/useInsertMap.html

+3

: map >

Cassandra , , frozen.

fields_value frozen<map<text, list<text>>>,

, frozen Cassandra blob . , . , , , .

+2

If we mention frozen, how will we look for any row / data in the frozen column? This does not allow this. In the case of a hang, do we need to pass the entire column value to get a record? Do we know how to search in frozen column values?

0
source

Source: https://habr.com/ru/post/1626162/


All Articles