All Products
Search
Document Center

Lindorm:Data types

Last Updated:Apr 30, 2024

Lindorm Cassandra Query Language (CQL) is a typed language that supports various data types. This topic describes the data types supported by Lindorm CQL.

Basic data types

Data type

Supported constant

Description

bigint

integer

A 64-bit signed long integer.

blob

blob

Bytes that are smaller than 2 MB in size. The size of BLOB objects is limited by the quota of LindormTable. For more information, see Quotas and limits.

Important

The BLOB data type supported by Lindorm CQL is different from the BLOB data type supported by Lindorm SQL in definition, limits, and usage. For more information about the BLOB data type supported by Lindorm SQL, see BLOB data type (in invitational preview).

boolean

boolean

Valid values: true and false.

counter

integer

A counter column that contains 64-bit signed values.

date

integer, string

A date.

decimal

integer, float

A variable-granularity decimal number.

double

integer, float

A 64-bit IEEE 754 floating-point number.

float

integer, float

A 32-bit IEEE 754 floating-point number.

inet

string

An IPv4 or IPv6 address. All inputs are stored as strings because no IP address type can be specified.

int

integer

A 32-bit signed integer number.

smallint

integer

A 16-bit signed integer number.

text

string

A UTF-8 string.

time

integer, string

A time that is measured in nanoseconds.

timestamp

integer, string

A timestamp that is measured in milliseconds.

timeuuid

uuid

A version-1 UUID. In most cases, the UUID is used as a conflict-free timestamp.

tinyint

integer

An 8-bit unsigned integer number.

uuid

uuid

A UUID.

varint

integer

A variable-precision integer.

Counter

The counter type is used to specify a counter column. The counter type of Lindorm CQL is different from the counter type of Cassandra. The counter tables of Cassandra contain only counter columns. The counter tables of Lindorm CQL can contain counter columns and non-counter columns. The following sample code provides an example:

CREATE TABLE person_info  (name text primary key, age counter, address text);
UPDATE person_info SET age = age + 2 WHERE name = 'my';
INSERT INTO person_info  (name, age, address) VALUES ( 'my', 30, 'hz');

Timestamp

You can specify an integer or a string to represent a point in time. In the following sample code, the specified timestamp values represent 04:05:00 March 2, 2011 (UTC):

CREATE TABLE person_info ( name text PRIMARY KEY , birthtime timestamp , address text );
INSERT INTO person_info (name, birthtime, address) VALUES ( 'my', 1299038700000, 'hz');
INSERT INTO person_info (name, birthtime, address) VALUES ( 'mm', '2011-03-02 04:05+0000', 'hz');
INSERT INTO person_info (name, birthtime, address) VALUES ( 'lucy', '2011-03-02 04:05:00+0000', 'bj');

Time

You can use an integer or a string to represent a time. If a string is used to represent a time, the string must be specified in the hh:mm:ss[.fffffffff] format. The [.fffffffff] parameter is optional. The following sample code provides an example:

CREATE TABLE person_info ( name text PRIMARY KEY , birthtime time , address text );
INSERT INTO person_info (name,birthtime,address) VALUES ( 'lili', '08:12:54', 'hz');

Date

You can use an integer or a string to represent a date. If a string is used to represent a time, the string must be specified in the yyyy-mm-dd format. The following sample code provides an example:

 CREATE TABLE person_info ( name text PRIMARY KEY , birthday date , address text );
 INSERT INTO person_info (name,birthday,address) VALUES ( 'lucy', '2021-02-01', 'beijing');

Unsupported data types

  • Collection data types: SET, LIST, and MAP.

  • User-defined types.

  • Basic data type: duration.