Hello Paco,

thanks for response.

IMHO this is a not implemented feature in such case. Instead of fetching whole wide row using partitioning key and filtering it on client side this can be done on server side. In my particular case this will be more optimal than adding secondary index. Maybe in case if there is a secondary index and the whole partitioning key specified C* can use some statistics about data to determine which way to go to make query more selective.

What do core developers think? Should I fill an issue in Jira?



2014-04-25 15:23 GMT+06:00 Paco Trujillo <F.Trujillo@genetwister.nl>:

Hi Mikhail

 

It is not a bug/not implemented feature and you are not doing nothing wrong.  As you can check on the documentation you can only filter on a key name or a column that has a secondary index created on it:

 

http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/select_r.html

 

From: Mikhail Mazursky [mailto:ash2kk@gmail.com]
Sent: vrijdag 25 april 2014 11:01
To: user@cassandra.apache.org
Subject: Select with filtering

 

Hello all,

I have the following schema:


CREATE TABLE my_table (
    a varchar,
    b varchar,
    c int,
    d varchar,
    e uuid,
    PRIMARY KEY ((a, b), c, d)
)

SELECT * FROM my_table WHERE a=? AND b=? AND e=? ALLOW FILTERING

 

The query above gives me the following exception message:


com.datastax.driver.core.exceptions.InvalidQueryException: No indexed columns present in by-columns clause with Equal operator

SELECT * FROM my_table WHERE a=? AND b=?

Works fine and I see not reason why original query should not be able to do such filtering.

If I add a secondary index by "e" column, then such query will work, but I do not want to do that.

 

Cassandra 2.0.5

Driver 2.0.1

Is that a bug/not implemented feature? Or maybe I'm doing something wrong?

 

Kind regards,

Mikhail.