[ 
https://issues.apache.org/jira/browse/CASSANDRA-8424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lex Lythius updated CASSANDRA-8424:
-----------------------------------
    Labels: collections  (was: )

> Collection filtering not working when using PK
> ----------------------------------------------
>
>                 Key: CASSANDRA-8424
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8424
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: [cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native 
> protocol v3]
> Ubuntu 14.04.5 64-bit
>            Reporter: Lex Lythius
>              Labels: collections
>             Fix For: 2.1.3
>
>
> I can do queries for collection keys/values as detailed in 
> http://www.datastax.com/dev/blog/cql-in-2-1 without problems. Even without 
> having a secondary index on the collection it will work (with {{ALLOW 
> FILTERING}}) but only as long as the query is performed through a *secondary* 
> index. If you go through PK it won't. Of course full-scan filtering query is 
> not allowed.
> As an example, I created this table:
> {code:SQL}
> CREATE TABLE test.uloc9 (
>     usr int,
>     type int,
>     gb ascii,
>     gb_q ascii,
>     info map<ascii, text>,
>     lat float,
>     lng float,
>     q int,
>     traits set<ascii>,
>     ts timestamp,
>     PRIMARY KEY (usr, type)
> );
> CREATE INDEX uloc9_gb ON test.uloc9 (gb);
> CREATE INDEX uloc9_gb_q ON test.uloc9 (gb_q);
> CREATE INDEX uloc9_traits ON test.uloc9 (traits);
> {code}
> then added some data and queried:
> {code}
> cqlsh:test> select * from uloc9 where gb='/nw' and info contains 'argentina' 
> allow filtering;
>  usr | type | gb  | gb_q  | info                                     | lat    
>       | lng          | q | traits             | ts
> -----+------+-----+-------+------------------------------------------+--------------+--------------+---+--------------------+--------------------------
>    1 |    0 | /nw | /nw:1 | {'ci': 'san antonio', 'co': 'argentina'} | 
> -40.74000168 | -65.80000305 | 1 | {'r:photographer'} | 2014-11-04 
> 18:20:29-0300
>    1 |    1 | /nw | /nw:1 | {'ci': 'san antonio', 'co': 'argentina'} | 
> -40.75799942 | -66.00800323 | 1 | {'r:photographer'} | 2014-11-04 
> 18:20:29-0300
> (2 rows)
> cqlsh:test> select * from uloc9 where usr=1 and info contains 'argentina' 
> allow filtering;
> code=2200 [Invalid query] message="No indexed columns present in by-columns 
> clause with Equal operator"
> cqlsh:test> select * from uloc9 where usr=1 and type=0 and info contains 
> 'argentina' allow filtering;
> code=2200 [Invalid query] message="No indexed columns present in by-columns 
> clause with Equal operator"
> {code}
> Maybe I got things wrong, but I don't see any reasons why collection 
> filtering should fail when using PK while it succeeds using any secondary 
> index (related or otherwise).



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

Reply via email to