cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yuri Shkuro ...@uber.com>
Subject Re: Multi-column slice restrictions not respected by the returned result
Date Wed, 11 Nov 2015 19:43:23 GMT
Thanks, Tyler.

I also realized that I misunderstood multi-column restriction. Evidently,
(a, b) > (x, y) does not imply component-wise restriction (a>x && b>y) in
CQL, it only implies full tuple comparison. That explains why my condition
(a, b) > (2, 10) was matching row (2, 11).

On Wed, Nov 11, 2015 at 2:31 PM, Tyler Hobbs <tyler@datastax.com> wrote:

> This is a known problem with multi-column slices and mixed ASC/DESC
> clustering orders.  See
> https://issues.apache.org/jira/browse/CASSANDRA-7281 for details.
>
> On Tue, Nov 10, 2015 at 11:02 PM, Yuri Shkuro <ys@uber.com> wrote:
>
>> 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
>>
>
>
>
> --
> Tyler Hobbs
> DataStax <http://datastax.com/>
>

Mime
View raw message