[ 
https://issues.apache.org/jira/browse/CASSANDRA-4372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Reinhard Buchinger updated CASSANDRA-4372:
------------------------------------------

    Description: 
Here is a CQL3 range query sample where I get wrong results (tested using cqlsh 
--cql3) from my perspective:

CREATE KEYSPACE testing WITH strategy_class = 'SimpleStrategy' AND 
strategy_options:replication_factor = 1;

USE testing;

CREATE TABLE bug_test (a int, b int, c int, d int, e int, f text, PRIMARY KEY 
(a, b, c, d, e) );

INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 2, '2');
INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 1, '1');
INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 2, 1, '1');
INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 3, '3');
INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 5, '5');

----------

Normal select everything query:

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

Everything fine so far.

----------

Select with greater equal comparison for last column of composite key:

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;

Results:

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

Bug:
Why was the last row returned? It shouldn't be there, right?

----------

Select with greater comparison for last column of composite key:

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;

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

Bug:
Why was the last row returned? It shouldn't be there, right?

The same issue is also present with between ranges (e >= 1 AND e <= 2)...

  was:
Here is a CQL3 range query sample where I get wrong results (tested using cqlsh 
--cql3) from my perspective:

{{CREATE KEYSPACE testing WITH strategy_class = 'SimpleStrategy' AND 
strategy_options:replication_factor = 1;

USE testing;

CREATE TABLE bug_test (a int, b int, c int, d int, e int, f text, PRIMARY KEY 
(a, b, c, d, e) );

INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 2, '2');
INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 1, '1');
INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 2, 1, '1');
INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 3, '3');
INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 5, '5');}}

----------

Normal select everything query:

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

Everything fine so far.

----------

Select with greater equal comparison for last column of composite key:

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;

Results:

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

Bug:
Why was the last row returned? It shouldn't be there, right?

----------

Select with greater comparison for last column of composite key:

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;

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

Bug:
Why was the last row returned? It shouldn't be there, right?

The same issue is also present with between ranges (e >= 1 AND e <= 2)...

    
> CQL3 Range Query contains unwanted results with composite columns
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-4372
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4372
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API, Core
>    Affects Versions: 1.1.1
>         Environment: Mac OS 10.7.4, Cassandra 1.1.1, single node for testing
>            Reporter: Reinhard Buchinger
>              Labels: bug, composite, compositeColumns, cql3, query, range
>
> Here is a CQL3 range query sample where I get wrong results (tested using 
> cqlsh --cql3) from my perspective:
> CREATE KEYSPACE testing WITH strategy_class = 'SimpleStrategy' AND 
> strategy_options:replication_factor = 1;
> USE testing;
> CREATE TABLE bug_test (a int, b int, c int, d int, e int, f text, PRIMARY KEY 
> (a, b, c, d, e) );
> INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 2, '2');
> INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 1, '1');
> INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 2, 1, '1');
> INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 3, '3');
> INSERT INTO bug_test (a, b, c, d, e, f) VALUES (1, 1, 1, 1, 5, '5');
> ----------
> Normal select everything query:
> 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
> Everything fine so far.
> ----------
> Select with greater equal comparison for last column of composite key:
> 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;
> Results:
>  a | b | c | d | e | f
> ---+---+---+---+---+---
>  1 | 1 | 1 | 1 | 2 | 2
>  1 | 1 | 1 | 1 | 3 | 3
>  1 | 1 | 1 | 1 | 5 | 5
>  1 | 1 | 1 | 2 | 1 | 1
> Bug:
> Why was the last row returned? It shouldn't be there, right?
> ----------
> Select with greater comparison for last column of composite key:
> 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;
> Results:
>  a | b | c | d | e | f
> ---+---+---+---+---+---
>  1 | 1 | 1 | 1 | 3 | 3
>  1 | 1 | 1 | 1 | 5 | 5
>  1 | 1 | 1 | 2 | 1 | 1
> Bug:
> Why was the last row returned? It shouldn't be there, right?
> The same issue is also present with between ranges (e >= 1 AND e <= 2)...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to