Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 50EE31914A for ; Wed, 6 Apr 2016 10:30:26 +0000 (UTC) Received: (qmail 5856 invoked by uid 500); 6 Apr 2016 10:30:25 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 5798 invoked by uid 500); 6 Apr 2016 10:30:25 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 5522 invoked by uid 99); 6 Apr 2016 10:30:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Apr 2016 10:30:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id AA1002C1F60 for ; Wed, 6 Apr 2016 10:30:25 +0000 (UTC) Date: Wed, 6 Apr 2016 10:30:25 +0000 (UTC) From: "Julien Muller (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CASSANDRA-11510) Clustering key and secondary index MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Julien Muller created CASSANDRA-11510: ----------------------------------------- Summary: 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 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)