Data types
Cassandra has five categories or data types:
- Native types: These are built-in types in Cassandra. For each type there is a keyword to define.
- Collection types: These types can store a group of native type elements. There are three categories—set, list, and map.
- Tuple types: Tuple types can store a fixed length group of elements in a column similar to user-defined types, except that the tuple element field has no names. Hence, the ordering should be the same as during inserting a record in the order they are defined at table creation time. The following is an example of creating a column family with a tuple type:
CREATE TABLE user_reviews ( useriduuid PRIMARY KEY, review frozen<tuple<text, text, decimal>> ) INSERT INTO user_reviews (userid, ...
Get Apache Cassandra Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.