cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yuri Shkuro ...@uber.com>
Subject Multi-column slice restrictions not respected by the returned result
Date Wed, 11 Nov 2015 05:02:41 GMT
According to this blog:
http://www.datastax.com/dev/blog/a-deep-look-to-the-cql-where-clause

I should be able to do multi-column restrictions on clustering columns, as
in the blog example: WHERE (server, time) >= (‘196.8.0.0’, 12:00) AND
(server, time) <= (‘196.8.255.255’, 14:00)

However, I am getting data returned from such query that does not match the
restrictions. Tried on Cassandra 2.17 and 2.2.3. Here's an example:

CREATE TABLE IF NOT EXISTS dur (
    s      text,
    nd     bigint,
    ts     bigint,
    tid    bigint,
    PRIMARY KEY (s, nd, ts)
) WITH CLUSTERING ORDER BY (nd ASC, ts DESC);

insert INTO dur (s, nd, ts, tid) values ('x', 1, 10, 99);
insert INTO dur (s, nd, ts, tid) values ('x', 2, 11, 98) ;
insert INTO dur (s, nd, ts, tid) values ('x', 3, 10, 97) ;
insert INTO dur (s, nd, ts, tid) values ('x', 1, 11, 96) ;
insert INTO dur (s, nd, ts, tid) values ('x', 1, 12, 95) ;
insert INTO dur (s, nd, ts, tid) values ('x', 2, 10, 94) ;
insert INTO dur (s, nd, ts, tid) values ('x', 2, 12, 93) ;
insert INTO dur (s, nd, ts, tid) values ('x', 3, 11, 92) ;
insert INTO dur (s, nd, ts, tid) values ('x', 3, 12, 91) ;

select * from dur where s='x' and (nd,ts) > (2, 11);

 s | nd | ts | tid
---+----+----+-----
 x |  2 | 10 |  94
 x |  3 | 12 |  91
 x |  3 | 11 |  92
 x |  3 | 10 |  97
(4 rows)

The first row in the result does not satisfy the restriction (nd,ts) > (2,
11). Am I doing something incorrectly?

Thanks,
--Yuri

Mime
View raw message