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] [Updated] (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:all-tabpanel
]

Sam Tunnicliffe updated CASSANDRA-11510:
----------------------------------------
    Reproduced In: 3.4, 3.3  (was: 3.3, 3.4)
           Status: Patch Available  (was: In Progress)

It seems that this functionality was inadvertently removed in 2.2.0 by CASSANDRA-7981. It's
(very) recently been fixed in trunk by CASSANDRA-11310, and I've backported some elements
of that ticket to 2.2 and 3.0 to restore just what was missing. There are a number of differences
in the related classes between 2.2 and 3.0 so those patches both need reviewing separately;
the trunk patch just contains an updated test.

||branch||testall||dtest||
|[11510-2.2|https://github.com/beobal/cassandra/tree/11510-2.2]|[testall|http://cassci.datastax.com/view/Dev/view/beobal/job/beobal-11510-2.2-testall]|[dtest|http://cassci.datastax.com/view/Dev/view/beobal/job/beobal-11510-2.2-dtest]|
|[11510-3.0|https://github.com/beobal/cassandra/tree/11510-3.0]|[testall|http://cassci.datastax.com/view/Dev/view/beobal/job/beobal-11510-3.0-testall]|[dtest|http://cassci.datastax.com/view/Dev/view/beobal/job/beobal-11510-3.0-dtest]|
|[11510-trunk|https://github.com/beobal/cassandra/tree/11510-trunk]|[testall|http://cassci.datastax.com/view/Dev/view/beobal/job/beobal-11510-trunk-testall]|[dtest|http://cassci.datastax.com/view/Dev/view/beobal/job/beobal-11510-trunk-dtest]|


> 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.4, 3.3
>
>
> 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