You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Abhijit Chanda <ab...@gmail.com> on 2012/06/28 10:55:52 UTC

No indexed columns present in by-columns clause with "equals" operator

Hi All,
I have got a strange exception while using cassandra cql. Relational
operators like (<, >, >=, <=) are not working.
my columnfamily looks like this.
CREATE COLUMNFAMILY STEST (
  ROW_KEY text PRIMARY KEY,
  VALUE1 text,
  VALUE2 text
) WITH
  comment='' AND
  comparator=text AND
  read_repair_chance=0.100000 AND
  gc_grace_seconds=864000 AND
  default_validation=text AND
  min_compaction_threshold=4 AND
  max_compaction_threshold=32 AND
  replicate_on_write=True;

CREATE INDEX VALUE1_IDX ON STEST (VALUE1);

CREATE INDEX VALUE2_IDX ON STEST (VALUE2);


Now in this columnfamily if i query this
SELECT * FROM STEST WHERE VALUE1 = 10; it returns ----->
 ROW_KEY | VALUE1 | VALUE2
         ---------+-------------+------------
                2 |         10 |     AB

But if i query like this
SELECT * FROM STEST WHERE VALUE1 > 10;
It is showing this exception
Bad Request: No indexed columns present in by-columns clause with "equals"
operator
Same with other relational operators(<,>=,<=)

these are  the datas available in my columnfamily
ROW_KEY | VALUE1 | VALUE2
----------------+--------------+--------
              3 |         100 |    ABC
              5 |            9 |  ABCDE
              2 |          10 |     AB
              1 |            1 |      A
              4 |          19 |   ABCD

Looks like some configuration problem. Please help me. Thanks in Advance




Regards,
-- 
Abhijit Chanda
Analyst
VeHere Interactive Pvt. Ltd.
+91-9748888395

Re: No indexed columns present in by-columns clause with "equals" operator

Posted by Abhijit Chanda <ab...@gmail.com>.
Hey Aaron,

I am able to sort out the problem. Thanks anyways.

Regards,
Abhijit

Re: No indexed columns present in by-columns clause with "equals" operator

Posted by aaron morton <aa...@thelastpickle.com>.
Like the exception says:

> Bad Request: No indexed columns present in by-columns clause with "equals" operator
> Same with other relational operators(<,>=,<=)
You must include an equality operator in the where clause:

That is why
> SELECT * FROM STEST WHERE VALUE1 = 10; 

Works but 
> SELECT * FROM STEST WHERE VALUE1 > 10; 
does not. 

Cheers

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 28/06/2012, at 8:55 PM, Abhijit Chanda wrote:

> Hi All,
> I have got a strange exception while using cassandra cql. Relational operators like (<, >, >=, <=) are not working.
> my columnfamily looks like this.
> CREATE COLUMNFAMILY STEST (
>   ROW_KEY text PRIMARY KEY,
>   VALUE1 text,
>   VALUE2 text
> ) WITH
>   comment='' AND
>   comparator=text AND
>   read_repair_chance=0.100000 AND
>   gc_grace_seconds=864000 AND
>   default_validation=text AND
>   min_compaction_threshold=4 AND
>   max_compaction_threshold=32 AND
>   replicate_on_write=True;
> 
> CREATE INDEX VALUE1_IDX ON STEST (VALUE1);
> 
> CREATE INDEX VALUE2_IDX ON STEST (VALUE2);
> 
> 
> Now in this columnfamily if i query this 
> SELECT * FROM STEST WHERE VALUE1 = 10; it returns ----->
>  ROW_KEY | VALUE1 | VALUE2
>          ---------+-------------+------------
>                 2 |         10 |     AB
> 
> But if i query like this 
> SELECT * FROM STEST WHERE VALUE1 > 10; 
> It is showing this exception
> Bad Request: No indexed columns present in by-columns clause with "equals" operator
> Same with other relational operators(<,>=,<=)
> 
> these are  the datas available in my columnfamily 
> ROW_KEY | VALUE1 | VALUE2
> ----------------+--------------+--------
>               3 |         100 |    ABC
>               5 |            9 |  ABCDE
>               2 |          10 |     AB
>               1 |            1 |      A
>               4 |          19 |   ABCD
> 
> Looks like some configuration problem. Please help me. Thanks in Advance
> 
> 
> 
> 
> Regards,
> -- 
> Abhijit Chanda
> Analyst
> VeHere Interactive Pvt. Ltd.
> +91-9748888395
>