You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Daning <da...@netseer.com> on 2011/06/28 19:31:42 UTC
Query indexed column with key filter
I found this code
// Start and finish keys, *and* column relations (KEY> foo AND KEY< bar and name1 = value1).
if (select.isKeyRange()&& (select.getKeyFinish() != null)&& (select.getColumnRelations().size()> 0))
throw new InvalidRequestException("You cannot combine key range and by-column clauses in a SELECT");
in
http://svn.apache.org/repos/asf/cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
This operation is exactly what I want - query by column then filter by
key. I want to know why this query is not supported, and what's the good
work around for it? At this moment my workaound is to create a column
which is exactly same as key.
Thanks,
Daning
Re: Query indexed column with key filter
Posted by aaron morton <aa...@thelastpickle.com>.
Currently these are two different types of query, using a key range is equivalent to the get_range_slices() API function and column clauses is a get_indexed_slices() call. So you would be asking for a potentially painful join between.
Creating a column with the same value as the key sounds reasonable.
Cheers
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com
On 29 Jun 2011, at 05:31, Daning wrote:
> I found this code
>
> // Start and finish keys, *and* column relations (KEY> foo AND KEY< bar and name1 = value1).
> if (select.isKeyRange()&& (select.getKeyFinish() != null)&& (select.getColumnRelations().size()> 0))
> throw new InvalidRequestException("You cannot combine key range and by-column clauses in a SELECT");
>
> in
>
> http://svn.apache.org/repos/asf/cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
>
>
> This operation is exactly what I want - query by column then filter by key. I want to know why this query is not supported, and what's the good work around for it? At this moment my workaound is to create a column which is exactly same as key.
>
> Thanks,
>
> Daning