cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Thompson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-7891) Select an element inside a UDT throws an index error
Date Fri, 19 Sep 2014 15:44:35 GMT

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

Philip Thompson commented on CASSANDRA-7891:
--------------------------------------------

The error occurs at
{code}parsed = cqlruleset.cql_parse(query_string)[1]{code}
inside {code}def parse_for_table_meta{code}.
{code}
cqlruleset.cql_parse{code} is in {code}
cassandra/pylib/cqlshlib/cqlhandling.py(115)cql_parse(){code}
which calls {code}self.parse(startsymbol, tokens, init_bindings={'*SRC*': text}){code}
which is in {code}cassandra/pylib/cqlshlib/pylexotron.py(446)parse(){code}
which returns {code}return pattern.match(ctxt, None){code}
which returns at {code}
163         while True:
    164             new_ctxts = []
    165             for c in ctxts:
    166                 new_ctxts.extend(self.arg.match(c, completions))
    167             if not new_ctxts:
--> 168                 return found
{code}
at which point:
{code}
found == ctxts == [<ParseContext matched=() remainder=(('K_SELECT', 'select', (0, 6)),
('identifier', 'name', (7, 11)), ('op', '.', (11, 12)), ('identifier', 'lastname', (12, 20)),
('K_FROM', 'from', (21, 25)), ('identifier', 'users', (26, 31)), ('K_WHERE', 'where', (32,
37)), ('identifier', 'id', (38, 40)), ('op', '=', (40, 41)), ('uuid', '62c36092-82a1-3a00-93d1-46196ee77204',
(41, 77)), ('endtoken', ';', (77, 78))) prodname='Start' bindings={'*SRC*': 'select name.lastname
from users where id=62c36092-82a1-3a00-93d1-46196ee77204;'}>]
{code}
Because found is being returned all the way up to 
{code}parsed = cqlruleset.cql_parse(query_string)[1]{code}
and is a list of length 1, there is no index 1 which causes this exception.

> Select an element inside a UDT throws an index error
> ----------------------------------------------------
>
>                 Key: CASSANDRA-7891
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7891
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Patrick McFadin
>            Assignee: Philip Thompson
>             Fix For: 3.0
>
>
> Create the following data model:
> {noformat}
> CREATE TYPE address (
> street text,
> city text,
> zip_code int,
> phones set<text>
>  );
>  
> CREATE TYPE fullname (
> firstname text,
> lastname text
> );
> CREATE TABLE users (
> id uuid PRIMARY KEY,
> name FROZEN <fullname>,
> addresses map<text, FROZEN <address>>
> );
> INSERT INTO users (id, name) 
> VALUES (62c36092-82a1-3a00-93d1-46196ee77204, {firstname: 'Marie-Claude', lastname: 'Josset'});
> {noformat}
> When trying to select a sub-field in the name type:
> {noformat}
> SELECT name.lastname FROM users WHERE id=62c36092-82a1-3a00-93d1-46196ee77204;
> {noformat}
> You get the following error:
> {noformat}
> list index out of range
> {noformat}



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

Mime
View raw message