[ 
https://issues.apache.org/jira/browse/CASSANDRA-7711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14100720#comment-14100720
 ] 

Sylvain Lebresne commented on CASSANDRA-7711:
---------------------------------------------

The code is actually not able to handle
{noformat}
select * from tbl where a in ('a1', 'a2') and (b) in (('b1'), ('b2')) and c > 1;
{noformat}
so I'm not sure why that's not simply rejected. Supporting such syntax is 
actually CASSANDRA-4762 but this requires refactorings that definitively won't 
make it in the 2.0 branch. So for now, let's just add the proper validation to 
reject such query (and add some tests) and leave the support of such syntax to 
CASSANDRA-4762.

> composite column not sliced when using IN clause on (other) composite columns
> -----------------------------------------------------------------------------
>
>                 Key: CASSANDRA-7711
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7711
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: cassandra 2.0.9
>            Reporter: Frens Jan Rumph
>            Assignee: Benjamin Lerer
>              Labels: cql
>             Fix For: 2.0.10
>
>
> Hi,
> I'm storing data points in cassandra keyed by a number of values and a 
> timestamp. I'd want to use IN clauses to select points and sliced by time. 
> The in clauses work, but I can't get it to work in combination with the 
> slicing: all values are returned / the range in the where clause seems to be 
> ignored.
> A dumbed down abstract version of my layout and some sample data:
> {code}
> create table tbl (
>   a text,
>   b text,
>   c int,
>   d int,
>   primary key ((a), b, c)
> );
> insert into tbl (a,b,c,d) values ('a1', 'b1', 1, 1);
> insert into tbl (a,b,c,d) values ('a1', 'b1', 2, 2);
> insert into tbl (a,b,c,d) values ('a1', 'b2', 1, 1);
> insert into tbl (a,b,c,d) values ('a1', 'b2', 2, 2);
> insert into tbl (a,b,c,d) values ('a2', 'b1', 1, 1);
> insert into tbl (a,b,c,d) values ('a2', 'b1', 2, 2);
> insert into tbl (a,b,c,d) values ('a3', 'b2', 1, 1);
> insert into tbl (a,b,c,d) values ('a3', 'b2', 2, 2);
> {code}
> So the table contains:
> {code}
>  a  | b  | c | d
> ----+----+---+---
>  a1 | b1 | 1 | 1
>  a1 | b1 | 2 | 2
>  a1 | b2 | 1 | 1
>  a1 | b2 | 2 | 2
>  a2 | b1 | 1 | 1
>  a2 | b1 | 2 | 2
>  a3 | b2 | 1 | 1
>  a3 | b2 | 2 | 2
> {code}
> When performing {{select * from tbl where a in ('a1', 'a2') and (b) in 
> (('b1'), ('b2')) and c > 1;}} I get:
> {code}
>  a  | b  | c | d
> ----+----+---+---
>  a1 | b1 | 1 | 1
>  a1 | b1 | 2 | 2
>  a1 | b2 | 1 | 1
>  a1 | b2 | 2 | 2
>  a2 | b1 | 1 | 1
>  a2 | b1 | 2 | 2
> {code}
> But I expected:
> {code}
>  a  | b  | c | d
> ----+----+---+---
>  a1 | b1 | 2 | 2
>  a1 | b2 | 2 | 2
>  a2 | b1 | 2 | 2
> {code}
> Am I doing something wrong? Or is {{c > 1}} incorrectly ignored?
> {{select * from tbl where a in ('a1', 'a2') and b='b1' and c > 1;}} does 
> correctly produce:
> {code}
> a  | b  | c | d
> ----+----+---+---
>  a1 | b1 | 2 | 2
>  a2 | b1 | 2 | 2
> {code}
> So I expect this behaviour to relate to the interworking of the IN clause on 
> the clustering column b and the > predicate on column c.
> Cheers,
> Frens Jan



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to