You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Blake Visin (JIRA)" <ji...@apache.org> on 2011/07/22 21:34:58 UTC

[jira] [Created] (CASSANDRA-2939) CQL regex to match column family in query

CQL regex to match column family in query
-----------------------------------------

                 Key: CASSANDRA-2939
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2939
             Project: Cassandra
          Issue Type: Bug
          Components: Drivers
         Environment: Python CQL
            Reporter: Blake Visin


In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)

Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M)

The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause

I believe the fix is:

_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M)

Added the ? so the regex is not so greedy

use this query to reproduce the results:

SELECT key FROM column_family WHERE key = 'break from chores'"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-2939) CQL regex to match column family in query

Posted by "Blake Visin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13069692#comment-13069692 ] 

Blake Visin commented on CASSANDRA-2939:
----------------------------------------

How do I do code blocks?  The regex's don't show up correctly in the description and the syntax is underlining it.

> CQL regex to match column family in query
> -----------------------------------------
>
>                 Key: CASSANDRA-2939
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2939
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Drivers
>         Environment: Python CQL
>            Reporter: Blake Visin
>              Labels: CQL, python
>
> In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)
> Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M)
> The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause
> I believe the fix is:
> _cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M)
> Added the ? so the regex is not so greedy
> use this query to reproduce the results:
> SELECT key FROM column_family WHERE key = 'break from chores'"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CASSANDRA-2939) CQL regex to match column family in query

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis reassigned CASSANDRA-2939:
-----------------------------------------

    Assignee: Tyler Hobbs

> CQL regex to match column family in query
> -----------------------------------------
>
>                 Key: CASSANDRA-2939
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2939
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Drivers
>         Environment: Python CQL
>            Reporter: Blake Visin
>            Assignee: Tyler Hobbs
>              Labels: CQL, python
>
> In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)
> {code}Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause
> I believe the fix is:
> {code}_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> Added the ? so the regex is not so greedy
> use this query to reproduce the results:
> SELECT key FROM column_family WHERE key = 'break from chores'"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CASSANDRA-2939) CQL regex to match column family in query

Posted by "Tyler Hobbs (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tyler Hobbs updated CASSANDRA-2939:
-----------------------------------

    Attachment: 2939-test.txt
                2939.txt

2939.txt updates the regex to the one provided by Blake. (In case you're not familiar with the syntax, "+?" is a non-greedy version of "+".)

2939-test.txt adds a small unit test to exercise the Cursor._cfamily_re regex.

> CQL regex to match column family in query
> -----------------------------------------
>
>                 Key: CASSANDRA-2939
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2939
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Drivers
>         Environment: Python CQL
>            Reporter: Blake Visin
>            Assignee: Tyler Hobbs
>              Labels: CQL, python
>         Attachments: 2939-test.txt, 2939.txt
>
>
> In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)
> {code}Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause
> I believe the fix is:
> {code}_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> Added the ? so the regex is not so greedy
> use this query to reproduce the results:
> SELECT key FROM column_family WHERE key = 'break from chores'"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CASSANDRA-2939) CQL regex to match column family in query

Posted by "Blake Visin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Blake Visin updated CASSANDRA-2939:
-----------------------------------

    Description: 
In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)

{code}Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M){code}

The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause

I believe the fix is:

{code}_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M){code}

Added the ? so the regex is not so greedy

use this query to reproduce the results:

SELECT key FROM column_family WHERE key = 'break from chores'"

  was:
In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)

Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M)

The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause

I believe the fix is:

_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M)

Added the ? so the regex is not so greedy

use this query to reproduce the results:

SELECT key FROM column_family WHERE key = 'break from chores'"


> CQL regex to match column family in query
> -----------------------------------------
>
>                 Key: CASSANDRA-2939
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2939
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Drivers
>         Environment: Python CQL
>            Reporter: Blake Visin
>              Labels: CQL, python
>
> In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)
> {code}Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause
> I believe the fix is:
> {code}_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> Added the ? so the regex is not so greedy
> use this query to reproduce the results:
> SELECT key FROM column_family WHERE key = 'break from chores'"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CASSANDRA-2939) CQL regex to match column family in query

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis updated CASSANDRA-2939:
--------------------------------------

    Reviewer: thobbs
    Priority: Minor  (was: Major)
    Assignee: Blake Visin  (was: Tyler Hobbs)

> CQL regex to match column family in query
> -----------------------------------------
>
>                 Key: CASSANDRA-2939
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2939
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Drivers
>         Environment: Python CQL
>            Reporter: Blake Visin
>            Assignee: Blake Visin
>            Priority: Minor
>              Labels: CQL, python
>         Attachments: 2939-test.txt, 2939.txt
>
>
> In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)
> {code}Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause
> I believe the fix is:
> {code}_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> Added the ? so the regex is not so greedy
> use this query to reproduce the results:
> SELECT key FROM column_family WHERE key = 'break from chores'"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CASSANDRA-2939) CQL regex to match column family in query

Posted by "Tyler Hobbs (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13081075#comment-13081075 ] 

Tyler Hobbs edited comment on CASSANDRA-2939 at 8/8/11 5:31 PM:
----------------------------------------------------------------

2939.txt updates the regex to the one provided by Blake. (In case you're not familiar with the syntax, "\+?" is a non-greedy version of "+".)

2939-test.txt adds a small unit test to exercise the Cursor._cfamily_re regex.

      was (Author: thobbs):
    2939.txt updates the regex to the one provided by Blake. (In case you're not familiar with the syntax, "+?" is a non-greedy version of "+".)

2939-test.txt adds a small unit test to exercise the Cursor._cfamily_re regex.
  
> CQL regex to match column family in query
> -----------------------------------------
>
>                 Key: CASSANDRA-2939
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2939
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Drivers
>         Environment: Python CQL
>            Reporter: Blake Visin
>            Assignee: Tyler Hobbs
>              Labels: CQL, python
>         Attachments: 2939-test.txt, 2939.txt
>
>
> In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)
> {code}Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause
> I believe the fix is:
> {code}_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> Added the ? so the regex is not so greedy
> use this query to reproduce the results:
> SELECT key FROM column_family WHERE key = 'break from chores'"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CASSANDRA-2939) CQL regex to match column family in query

Posted by "Blake Visin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Blake Visin updated CASSANDRA-2939:
-----------------------------------

    Comment: was deleted

(was: How do I do code blocks?  The regex's don't show up correctly in the description and the syntax is underlining it.)

> CQL regex to match column family in query
> -----------------------------------------
>
>                 Key: CASSANDRA-2939
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2939
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Drivers
>         Environment: Python CQL
>            Reporter: Blake Visin
>              Labels: CQL, python
>
> In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py)
> {code}Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> The Regex will improperly match anything after the word  'from' even if it is in the WHERE clause
> I believe the fix is:
> {code}_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M){code}
> Added the ? so the regex is not so greedy
> use this query to reproduce the results:
> SELECT key FROM column_family WHERE key = 'break from chores'"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira