You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jack Krupansky (JIRA)" <ji...@apache.org> on 2014/07/30 01:42:38 UTC

[jira] [Comment Edited] (CASSANDRA-7637) Add CQL3 keyword for efficient lexical range queries (e.g. START_WITH)

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

Jack Krupansky edited comment on CASSANDRA-7637 at 7/29/14 11:42 PM:
---------------------------------------------------------------------

Why not use the SQL "LIKE" keyword operator and just support trailing wildcard (AKA "prefix" query) for now?

{code}
SELECT * FROM profile WHERE profile_id = 123 AND
                  attribute LIKE 'interests.food.*';
{code}

See:
http://www.w3schools.com/sql/sql_wildcards.asp
or
http://docs.oracle.com/cd/B12037_01/server.101/b10759/conditions016.htm

Note: I use \* in my example, although SQL uses \% and ? rather than the traditional \* and ? that "real programmers" use for "glob" characters. Take your pick, or maybe have a config option for that. Do we want to be strict SQL? I don't know - let the community decide!



was (Author: jkrupan):
Why not use the SQL "LIKE" keyword operator and just support trailing wildcard (AKA "prefix" query) for now?

{code}
SELECT * FROM profile WHERE profile_id = 123 AND
                  attribute LIKE 'interests.food.*';
{code}

See:
http://www.w3schools.com/sql/sql_wildcards.asp
or
http://docs.oracle.com/cd/B12037_01/server.101/b10759/conditions016.htm



> Add CQL3 keyword for efficient lexical range queries (e.g. START_WITH)
> ----------------------------------------------------------------------
>
>                 Key: CASSANDRA-7637
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7637
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: API
>            Reporter: Rustam Aliyev
>             Fix For: 3.0
>
>
> Currently, if I want to perform range query on lexical type I need to do something like this:
> {code}
> SELECT * FROM profile WHERE profile_id = 123 AND
>                   attribute > 'interests.food.' AND
>                   attribute < 'interests.food.z';
> {code}
> This is very efficient range query. Yet, many users who are not familiar with Thrift and storage level implementation are unaware of this "trick".
> Therefore, it would be convenient to introduce CQL keyword which will do this more simply:
> {code}
> SELECT * FROM profile WHERE profile_id = 123 AND
>                   attribute START_WITH('interests.food.');
> {code}
> Keyword would have same restrictions as other inequality search operators plus some type restrictions.
> Allowed types would be:
>  * {{ascii}}
>  * {{text}} / {{varchar}}
>  * {{map<text, *>}} (same for ascii) (?)
>  * {{set<text>}} (same for ascii) (?)
> (?) may require more work, therefore optional



--
This message was sent by Atlassian JIRA
(v6.2#6252)