Skip to content

Instantly share code, notes, and snippets.

@JensRantil
Created August 5, 2014 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JensRantil/ec43622c26acb56e5bc9 to your computer and use it in GitHub Desktop.
Save JensRantil/ec43622c26acb56e5bc9 to your computer and use it in GitHub Desktop.
Issue with ALLOW FILTERING
cqlsh:tink> CREATE TABLE a(a uuid, b timeuuid, c uuid, PRIMARY KEY (a,b));
cqlsh:tink> INSERT INTO a(a,b,c) VALUES (48ecda32-b32a-43ae-bd30-ecf4819fb83c, 468ee710-1bd2-11e4-b2a2-0179c71c52ea, 73e54e00-ad66-4f88-8dd8-92bc1c648e9d);
cqlsh:tink> INSERT INTO a(a,b,c) VALUES (48ecda32-b32a-43ae-bd30-ecf4819fb83c, 468ee711-1bd2-11e4-b2a2-0179c71c52ea, 2fdb7e7a-cf9d-43a4-aa86-7820336fc363);
cqlsh:tink> INSERT INTO a(a,b,c) VALUES (48ecda32-b32a-43ae-bd30-ecf4819fb83c, 468ee712-1bd2-11e4-b2a2-0179c71c52ea, 18551ae7-b117-4b41-b5fa-fd233e2425dd);
cqlsh:tink> SELECT * FROM a;
a | b | c
--------------------------------------+--------------------------------------+--------------------------------------
48ecda32-b32a-43ae-bd30-ecf4819fb83c | 468ee710-1bd2-11e4-b2a2-0179c71c52ea | 73e54e00-ad66-4f88-8dd8-92bc1c648e9d
48ecda32-b32a-43ae-bd30-ecf4819fb83c | 468ee711-1bd2-11e4-b2a2-0179c71c52ea | 2fdb7e7a-cf9d-43a4-aa86-7820336fc363
48ecda32-b32a-43ae-bd30-ecf4819fb83c | 468ee712-1bd2-11e4-b2a2-0179c71c52ea | 18551ae7-b117-4b41-b5fa-fd233e2425dd
(3 rows)
cqlsh:tink> SELECT * FROM a WHERE a=48ecda32-b32a-43ae-bd30-ecf4819fb83c;
a | b | c
--------------------------------------+--------------------------------------+--------------------------------------
48ecda32-b32a-43ae-bd30-ecf4819fb83c | 468ee710-1bd2-11e4-b2a2-0179c71c52ea | 73e54e00-ad66-4f88-8dd8-92bc1c648e9d
48ecda32-b32a-43ae-bd30-ecf4819fb83c | 468ee711-1bd2-11e4-b2a2-0179c71c52ea | 2fdb7e7a-cf9d-43a4-aa86-7820336fc363
48ecda32-b32a-43ae-bd30-ecf4819fb83c | 468ee712-1bd2-11e4-b2a2-0179c71c52ea | 18551ae7-b117-4b41-b5fa-fd233e2425dd
(3 rows)
cqlsh:tink> SELECT * FROM a WHERE a=48ecda32-b32a-43ae-bd30-ecf4819fb83c AND c=73e54e00-ad66-4f88-8dd8-92bc1c648e9d;
Bad Request: No indexed columns present in by-columns clause with Equal operator
cqlsh:tink> SELECT * FROM a WHERE a=48ecda32-b32a-43ae-bd30-ecf4819fb83c AND c=73e54e00-ad66-4f88-8dd8-92bc1c648e9d ALLOW FILTERING;
Bad Request: No indexed columns present in by-columns clause with Equal operator
@JensRantil
Copy link
Author

E-mail to Cassandra user mailing list:

Hi,

I'm having an issue with ALLOW FILTERING with Cassandra 2.0.8. See a minimal example here: https://gist.github.com/JensRantil/ec43622c26acb56e5bc9

I expect the second last to fail, but the last query to return a single row. In particular I expect the last SELECT to first select using the clustering primary id and then do filtering.

I've been reading https://cassandra.apache.org/doc/cql3/CQL.html#selectStmt "ALLOW FILTERING" and can't wrap my head around why this won't work.

Could anyone clarify this for me?

Thanks,
Jens

@ptnapoleon
Copy link

I believe you need to insert an index on c prior to being able to select on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment