Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Won't Fix
-
None
-
None
-
None
-
Normal
Description
Everything below was done using cqlsh -3, against single node Cassandra 1.1.6.
I created a test table with the following definition:
CREATE TABLE testtable (
a text,
b text,
c text,
data text,
PRIMARY KEY (a, b, c)
) WITH
comment='' AND
caching='KEYS_ONLY' AND
read_repair_chance=0.100000 AND
gc_grace_seconds=864000 AND
replicate_on_write='true' AND
compaction_strategy_class='SizeTieredCompactionStrategy' AND
compression_parameters:sstable_compression='SnappyCompressor';
and inserted some data:
INSERT INTO testtable (a, b, c, data) VALUES ('1', '1', '1', 'data 1');
INSERT INTO testtable (a, b, c, data) VALUES ('1', '1', '2', 'data 2');
INSERT INTO testtable (a, b, c, data) VALUES ('1', '1', '3', 'data 3');
so a full table query produced:
cqlsh:testkeyspace> select * from testtable;
a | b | c | data
----+-------
1 | 1 | 1 | data 1
1 | 1 | 2 | data 2
1 | 1 | 3 | data 3
Next I tried the following query with an IN relation on the second part of the key:
cqlsh:testkeyspace> select * from testtable where a = '1' and b in ('1', '2');
Bad Request: PRIMARY KEY part b cannot be restricted by IN relation (only the first and last parts can)
which is apparently not supported, but the error message suggests an IN relation in the last part is supported, so I tried:
cqlsh:testkeyspace> select * from testtable where a = '1' and b = '1' and c in ('1', '2');
cqlsh:testkeyspace>
which did not produce an error, but also returned no results. I was expecting 2 rows. This seems to be a bug?
Note that I get the expected result if the IN relation contains only 1 value:
cqlsh:testkeyspace> select * from testtable where a = '1' and b = '1' and c in ('1');
a | b | c | data
----+-------
1 | 1 | 1 | data 1