You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Benjamin Lerer (JIRA)" <ji...@apache.org> on 2015/06/17 14:56:01 UTC

[jira] [Comment Edited] (CASSANDRA-9606) this query is not supported in new version

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

Benjamin Lerer edited comment on CASSANDRA-9606 at 6/17/15 12:55 PM:
---------------------------------------------------------------------

The query should be invalid in 2.0. 

Cassandra does not allow multi-column restrictions and single-column restrictions on the same column. What it allow is:
{{select * from test where a=1 and (b)<(6) and (b,c) > (3,2) limit 2;}}. Which will give you exactly what you want.

Be aware that mixing multi and single column restrictions has only been properly fixed in 2.0.15 and 2.1.5 by CASSANDRA-8613.

If what you want to do is paging, I advise you to check if the latest version of the driver that you use is not supporting manual paging like the java driver: http://datastax.github.io/java-driver/2.0.10/features/paging/#manual-paging



was (Author: blerer):
The query should be invalid in 2.0. 

We do not allow multi-column restrictions and single-column restrictions on the same column. What we allow is:
{{select * from test where a=1 and (b)<(6) and (b,c) > (3,2) limit 2;}}. Which will give you exactly what you want.

Be aware that mixing multi and single column restrictions has only been properly fixed in 2.0.15 and 2.1.5 by CASSANDRA-8613.

If what you want to do is paging, I advise you to check if the latest version of the driver that you use is not supporting manual paging like the java driver: http://datastax.github.io/java-driver/2.0.10/features/paging/#manual-paging


> this query is not supported in new version
> ------------------------------------------
>
>                 Key: CASSANDRA-9606
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9606
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: cassandra 2.1.6
> jdk 1.7.0_55
>            Reporter: zhaoyan
>            Assignee: Benjamin Lerer
>
> Background:
> 1、create a table:
> {code}
> CREATE TABLE test (
>     a int,
>     b int,
>     c int,
> 	d int,
>     PRIMARY KEY (a, b, c)
> );
> {code}
> 2、query by a=1 and b<6
> {code}
> select * from test where a=1 and b<6;
>  a | b | c | d
> ---+---+---+---
>  1 | 3 | 1 | 2
>  1 | 3 | 2 | 2
>  1 | 3 | 4 | 2
>  1 | 3 | 5 | 2
>  1 | 4 | 4 | 2
>  1 | 5 | 5 | 2
> (6 rows)
> {code}
> 3、query by page
> first page:
> {code}
> select * from test where a=1 and b<6 limit 2;
>  a | b | c | d
> ---+---+---+---
>  1 | 3 | 1 | 2
>  1 | 3 | 2 | 2
> (2 rows)
> {code}
> second page:
> {code}
> select * from test where a=1 and b<6 and (b,c) > (3,2) limit 2;
>  a | b | c | d
> ---+---+---+---
>  1 | 3 | 4 | 2
>  1 | 3 | 5 | 2
> (2 rows)
> {code}
> last page:
> {code}
> select * from test where a=1 and b<6 and (b,c) > (3,5) limit 2;
>  a | b | c | d
> ---+---+---+---
>  1 | 4 | 4 | 2
>  1 | 5 | 5 | 2
> (2 rows)
> {code}
> question:
> this query by page is ok when cassandra 2.0.8.
> but is not supported in the latest version 2.1.6
> when execute:
> {code}
> select * from test where a=1 and b<6 and (b,c) > (3,2) limit 2;
> {code}
> get one error message:
> InvalidRequest: code=2200 [Invalid query] message="Column "b" cannot have both tuple-notation inequalities and single-column inequalities: (b, c) > (3, 2)"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)