Details
-
Improvement
-
Status: Resolved
-
Low
-
Resolution: Duplicate
-
None
-
None
-
[cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3]
Ubuntu 14.04.5 64-bit
Description
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:
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);
then added some data and queried:
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"
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).
Attachments
Issue Links
- duplicates
-
CASSANDRA-6377 ALLOW FILTERING should allow seq scan filtering
-
- Resolved
-
- is blocked by
-
CASSANDRA-8099 Refactor and modernize the storage engine
-
- Resolved
-