What data types does CQL support, and are there any Cassandra-specific types you should know?
Last updated
CQL offers the usual scalar types (numeric, text, boolean, dates) plus several Cassandra-specific types built for distributed, wide-column storage such as timeuuid, counter, and blob.
Numeric:
int,bigint,smallint,tinyint,varint,float,double,decimal.Text and binary:
text/varchar(UTF-8),ascii,blob(raw bytes).Date and time:
timestamp,date,time,duration.Cassandra-specific types to know:
uuidandtimeuuid: globally unique IDs;timeuuidembeds time and sorts chronologically.counter: a special distributed counter column with restricted operations.inet: IPv4/IPv6 addresses.
Complex: Collections (
set,list,map), tuples, and UDTs.
- https://cassandra.apache.org/doc/4.1/cassandra/cql/types.html
- https://docs.datastax.com/en/cql/hcd/reference/data-types.html
- https://cassandra.apache.org/doc/stable/cassandra/developing/cql/types.html
- https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cql_data_types_c.html
- https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/uuid_type_r.html
- https://levelup.gitconnected.com/understanding-cql-data-types-in-apache-cassandra-3cddcd3eefba
- https://www.scylladb.com/glossary/cassandra-data-types/