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

Piotr Kołaczkowski commented on CASSANDRA-7020:
-----------------------------------------------

I'm fine leaving it as is for now - I filed the ticket because it felt 
surprising at that moment, but now we have a workaround. So maybe just 
documenting the special minToken case in the CQL docs on tokens would be enough 
for now? 

What I don't like about the present state of handling tokens by CQL is that in 
some cases it treats tokens as if there was total ordering and in some cases 
like here - it doesn't. So for example querying for [a, b) where b < a yields 
an empty result (doesn't wrap around). That's why the application has to unwrap 
the range manually anyways and fetch a wrapping token range with 2 separate 
queries. Unfortunately after unwrapping you get a mintoken on the split point 
and then you realize that mintoken actually wraps around and selects 
everything. This is how we ended up with a bug in our code.

If it always did wrap-around, that would be IMHO consistent, but we needed to 
probably disallow open-ended queries for tokens i.e. "token(...) >= a" without 
a corresponding "token(...) < b" clause, as they would always return the full 
ring. 



> Incorrect result of query WHERE token(key) < -9223372036854775808 when using 
> Murmur3Partitioner
> -----------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-7020
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7020
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: cassandra 2.0.6-snapshot 
>            Reporter: Piotr Kołaczkowski
>            Assignee: Marko Denda
>             Fix For: 2.1.x
>
>         Attachments: 7020.txt
>
>
> {noformat}
> cqlsh:test1> select * from test where token("key") < -9223372036854775807;
> (0 rows)
> cqlsh:test1> select * from test where token("key") < -9223372036854775808;
>  key | value
> -----+----------
>    5 |   eeeeee
>   10 |        j
>    1 |     aaaa
>    8 | hhhhhhhh
>    2 |      bbb
>    4 |       dd
>    7 |     gggg
>    6 |      fff
>    9 |     iiii
>    3 |    ccccc
> {noformat}
> Expected: empty result.



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

Reply via email to