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 B14C81166E for ; Wed, 9 Jul 2014 08:40:04 +0000 (UTC) Received: (qmail 83648 invoked by uid 500); 9 Jul 2014 08:40:04 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 83612 invoked by uid 500); 9 Jul 2014 08:40:04 -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 83598 invoked by uid 99); 9 Jul 2014 08:40:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jul 2014 08:40:04 +0000 Date: Wed, 9 Jul 2014 08:40:04 +0000 (UTC) From: "Tuukka Mustonen (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CASSANDRA-7525) Querying by multiple secondary indexes gives java.lang.IllegalArgumentException on some cases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-7525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tuukka Mustonen updated CASSANDRA-7525: --------------------------------------- Description: Querying by: * non-primary key column with secondary index + collection with secondary index * primary key column with secondary index + non-primary key column with secondary index gives {{}} Steps to reproduce: {code} cqlsh:cs> CREATE TABLE test ( ... id1 text, ... id2 text, ... column1 text, ... column2 text, ... collection set, ... PRIMARY KEY (id1, id2) ... ); cqlsh:cs> {code} Simple query by primary key works as should: {code} cqlsh:cs> SELECT * FROM test WHERE id1 = 'foo'; (0 rows) cqlsh:cs> SELECT * FROM test WHERE id1 = 'foo' AND id2 = 'bar'; (0 rows) {code} Query by secondary index + non-indexed column: {code} cqlsh:cs> CREATE INDEX test_column1s ON test(column1); cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo'; (0 rows) cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND column2 = 'bar' ALLOW FILTERING; (0 rows) {code} Add secondary index also for the second column: {code} cqlsh:cs> CREATE INDEX test_column2s ON test(column2); cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND column2 = 'bar' ALLOW FILTERING; (0 rows) {code} Doesn't matter if we bring primary key or the collection there as well: {code} cqlsh:cs> SELECT * FROM test WHERE id1 = 'blah' AND column1 = 'foo' AND column2 = 'bar' ALLOW FILTERING; (0 rows) cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND collection CONTAINS 'bar' ALLOW FILTERING; (0 rows) {code} Let's add index for the collection: {code} cqlsh:cs> CREATE INDEX test_collections ON test(collection); cqlsh:cs> SELECT * FROM test WHERE collection CONTAINS 'bar'; (0 rows) {code} But then combine secondary index column and collection with secondary index: {code} cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND collection CONTAINS 'bar' ALLOW FILTERING; {code} Furthermore, query by primary key field with secondary index + non-primary key column with secondary index: {code} cqlsh:cs> CREATE INDEX test_id2s ON test(id2); cqlsh:cs> SELECT * FROM test WHERE id2 = 'foo' AND column1 = 'bar' ALLOW FILTERING; {code} I'm a cassandra noob so maybe I'm trying to do things the db is not meant to do? was: Querying by: * non-primary key column with secondary index + collection with secondary index * primary key column with secondary index + non-primary key column with secondary index gives {{}} Steps to reproduce: {code} cqlsh:cs> CREATE TABLE test ( ... id1 text, ... id2 text, ... column1 text, ... column2 text, ... collection set, ... PRIMARY KEY (id1, id2) ... ); cqlsh:cs> {code} Simple query by primary key works as should: {code} cqlsh:cs> SELECT * FROM test WHERE id1 = 'foo'; (0 rows) cqlsh:cs> SELECT * FROM test WHERE id1 = 'foo' AND id2 = 'bar'; (0 rows) {code} Query by secondary index + non-indexed column: {code} cqlsh:cs> CREATE INDEX test_column1s ON test(column1); cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo'; (0 rows) cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND column2 = 'bar' ALLOW FILTERING; (0 rows) {code} Add secondary index also for the second column: {code} cqlsh:cs> CREATE INDEX test_column2s ON test(column2); cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND column2 = 'bar' ALLOW FILTERING; (0 rows) {code} Doesn't matter if we bring primary key or the collection there as well: {code} cqlsh:cs> SELECT * FROM test WHERE id1 = 'blah' AND column1 = 'foo' AND column2 = 'bar' ALLOW FILTERING; (0 rows) cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND collection CONTAINS 'bar' ALLOW FILTERING; (0 rows) {code} Let's add index for the collection: {code} cqlsh:cs> CREATE INDEX test_collections ON test(collection); cqlsh:cs> SELECT * FROM test WHERE collection CONTAINS 'bar'; (0 rows) {code} But then combine secondary index column and collection with secondary index: {code} cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND collection CONTAINS 'bar' ALLOW FILTERING; {code} Furthermore, query by primary key field with secondary index + non-primary key column with secondary index: {code} cqlsh:cs> CREATE INDEX test_id2s ON test(id2); cqlsh:cs> SELECT * FROM test WHERE id2 = 'foo' AND column1 = 'bar' ALLOW FILTERING; {code} I'm a cassandra noob so maybe I'm trying to do things the db was not meant to do? > Querying by multiple secondary indexes gives java.lang.IllegalArgumentException on some cases > --------------------------------------------------------------------------------------------- > > Key: CASSANDRA-7525 > URL: https://issues.apache.org/jira/browse/CASSANDRA-7525 > Project: Cassandra > Issue Type: Bug > Reporter: Tuukka Mustonen > > Querying by: > * non-primary key column with secondary index + collection with secondary index > * primary key column with secondary index + non-primary key column with secondary index > gives {{}} > Steps to reproduce: > {code} > cqlsh:cs> CREATE TABLE test ( > ... id1 text, > ... id2 text, > ... column1 text, > ... column2 text, > ... collection set, > ... PRIMARY KEY (id1, id2) > ... ); > cqlsh:cs> > {code} > Simple query by primary key works as should: > {code} > cqlsh:cs> SELECT * FROM test WHERE id1 = 'foo'; > (0 rows) > cqlsh:cs> SELECT * FROM test WHERE id1 = 'foo' AND id2 = 'bar'; > (0 rows) > {code} > Query by secondary index + non-indexed column: > {code} > cqlsh:cs> CREATE INDEX test_column1s ON test(column1); > cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo'; > (0 rows) > cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND column2 = 'bar' ALLOW FILTERING; > (0 rows) > {code} > Add secondary index also for the second column: > {code} > cqlsh:cs> CREATE INDEX test_column2s ON test(column2); > cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND column2 = 'bar' ALLOW FILTERING; > (0 rows) > {code} > Doesn't matter if we bring primary key or the collection there as well: > {code} > cqlsh:cs> SELECT * FROM test WHERE id1 = 'blah' AND column1 = 'foo' AND column2 = 'bar' ALLOW FILTERING; > (0 rows) > cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND collection CONTAINS 'bar' ALLOW FILTERING; > (0 rows) > {code} > Let's add index for the collection: > {code} > cqlsh:cs> CREATE INDEX test_collections ON test(collection); > cqlsh:cs> SELECT * FROM test WHERE collection CONTAINS 'bar'; > (0 rows) > {code} > But then combine secondary index column and collection with secondary index: > {code} > cqlsh:cs> SELECT * FROM test WHERE column1 = 'foo' AND collection CONTAINS 'bar' ALLOW FILTERING; > > {code} > Furthermore, query by primary key field with secondary index + non-primary key column with secondary index: > {code} > cqlsh:cs> CREATE INDEX test_id2s ON test(id2); > cqlsh:cs> SELECT * FROM test WHERE id2 = 'foo' AND column1 = 'bar' ALLOW FILTERING; > > {code} > I'm a cassandra noob so maybe I'm trying to do things the db is not meant to do? -- This message was sent by Atlassian JIRA (v6.2#6252)