Apache Cassandra 0.6 Documentation

Column Families

A column family slightly resembles a table in an RDBMS. Column families contain rows and columns. Each row is uniquely identified by a row key. Each row has multiple columns, each of which has a name, value, and a timestamp. Unlike a table in an RDBMS, different rows in the same column family do not have to share the same set of columns, and a column may be added to one or multiple rows at any time.

Column Sorting & Comparator Types

Columns within a row are stored in sorted order based on the column names and the comparator used. Note that super column families may use a different comparator for super column names and column names.

Writing a Custom Comparator

If one of the built-in comparator types doesn’t work for you, you can write a custom comparator. It’s easiest to start with src/java/org/apache/cassandra/db/marshal/LongType.java to get an idea of the functionality needed and modify the class to support your own comparator type. Specifically, it should have an instance class member (a singleton for the class) and implement or inherit two methods: compare() and toString().