This is because time2 is not part of the primary key. Only the primary key column(s) can be queried with > and <. Secondary indexes (like your timeuuid_test2_idx)  can only be queried with the = operator.

Maybe you can make time2 also part of your primary key?


Good luck,
Tom


On Mon, Nov 4, 2013 at 11:29 AM, Turi, Ferenc (GE Power & Water, Non-GE) <Ferenc.Turi@ge.com> wrote:

Hi,

 

Is it possible to filter records by using timeuuid column types in case the column is not part of the primary key?

 

I tried the followings:

 

[cqlsh 3.1.2 | Cassandra 1.2.10.1 | CQL spec 3.0.0 | Thrift protocol 19.36.0]

 

CREATE TABLE timeuuid_test2(

row_key text,

time timeuuid,

time2 timeuuid,

message text,

PRIMARY KEY (row_key, time)

)

 

Cqlsh:    select * from timeuuid_test2 where time2<now();

 

>>Bad Request: No indexed columns present in by-columns clause with Equal operator

I tried to create the required index:

 

create index timeuuid_test2_idx on timeuuid_test2 (time2);

 

>>Bad Request: No indexed columns present in by-columns clause with Equal operator

The result is the same…

 

If the used column is time then everything is OK.

 

select * from timeuuid_test2 where time<now() ALLOW FILTERING;

 

The question here. Why I can’t use the ‘time2’ column  when filtering despite the column is indexed?

 

Thanks,

 

Ferenc




--

Drillster BV
Middenburcht 136
3452MT Vleuten
Netherlands

+31 30 755 5330

Open your free account at www.drillster.com