cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DOAN DuyHai (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-11401) [Regression] Incorrect results for clustering tuples query
Date Tue, 22 Mar 2016 17:41:25 GMT

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

DOAN DuyHai commented on CASSANDRA-11401:
-----------------------------------------

bq. If you ignore the order that Cassandra stores the rows on disk, you can see that logically
speaking, 3.3 returns incorrect results

 The problem is that I have designed the table with DESC clustering order for the {{date}}
column. Also the {{SELECT * FROM entity_with_clusterings;}} is showing the result as Cassandra
stores data on disk, which is consistent with the defined clustering order:

{noformat}
 id                  | uuid                                 | date                     | value
---------------------+--------------------------------------+--------------------------+-------
 3233835834146573312 | 00000000-0000-0000-0000-000000000000 | 2015-10-03 00:00:00+0000 | 
val3
 3233835834146573312 | 00000000-0000-0000-0000-000000000000 | 2015-10-02 00:00:00+0000 | 
val2
 3233835834146573312 | 00000000-0000-0000-0000-000000000000 | 2015-10-01 00:00:00+0000 | 
val1
 3233835834146573312 | 00000000-0000-0000-0000-000000000001 | 2015-10-05 00:00:00+0000 | 
val5
 3233835834146573312 | 00000000-0000-0000-0000-000000000001 | 2015-10-04 00:00:00+0000 | 
val4
{noformat}

 So if the SELECT returns the above result, logically, all clustering tuples (uuid, date)
>= {{(00....000, 2015-10-02 00:00:00+0000)}} should be {{val2}}, {{val1}}, {{val5}} and
{{val4}} and exactly in this order ...

 The trick is that the ordering is done on the couple {{(uuid,date)}} and neither {{uuid}}
nor {{date}} alone ...

 My problem here is that if you say that *Cassandra 3.4* is returning the correct result,
then it is not consistent with what is displayed by {{SELECT * ...}} 

 

> [Regression] Incorrect results for clustering tuples query
> ----------------------------------------------------------
>
>                 Key: CASSANDRA-11401
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11401
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>         Environment: *Cassandra 3.4*
>            Reporter: DOAN DuyHai
>            Priority: Critical
>
> There is a regression since *Cassandra 3.4* with query using clustering tuple values:
> {noformat}
> cqlsh:test> CREATE TABLE IF NOT EXISTS entity_with_clusterings(
> 		id bigint,
> 		uuid uuid,
> 		date timestamp,
> 		value text,
> 		PRIMARY KEY(id, uuid, date))
> WITH CLUSTERING ORDER BY(uuid ASC, date DESC);
> cqlsh:test> INSERT INTO entity_with_clusterings(id, uuid, date, value) VALUES(3233835834146573312,
00000000-0000-0000-0000-000000000000, '2015-10-01 00:00:00+0000', 'val1');
> cqlsh:test> INSERT INTO entity_with_clusterings(id, uuid, date, value) VALUES(3233835834146573312,
00000000-0000-0000-0000-000000000000, '2015-10-02 00:00:00+0000', 'val2');
> cqlsh:test> INSERT INTO entity_with_clusterings(id, uuid, date, value) VALUES(3233835834146573312,
00000000-0000-0000-0000-000000000000, '2015-10-03 00:00:00+0000', 'val3');
> cqlsh:test> INSERT INTO entity_with_clusterings(id, uuid, date, value) VALUES(3233835834146573312,
00000000-0000-0000-0000-000000000001, '2015-10-04 00:00:00+0000', 'val4');
> cqlsh:test> INSERT INTO entity_with_clusterings(id, uuid, date, value) VALUES(3233835834146573312,
00000000-0000-0000-0000-000000000001, '2015-10-05 00:00:00+0000', 'val5');
> cqlsh:test> SELECT * FROM entity_with_clusterings;
>  id                  | uuid                                 | date                  
  | value
> ---------------------+--------------------------------------+--------------------------+-------
>  3233835834146573312 | 00000000-0000-0000-0000-000000000000 | 2015-10-03 00:00:00+0000
|  val3
>  3233835834146573312 | 00000000-0000-0000-0000-000000000000 | 2015-10-02 00:00:00+0000
|  val2
>  3233835834146573312 | 00000000-0000-0000-0000-000000000000 | 2015-10-01 00:00:00+0000
|  val1
>  3233835834146573312 | 00000000-0000-0000-0000-000000000001 | 2015-10-05 00:00:00+0000
|  val5
>  3233835834146573312 | 00000000-0000-0000-0000-000000000001 | 2015-10-04 00:00:00+0000
|  val4
> (5 rows)
> cqlsh:test > SELECT uuid,date,value 
> FROM entity_with_clusterings 
> WHERE id=3233835834146573312 
> AND (uuid,date)>=(00000000-0000-0000-0000-000000000000,'2015-10-02 00:00:00+0000')

> AND (uuid,date)<(00000000-0000-0000-0000-000000000001, '2015-10-04 00:00:00+0000');
>  uuid                                 | date                            | value
> --------------------------------------+---------------------------------+-------
>  00000000-0000-0000-0000-000000000000 | 2015-10-03 00:00:00.000000+0000 |  val3
>  00000000-0000-0000-0000-000000000000 | 2015-10-02 00:00:00.000000+0000 |  val2
> {noformat}
> The same query with *Cassandra 3.3* returns correct answer:
> {noformat}
> cqlsh:test> SELECT uuid,date,value
> FROM entity_with_clusterings
> WHERE id=3233835834146573312
> AND (uuid,date)>=(00000000-0000-0000-0000-000000000000,'2015-10-02 00:00:00+0000')
> AND (uuid,date)<(00000000-0000-0000-0000-000000000001, '2015-10-04 00:00:00+0000');
>  uuid                                 | date                     | value
> --------------------------------------+--------------------------+-------
>  00000000-0000-0000-0000-000000000000 | 2015-10-02 00:00:00+0000 |  val2
>  00000000-0000-0000-0000-000000000000 | 2015-10-01 00:00:00+0000 |  val1
>  00000000-0000-0000-0000-000000000001 | 2015-10-05 00:00:00+0000 |  val5
> {noformat}



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

Mime
View raw message