Cascading Tap and Scheme for Cassandra
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 11 commits behind pingles:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A Cascading Scheme and Tap for Cassandra and can operate as both a Sink and a Source.

Current build status: Build status


The project can be built using Maven and installed into your local repository:

mvn install

Alternatively, there's a snapshot available from Conjars.


[cascading.cassandra/cascading.cassandra "0.0.2"]

and add the repository into your project.clj with

:repositories {"conjars" ""}



If you haven't already added it you'll need to add the Conjars repository



This is very much an early Work-in-Progress and all contributions are welcome. It only supports regular column families currently (no super columns or counter columns yet).


cascading.cassandra is heavily influenced by cascading.hbase and uses Cassandra's ColumnFamilyOutputFormat for it's sink.

First, create a CassandraScheme and specify the field to be used as the row key (currently the Scheme will only work with single-field keys). The second parameter is an array of Fields that represent the columns you wish to store. The column names will be serialized from the name provided and the values will come from the Tuples during the flow.

Using as a Sink

For narrow rows with known column names, use the NarrowRowScheme, specifying the field to use for the key and fields to use a column values. The field names are used for the written column names:

Fields keyFields = new Fields("num");
Fields nameFields = new Fields("lower", "upper");
CassandraScheme scheme = new NarrowRowScheme(keyFields, nameFields);

Finally, hook the CassandraScheme into a CassandraTap and provide the Cassandra Thrift RPC Host and Port that the ColumnFamilyOutputFormat should connect to, as well as the keyspace and column family names you wish to store/retrieve values for.

Tap sink = new CassandraTap(getRpcHost(), getRpcPort(), keyspaceName, columnFamilyName, scheme);

For dumping wide rows, use the WideRowScheme, which takes no argument in construction:

CassandraScheme scheme = new WideRowScheme();

This scheme expects each sunk tuple to consist of a row key followed by any number of column name / value pairs.

Using as a Source

Using the NarrowRowScheme with a source is identical to usage with a sink. The WideRowScheme cannot currently be used as a source.


Licensed under the Apache 2.0 license.


Copyright © Paul Ingles, 2011.