Can you use a Cassandra User Defined Type (UDT) as the value of a map data type column?
For example:
CREATE TYPE message_record( message text, update_time timestamp );
CREATE TABLE user_records( user_account int, user_record map<text, FROZEN<message_record> );
I then want to insert into the table as shown in this (undoubtedly incorrect) command. I've tried all sorts of permutations and my editor (DevCenter) doesn't like any of them.
INSERT INTO user_records (user_account, user_record) Values (
1234,
[ {'0' : {message : 'message 1', update_time : '2021-06-08T18:00:05.000'}},
{'1' : {message : 'message 2', update_time :'2021-06-08T18:01:05.000'}},
{'2' : {message : 'message 3', update_time :'2021-06-08T18:02:05.000'}}
];
I'm trying to avoid normalizing my data into different tables. I want to be able to add additional elements to the map as time goes on.
Thank you.