Skip to content

Thrift columns

Flavian Alexandru edited this page May 29, 2015 · 9 revisions

Build Status Coverage Status Maven Central Download

back to top

These columns are especially useful if you are building Thrift services. They are deeply integrated with Twitter Scrooge and relevant to the Twitter ecosystem(Finagle, Zipkin, Storm etc) They are available via the phantom-thrift module and you need to import the Thrift package to get all necessary types into scope.

import com.websudos.phantom.thrift._

In the below scenario, the Cassandra type is always text and the type you need to pass to the column is a Thrift struct, specifically com.twitter.scrooge .ThriftStruct. phantom will use a CompactThriftSerializer, store the record as a binary string and then reparse it on fetch.

Thrift serialization and de-serialization is extremely fast, so you don't need to worry about speed or performance overhead. You generally use these to store collections(small number of items), not big things.

phantom columns Cassandra columns
ThriftColumn.<type> text
ThriftListColumn.<type> list<text>
ThriftSetColumn.<type> set<text>
ThriftMapColumn.<type, type> map<text, text>