FROZEN data type
This page documents a preview version.
v2.23 Preview
Preview includes features under active development and is for development and testing only.
For production, use the latest stable version (v2024.1).
For production, use the latest stable version (v2024.1).
Synopsis
Use the FROZEN
data type to specify columns of binary strings that result from serializing collections, tuples, or user-defined types.
Syntax
type_specification ::= FROZEN<type>
Where
type
is a well-formed YCQL data type (additional restrictions fortype
are covered in the Semantics section below).
Semantics
- Columns of type
FROZEN
can be part of thePRIMARY KEY
. - Type parameters of
FROZEN
type must be either collection types (LIST
,MAP
, orSET
) or user-defined types. FROZEN
types can be parameters of collection types.- For any valid frozen type parameter
type
, values oftype
are convertible intoFROZEN<type>
.
Examples
ycqlsh:example> CREATE TABLE directory(file FROZEN<LIST<TEXT>> PRIMARY KEY, value BLOB);
ycqlsh:example> INSERT INTO directory(file, value) VALUES([ 'home', 'documents', 'homework.doc' ], 0x);
ycqlsh:example> INSERT INTO directory(file, value) VALUES([ 'home', 'downloads', 'textbook.pdf' ], 0x12ab21ef);
ycqlsh:example> UPDATE directory SET value = 0xab00ff WHERE file = [ 'home', 'documents', 'homework.doc' ];
ycqlsh:example> SELECT * FROM directory;
file | value
---------------------------------------+------------
['home', 'downloads', 'textbook.pdf'] | 0x12ab21ef
['home', 'documents', 'homework.doc'] | 0xab00ff