cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josep Blanquer <blanq...@rightscale.com>
Subject CQL3 and column slices
Date Mon, 23 Jul 2012 22:09:48 GMT
Hi,

 I am confused as to what is the way to specify column slices for composite
type CFs using CQL3.

I first thought that the way to do so was to use the very ugly and
unintuitive syntax of constructing the PK prefix with equalities, except
the last part of the composite type. But, now, after seeing
https://issues.apache.org/jira/browse/CASSANDRA-4372 , and realizing that
the ugly/unintuitive way to specify that has been taken away (i.e.,
"fixed") ...I don't know what is the way to express it anymore.

In particular, and following the example of 4372...if you have this table
with 6 columns, 5 of them being the composite :

CREATE TABLE bug_test (a int, b int, c int, d int, e int, f text, PRIMARY
KEY (a, b, c, d, e) );
with some data in it:

SELECT * FROM bug_test;

Results:

a | b | c | d | e | f
------+--
1 | 1 | 1 | 1 | 1 | 1
1 | 1 | 1 | 1 | 2 | 2
1 | 1 | 1 | 1 | 3 | 3
1 | 1 | 1 | 1 | 5 | 5
1 | 1 | 1 | 2 | 1 | 1

how can I do a slice starting after 1:1:1:1:2 to the end?

I thought that the (very ugly way) was:

SELECT a, b, c, d, e, f FROM bug_test WHERE a = 1 AND b = 1 AND c = 1 AND d
= 1 AND e > 2;

(despite the fact that it felt completely wrong since these conditions need
to be considered together, not as 5 independent ones...otherwise one
realizes that the result will contain rows that don't match it, for example
that contain d=2 in this case)

is there some way to express that in CQL3? something logically equivalent
to

SELECT *  FROM bug_test WHERE a:b:c:d:e > 1:1:1:1:2    ??

Cheers,

Josep M.

Mime
View raw message