Assume a simple table with one insert (or without this insert, doesn't really matter).
CREATE TABLE test (
x int,
y int,
z int,
PRIMARY KEY (x, y, z)
);
create index z_index on test (z);
insert into test(x, y, z) values (1,2,3);
I struggle to understand why I cannot query with an in clause on the index z:
cqlsh:test> select * from test where z in (3);
Bad Request: PRIMARY KEY part z cannot be restricted (preceding part y is either not restricted or by a non-EQ relation)
It is possible with a simple equals predicate:
cqlsh:test> select * from test where z = 3;
x | y | z
---+---+---
1 | 2 | 3
(0 rows)
I thought having an index on z would keep a mapping from specific values of z to rows but this assumption seems wrong.
Why this doesn't work the way I expected? I guess the index works differently.
EDIT: I am using [cqlsh 4.1.1 | Cassandra 2.0.6 | CQL spec 3.1.1 | Thrift protocol 19.39.0]