cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Tunnicliffe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-11510) Clustering key and secondary index
Date Wed, 20 Apr 2016 14:27:25 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-11510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15249988#comment-15249988
] 

Sam Tunnicliffe commented on CASSANDRA-11510:
---------------------------------------------

[~blerer] would you mind reviewing please?

> 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.3, 3.4
>
>
> 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)

Mime
View raw message