Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra frozen keyword meaning

What's the meaning of the frozen keyword in Cassandra?

I'm trying to read this documentation page: Using a user-defined type, but their explanation for the frozen keyword (which they use in their examples) is not clear enough for me:

To support future capabilities, a column definition of a user-defined or tuple type requires the frozen keyword. Cassandra serializes a frozen value having multiple components into a single value. For examples and usage information, see "Using a user-defined type", "Tuple type", and Collection type.

I haven't found any other definition or a clear explanation for that in the net.

like image 302
Alon Avatar asked Mar 01 '17 13:03

Alon


People also ask

What is UDT in Cassandra?

User-Defined Types (UDTs) can be used to attach multiple data fields to a column. User-defined types (UDTs) can attach multiple data fields, each named and typed, to a single column. The fields used to create a UDT may be any valid data type, including collections and other existing UDTs.

Does Cassandra have foreign keys?

Apache Cassandra does not have the concept of foreign keys or relational integrity. Apache Cassandra's data model is based around designing efficient queries; queries that don't involve multiple tables. Relational databases normalize data to avoid duplication.

What is a static column in Cassandra?

Static column: In Cassandra Query Language (CQL) it is a special column that is shared by all the rows of a partition. the static column is very useful when we want to share a column with a single value. In Cassandra query language static columns are only static within a given partition.

What is tuple in Cassandra?

The tuple data type holds fixed-length sets of typed positional fields. Use a tuple as an alternative to a user-defined type. A tuple can accommodate many fields (32768), more than can be prudently used. Typically, create a tuple with a few fields.


1 Answers

In Cassandra if you define UDT or Collection as frozen, you can't update UDT's or collection's individual item, you have to reinsert with full value.

A frozen value serializes multiple components into a single value. Non-frozen types allow updates to individual fields. Cassandra treats the value of a frozen type as a blob. The entire value must be overwritten.

Source : https://docs.datastax.com/en/cql/3.1/cql/cql_reference/collection_type_r.html

@Alon : "Long story short: frozen = immutable"

like image 187
Ashraful Islam Avatar answered Sep 29 '22 12:09

Ashraful Islam