incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcelo Elias Del Valle <mvall...@gmail.com>
Subject Re: composite keys criteria
Date Thu, 27 Sep 2012 23:51:58 GMT
Answering to myself, just in case it's doubt of somebody else.

No, it can't be done, as it's only possible to filter anything if partition
key is provided.

http://www.datastax.com/dev/blog/schema-in-cassandra-1-1

2012/9/27 Marcelo Elias Del Valle <mvallebr@gmail.com>

> I know this is a basic question, but find the answer is being harder than
> I thought.
>
> Assuming a s composite of 3 Strings, and my columns look like:
>
> A:A:A
>
> A:B:B
>
> A:B:C
>
> A:C:B
>
> B:A:A
>
> B:B:A
>
> B:B:B
>
> C:A:B
>
>
> Can I search for all the columns where the last component is C, whatever
> exists on components 0 and 1? Would the following code do the job?
>
>
> Composite start = new Composite();
> start.addComponent(2, "C", Composite.ComponentEquality.EQUAL);
>
> Composite end = new Composite();
> end.addComponent(2, "C", Composite.ComponentEquality.EQUAL);
>
>
> Or the following?
>
> Composite start = new Composite();
>
> start.addComponent(0, "A", Composite.ComponentEquality.EQUAL);
>
> start.addComponent(1, "A", Composite.ComponentEquality.EQUAL);
>
> start.addComponent(2, "A", Composite.ComponentEquality.EQUAL);
>
> Composite end = new Composite();
>
> end.addComponent(0, "B", Composite.ComponentEquality.GREATER_THAN_EQUAL);
>
> end.addComponent(1, "B", Composite.ComponentEquality.GREATER_THAN_EQUAL);
>
> end.addComponent(2, "B", Composite.ComponentEquality.EQUAL);
>
>
>
> --
> Marcelo Elias Del Valle
> http://mvalle.com - @mvallebr
>



-- 
Marcelo Elias Del Valle
http://mvalle.com - @mvallebr

Mime
View raw message