November 2nd, 2013

This blog posting was created by Cassandra Rebel Elite member Eric Zoerner. To view more postings by Eric, check out his tech blog here.

C* Path is a new open-source Java library for reading and writing structured objects in Cassandra. Instead of serializing or normalizing objects, the library decomposes structured data into hierarchical paths allowing access by path in whole or in part.

The advantages of C* Path include:

  • Simple to use API
  • Implementations included for both Thrift and CQL (with no difference in application code)
  • Allows structural access to data at any level
  • Good for denormalizing data, can read or write large complex objects to a single partition
  • Objects are decomposed based on jackson annotations (fasterxml version), which may already exist in your domain classes

The main disadvantages are that there is no protection against callers making inconsistent updates and that it doesn’t support cyclical references.

API Usage Examples


// Implementation of StructuredDataSupport is typically injected
// this is where Thrift vs. CQL support is configured.
StructuredDataSupport daoSupport;
Path path = daoSupport.createPath("some", "path", "to", "pojo");
daoSupport.writeToPath(rowKey, path, pojo);


Pojo pojo - daoSupport.readFromPath(rowKey,
                                    new TypeReference<Pojo>() {});

Notice that when reading you supply a TypeReference subclass instance. This is similar to the usage of TypeReference in jackson and allows fully generic specification of the type of object to return.


The library currently will store collections and arrays as lists. Individual list elements can be read and written by using the Path.withIndices method to put list indexes in a path:

Path path = daoSupport.createPath("some","list").withIndices(0);

This creates a path to the first (zeroth) element of the list stored at the path some/list.
As you can see from the API, paths are hierarchical and structures can be nested to arbitrary depth.

Example Decomposition

As an example decomposition, if you take an object such as a Person shown here, then this object would end up in Casssandra stored as shown below.



This is an abbreviated example which doesn’t show all the data in the table, but hopefully illustrates the idea.

Get it

This is a basic overview of how to use C* Path.  For a more detailed description of how the implementation works, see the presentation from Cassandra Summit Europe 2013.

The source code and documentation are available on GitHub at, and the artifacts are available on Maven Central:

For the CQL implementation: