incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <>
Subject Re: Error when using CQL driver : No indexed columns present in by-columns clause with "equals" operator
Date Thu, 31 Jan 2013 09:17:06 GMT
birth_year is secondary indexed. When querying using 2nd indexes, Cassandra
(it's not CQL specific) requires that you use an '=' for at least one of
the indexed column in the where clause (in your example you only have one
such column so it should be an '='). This is a limitation of 2ndary indexes
(that will hopefully be lifted someday -

In other words, what you can do is:
 select * from users where birth_year = 1965
but your query is not supported (for 2nd indexes that is).


On Thu, Jan 31, 2013 at 7:22 AM, Dinusha Dilrukshi

> Hi All,
> I have created a column family as follows. (With secondary indexes.)
> create column family users with comparator=UTF8Type and
> key_validation_class = 'UTF8Type' and default_validation_class = 'UTF8Type'
>  and column_metadata=[{column_name: full_name, validation_class: UTF8Type},
>  {column_name: birth_year, validation_class: LongType, index_type: KEYS},
>  {column_name: state, validation_class:  UTF8Type, index_type: KEYS}];
> And I am using CQL driver-1.1.1 with Cassandra server-1.1.1. Once I try to
> execute the following query, it gives  an exception saying 'No indexed
> columns present in by-columns clause with "equals" operator'.
> CQL :
> select * from users where birth_year<1965
> Caused by: java.sql.SQLSyntaxErrorException: No indexed columns present in
> by-columns clause with "equals" operator
>     at
> org.apache.cassandra.cql.jdbc.CassandraPreparedStatement.doExecute(
>     at
> org.apache.cassandra.cql.jdbc.CassandraPreparedStatement.executeQuery(
> Appreciate any help to resolve this..
> Regards,
> Dinusha.

View raw message