cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Anecito <>
Subject Re: Intresting issue with getting Order By to work...
Date Thu, 18 Jul 2013 15:17:23 GMT
Many thanks Vladimir I am starting to see what you are talking about.
Yeah all I want to do is a simple Order By via SQL but having the column family setup using
CLI to support that is a bit of a challenge for me at the moment since the two are at different
levels but I prefer CLI for column family setup and just need an example of one at CLI level
setup that translates to working Order By at CQL level.
Many Thanks!

 From: Vladimir Prudnikov <>
Sent: Thursday, July 18, 2013 3:54 AM
Subject: Re: Intresting issue with getting Order By to work...

I'm not an expert, still learning C* but can tell something about your questions.

1) You have to understand that CQL row is not the same as row that C* uses to store data and
which is accessible through the Trift interface. Primary key in terms of CQL is not the same
as Row key. 

2) You have to be clear what you want to order: raw columns, rows or CQL rows. If you want
to get ordered slices of raw rows you have to use Order Preserving Partitioner (which is not
recommended, depends on you schema); If you want to order columns, it can be done easily;
If you want to order CQL rows you have to have a composite primary key with at least 2 columns
and you can order only by the second column in primary key. 

3) As far as I know column families created from CLI or Thrift will be accessible from CQL,
but not opposite.

I hope experts will correct me if I'm wrong. 

On 17/07/2013, at 3:44 PM, Tony Anecito <> wrote:
>>> Hi All,
>>> Well I got most everything working I wanted using Cassandra then discovered I
needed to use an Order By. I am using Cassandra 1.2.5.
>>> The use of Order By requires Primary Key which appears to be only supported by
by using CQL and not Cassandra-cli. So I dropped my table created uisng CLI and used CQL and
was able to create a "Table". But when I went
 to insert data that worked fine on the cli created table I now get an exception:
>>> Error while inserting com.datastax.driver.core.exceptions.InvalidQueryException:
Unknown identifier type.
>>> I read that thrift clients will not work with CQL created tables due to extra
things created by the CQL. If so how can I create Primary Keys and be supported by thrift
based clients??
>>> I will post to Datastax the same question but trying to understand how to resolve
cli vs CQL issue like this. Seems like Cassandra-cli should support creation of compound primary
keys or CQL should create tables readable by thrift based clients. Is there some meta column
info people should add?
>>> Also CQL tables are not visible via I can not see details on what was
created by CQL and the cqlsh script has errors according to the latest Python windows program
I tried.
>>> Thanks,
>>> -Tony

Vladimir Prudnikov 
View raw message