Russell Spitzer created CASSANDRA-12770:
-------------------------------------------

             Summary: Token() CQL Function To Be Used Without Args
                 Key: CASSANDRA-12770
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12770
             Project: Cassandra
          Issue Type: Improvement
          Components: CQL
            Reporter: Russell Spitzer


The Spark Cassandra Connector uses statments like
{code}
SELECT ... WHERE TOKEN(partitionkey) < #
{code}

But I was considering today, why should we pass the partition key names to the 
Token Function?

If we look at the TokenRestriction
https://github.com/apache/cassandra/blob/81f6c784ce967fadb6ed7f58de1328e713eaf53c/src/java/org/apache/cassandra/cql3/TokenRelation.java#L174-L184

The restrictions on the token function basically mean there is only ever 1 
valid invocation of {{Token}}
{code}
Token(partitionkey1, partitionkey2, partitionkey3)
{code}

Now there can be an argument that this is helpful to folks matching {{Tokens}} 
together

{code}
Token(partitionkey1, partitionkey2, partitionkey3) < Token(1,1,3)
{code}

But if we have a single literal on the right hand side
{code}
Token(partitionkey1, partitionkey2, partitionkey3) < 10
{code}
The invocation just seems to have a lot of extra syntax but no benefit.

It would be great if it looked like this instead
{code}
Token() > 0 OR Token() < 30000
{code}



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

Reply via email to