Functions
CQL support functions for transforming one or more column values into a new value.
CQL supports several functions that transform one or more column values into a new value.
Aggregation functions are not supported.
Use the token function to compute the token for a given partition key. The exact signature of
the token function depends on the table and partitioner used by the cluster. The type of the
arguments to the token function depends on the type of the partition key columns. The return type
depends on the partitioner in use:
- Murmur3Partitioner, bigint
- RandomPartitioner, varint
- ByteOrderedPartitioner, blob
For instance, in a cluster using the default Murmur3Partitioner, the token function that
computes the token for the partition key of this table takes a single argument of type text. The
partition key is userid. There is no clustering column so the partition key is the same as the
primary key, and the return type is
bigint.
CREATE TABLE users (
userid text PRIMARY KEY,
username text,
...
)
Regardless of the partitioner in use, Apache Cassandra™ does not support non-equal conditional operations on the partition key. Use the token function for range queries on the partition key.