CQL native functions
CQL supports several functions that transform a column value into a new value.
Scalar functions
CQL supports the following native functions.
Function | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Converts the data returned by the <selector> to a native CQL data type.
The
|
||||||||||||||||||||||||||||||||||||
Computes a token for values in the target column.
The exact signature of the token function depends on the table concerned and of the partitioner used by the cluster.
|
|||||||||||||||||||||||||||||||||||||
|
Count down in seconds until the value in the field expires and the data is automatically removed; null indicates that TTL for the column is not set (or the count down has ended). Cannot be used with primary key columns, counter columns, or non-frozen collection columns.
Use only in selectors clause of SELECT statements on non-partition key columns.
|
||||||||||||||||||||||||||||||||||||
Shows the unix timestamp (number of seconds since epoch) that the data was written. Cannot be used with primary key columns, counter columns, or non-frozen collection columns.
Use only in selectors clause of SELECT statements on non-partition key columns. |
Date and time functions
Current date and time
Return the (current) system time of the coordinator node in a CQL type format. These functions have no arguments.
Function | Description |
---|---|
Returns the system time in date format. |
|
Returns the system time in time format. |
|
Returns the system time in timestamp format. |
|
Returns the system time in timeuuid format. Restriction:
|
|
|
Rounds date and time to the nearest value.
If the <start_timestamp> is not used, then the start timestamp is January 1, 1970 00:00:00.000 GMT.
If the <start_timestamp> is not used, then the start timestamp is January 1, 1970 00:00:00.000 GMT.
If the <start_date> is not used, then the start date is January 1, 1970 GMT.
If the <start_time> is not used, then the start time is 00:00:00[000000000]. Use the duration syntax as follows:
|
Alias of currentTimeUuid. |
TimeUuid calculations
Function | Description |
---|---|
|
Computes the smallest fake
Use in a SELECT statement WHERE clause to return rows in a date range from a |
|
Computes the largest fake
Use in a SELECT statement where clause to return rows in a date range from a |
Date and time conversion
Function | Description | ||
---|---|---|---|
Converts a
|
|||
Converts a
|
|||
Converts the
|
Blob conversion
Convert CQL native types to or from binary (blob
).
Function | Description |
---|---|
|
|
|
Converts the target column or literal (enclose strings in single quotes) to a blob from the specified <type>, where the from type corresponds to a valid CQL data type.
Use in the following types of CQL statements: |
Deprecated functions
The following functions are supported for backward compatibility only.
Function | Description |
---|---|
|
Similar to toTimestamp. |
|
Similar to toUnixTimestamp |