Cassandra CQL supports different kinds of Data Types to support a variety of operations and store data in a variety of data types. The Data types are Native Types such including INT, TEXT, TIME, DATE, BLOB, VARCHAR, FLOAT, TIMESTAMP the Collection Types which includes the MAP, SETS, LISTS, and the Tuples Types, Collection Types and so on.
Cassandra CQL Native Types
The following is the list of Cassandra Native Data Support.
CQL Data Type | Constants Supported | Data Type Description |
---|---|---|
ascii | strings | This Data type is used to present the ASCII character string |
bigint | bigint | This Data type is used to present the 64-bit signed long |
blob | blobs | This Data type is used to present the arbitrary bytes |
Boolean | booleans | This Data type is used to present the true or false |
counter | integers | This Data type is used to present the counter column |
decimal | integers, floats | This Data type is used to present the variable-precision decimal |
double | integers | This Data type is used to present the 64-bit IEEE-754 floating point |
float | integers, floats | This Data type is used to present the 32-bit IEEE-754 floating point |
inet | strings | This Data type is used to present the an IP address, IPv4 or IPv6 |
int | integers | This Data type is used to present the 32-bit signed int |
text | strings | This Data type is used to present the UTF8 encoded string |
timestamp | integers, strings | This Data type is used to present the a timestamp |
timeuuid | uuids | This Data type is used to present the type 1 UUID |
uuid | uuids | This Data type is used to present the type 1 or type 4 |
varchar | strings | This Data type is used to present the uTF8 encoded string |
varint | integers | This Data type is used to present the arbitrary-precision integer |
Cassandra CQL Java Types
The following is the list of Java Data Types which are derived from the Cassandra CQL Data Types.
CQL Data Type | Java Data Type |
---|---|
decimal | java.math.BigDecimal |
float | java.lang.Float |
double | java.lang.Double |
varint | java.math.BigInteger |
Cassandra Collection Data Types
The following is the list of Cassandra Collection Data Types.
Collection Data Type | Description |
---|---|
list | The Cassandra List represents a collection of ordered elements. |
map | The Cassandra Map represents a collection Key-Value elements. |
set | The Cassandra Ste represents a collection one or it can be more than one element. |
Cassandra User Defined Data Types
The Cassandra User-defined data types are the customized data types created by the users. Cassandra provides different CQL commands to create User-defined Data types. The following is the list of CQL commands to create users defined data types.
UDF CQL Commands | Description |
---|---|
CREATE TYPE | This CQL command is used to create a user-defined data type. |
ALTER TYPE | This CQL command is used to Alter a user-defined data type. |
DROP TYPE | This CQL command is used to Drop a user-defined data type. |
DESCRIBE TYPE | This CQL command is used to Describe a user-defined data type. |
DESCRIBE TYPES | This CQL command is used to Describe user-defined data types. |