Database Reference
In-Depth Information
4. CQL
Due to the complex data structures that Cassandra has to offer, it is critical that
there be a simple way to manipulate the data you have stored. SQL seemed to
be the obvious choice, but there are many things that SQL offers in the way of
RDBMSs that Cassandra just cannot yet do.
Enter CQL. Cassandra Query Language (CQL) strives to be as close to SQL as
possible. Given that Cassandra is a nonrelational database, a fully featured SQL
construct is not possible. The main thing to note about CQL is that it has no
concept of GROUP or JOIN , and a very limited implementation of ORDER BY .
This chapter will focus on data creation and manipulation using CQL 3. We
will show the parallels of CQL with other features of Cassandra and show the end-
result data structures that are created when defining different CQL schemas. We
will first discuss the differences between the major versions of CQL and how they
represent the underlying data structures. We will then start our focus on CQL 3,
moving from data types to available commands, usage, and finally to example data
structures and their correlation to Cassandra storage mechanisms.
A Familiar Way of Doing Things
Before CQL there was Thrift. Thrift is a multilanguage Remote Procedure Call
(RPC) layer that was designed to make client integration as easy as wrapping a
library. As the complexity of Cassandra grew, more and more client drivers star-
ted falling behind in new feature implementation. CQL arose out of the need for
a server-side API that would make keeping up with client drivers much easier and
require less frequent updates.
CQL 1
CQL 1 was a very basic implementation. It had the ability to create ColumnFam-
ilys and indexes and to select and insert data. It did not have support for composite
columns, wide rows, or other advanced data types.
The tokens used in the query language were the same as those used in the Thrift
client. This made it easy to move from Thrift to CQL, as the ideas were the same,
just expressed in an SQL-like statement.
Search WWH ::




Custom Search