Posts

Showing posts from October, 2012

Cassandra Composite Types - A Overview [with CQL & Cassandra-Cli examples]

Just felt like sharing what is composite type in cassandra and How can we make use of it After so many discussions in Stackoverflow and PHPCassa forums, I hope I have got a clear picture over the topic What are composite types? Composite types are like structures in C or C++ For ex: The way we define a linked list [basic] struct LLNode { int data; char name[20]; struct LLNode *next; } Which means every member of this struct will have data of type int, name of type char array and a next pointer of type LLnode The struct is a composite of basic datatypes[not exactly in this case] Also you can't initialize value to any of these attributes when you define a struct The same way Cassandra Composite Type is a dataType derived from existing basic supported dataTypes . Why do we need this? Cassandra initially had and still has the concept of super columns. The basic use of them is maintaining an inverted index . Consider a data model in cassandra ColumnFamily: UserMast