You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2016/10/11 07:24:20 UTC
[jira] [Commented] (CASSANDRA-12770) Token() CQL Function To Be
Used Without Args
[ https://issues.apache.org/jira/browse/CASSANDRA-12770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15564744#comment-15564744 ]
Sylvain Lebresne commented on CASSANDRA-12770:
----------------------------------------------
bq. The invocation just seems to have a lot of extra syntax but no benefit.
I think implicitness is its own benefit. And I don't see typing a few additional characters being an issue, especially since the {{token()}} method tends to not be typed all that often by end users (typically it's used by the Spark driver behind the scenes). So I personally think it's fine as it is and there is no point in having multiple ways to write the same thing. But short of that comment, I don't care enough that I would object to this if there is some consensus that it's genuinely useful to users.
> 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
> Priority: Minor
>
> 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)