[
https://issues.apache.org/jira/browse/CASSANDRA-11510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sam Tunnicliffe updated CASSANDRA-11510:
----------------------------------------
Resolution: Fixed
Fix Version/s: (was: 3.0.x)
(was: 2.2.x)
(was: 3.x)
2.2.7
3.0.6
3.6
Reproduced In: 3.4, 3.3 (was: 3.3, 3.4)
Status: Resolved (was: Ready to Commit)
Thanks, committed to 2.2 in {{dff7b447a74d639888eca76c940c057d3fa647e7}} and
merged to 3.0 & trunk.
> Clustering key and secondary index
> ----------------------------------
>
> Key: CASSANDRA-11510
> URL: https://issues.apache.org/jira/browse/CASSANDRA-11510
> Project: Cassandra
> Issue Type: Bug
> Components: CQL
> Environment: ubuntu 14.04 LTS
> Reporter: Julien Muller
> Assignee: Sam Tunnicliffe
> Fix For: 3.6, 3.0.6, 2.2.7
>
>
> I noticed the following change in behavior while migrating from 2.0.11:
> Elements of the clustering key seems to not be secondary indexable anymore.
> Using this table:
> {code:sql}
> CREATE TABLE table1 (
> name text,
> class int,
> inter text,
> power int,
> PRIMARY KEY (name, class, inter)
> ) WITH CLUSTERING ORDER BY (class DESC, inter ASC);
> INSERT INTO table1 (name, class, inter, power) VALUES ('R1',1, 'int1',13);
> INSERT INTO table1 (name, class, inter, power) VALUES ('R1',2, 'int1',18);
> INSERT INTO table1 (name, class, inter, power) VALUES ('R1',3, 'int1',37);
> INSERT INTO table1 (name, class, inter, power) VALUES ('R1',4, 'int1',49);
> {code}
> In version 2.0.11, I used to have a secondary index on inter, that allowed me
> to make fast queries on the table:
> {code:sql}
> CREATE INDEX table1_inter ON table1 (inter);
> SELECT * FROM table1 where name='R1' AND class>0 AND class<4 AND inter='int1'
> ALLOW FILTERING;
> {code}
> While testing on 3.3.0, I get the following message:
> Clustering column "inter" cannot be restricted (preceding column "class" is
> restricted by a non-EQ relation)
> It seems to only be considered as a key and the index and ALLOW FILTERING are
> not taken into account anymore (as it was in 2.0.11).
> I found the following workaround:
> Duplicate the column inter as a regular column, and simply query it with the
> secondary index and no ALLOW FILTERING. It looks like the behavior I would
> anticipate and do not understand why it does not work on inter only because
> it is a clustering key. The only answer on the ml evokes a bug.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)