aks
aks

Reputation: 1029

CASSANDRA: ALLOW FILTERING not working for MATERIALIZED VIEW

VIEW:

CREATE MATERIALIZED VIEW IF NOT SampleView AS
SELECT *
FROM table
WHERE id IS NOT NULL and id1 IS NOT NULL AND col1 IS NOT NULL AND col2 IS NOT NULL
PRIMARY KEY ((id, id1), col1, col2)
WITH CLUSTERING ORDER BY (col1 DESC, col2 DESC);

Query :

select * from SampleView where id = 1 and col1 > 3 LIMIT 20 ALLOW FILTERING

Error

Partition key parts: id1 must be restricted as other parts are

IS ALLOW FILTERING clause allowed for materialised view? If not what are the other better option?

Upvotes: 1

Views: 205

Answers (1)

Christophe Schmitz
Christophe Schmitz

Reputation: 2996

You are probably running Cassandra 3.9 or below, and hitting the bug described in CASSANDRA-10368 which has been fixed in 3.10.

You probably want to upgrade to a newer version (3.11.3 recommended as of today).

Also, as Chris mentioned, materialized view are still marked as experimental, and allow filtering are only okay for dev purpose, and very rarely okay to anything with a "prod" label on it.

Upvotes: 3

Related Questions