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

Benjamin Lerer commented on CASSANDRA-6075:
-------------------------------------------

I had a look and it is not easy to solve that problem. 
The problem come from the fact that we build the restrictions at the same time 
that we do part of our validation. We will try to compute the value of token(0, 
0, 'a') before we even know if we have all the columns required within the 
token function or if their is a mix of restrictions using token function that 
we do not support. If we want to do those check earlier we will end up 
duplicating the test that we do on Restrictions on Relations.
This seems to indicate a problem in the code. I believe that the code should 
first perform the validation checks on Relations then build Restrictions.
I planning to refactor SelectStatement and I will be able to tackle that 
problem properly at that time but I want to do that refactoring in 3.0 as it is 
not a trivial stuff to do.
So my proposal is to deliver the current fix in 2.0 and 2.1 (knowing that it is 
not perfect) and properly fix it for 3.0.
I opened #CASSANDRA-7981 for the SelectStatement refactoring were I keep track 
of this issue. 
What do you think Tyler?

> The token function should allow column identifiers in the correct order only
> ----------------------------------------------------------------------------
>
>                 Key: CASSANDRA-6075
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6075
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Cassandra 1.2.9
>            Reporter: Michaël Figuière
>            Assignee: Benjamin Lerer
>            Priority: Minor
>              Labels: cql
>             Fix For: 2.0.11
>
>         Attachments: CASSANDRA-2.1-6075.txt, CASSANDRA-6075.txt
>
>
> Given the following table:
> {code}
> CREATE TABLE t1 (a int, b text, PRIMARY KEY ((a, b)));
> {code}
> The following request returns an error in cqlsh as literal arguments order is 
> incorrect:
> {code}
> SELECT * FROM t1 WHERE token(a, b) > token('s', 1);
> Bad Request: Type error: 's' cannot be passed as argument 0 of function token 
> of type int
> {code}
> But surprisingly if we provide the column identifier arguments in the wrong 
> order no error is returned:
> {code}
> SELECT * FROM t1 WHERE token(a, b) > token(1, 'a'); // correct order is valid
> SELECT * FROM t1 WHERE token(b, a) > token(1, 'a'); // incorrect order is 
> valid as well
> {code}



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

Reply via email to