About comparators

A comparator specifies the data type for the column name, as well as the sort order in which columns are stored within a row.

Within a row, columns are always stored in sorted order by their column name. A comparator specifies the data type for the column name, as well as the sort order in which columns are stored within a row. Unlike a validator, the comparator may not be changed after the table is defined, so this is an important consideration when defining a table in Cassandra.

Typically, static table names will be strings, and the sort order of columns is not important in that case. For dynamic tables, however, sort order is important. For example, in a table that stores time series data (the column names are timestamps), having the data in sorted order is required for slicing result sets out of a row of columns.