I'm playing with Cassandra(cql). When I do a SELECT it returns me an error:
Clustering column "domain" cannot be restricted (preceding column "timestamp" is restricted by a non-EQ relation).
Columns "domain" (type varchar) and "timestamp" (type timestamp) are Primary Keys.
WHEN I filter only by "timestamp" like this:
SELECT id, comment, language, location, section, domain, type, user, timestamp
FROM comments WHERE ts >= ? AND ts <= ? ALLOW FILTERING;
Works fine, but when I try to filter including "domain" returns me that error:
SELECT id, comment, language, location, section, domain, type, user, timestamp
FROM comments WHERE domain=? AND ts >= ? AND ts <= ? ALLOW FILTERING;
CREATE TABLE CQL:
CREATE TABLE table (
id varchar,
type varchar,
section varchar,
comment text,
language varchar,
location text,
user int,
domain varchar,
timestamp timestamp,
PRIMARY KEY (id, timestamp, domain, user, section))
WITH CLUSTERING ORDER BY (timestamp DESC);
WHERE
limitations in Cassandra? It clearly states that range queries can be only at the last portion of the WHERE clause, and the error says that you are usingts
in non restricted way. By the way the error says Clustering column, probably you have underestimate something in your table definition (eg partition key, clustering key). Post it and let's see... – xmas79CREATE TABLE table ( id varchar, type varchar, section varchar, comment text, language varchar, location text, user int, domain varchar,timestamp timestamp, PRIMARY KEY (id,timestampdomain,user,section)) WITH CLUSTERING ORDER BY (ts DESC);
– Lexo Alonzo