[ 
https://issues.apache.org/jira/browse/CASSANDRA-7525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne updated CASSANDRA-7525:
----------------------------------------

    Assignee: Tyler Hobbs  (was: Sylvain Lebresne)

> 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
>            Assignee: Tyler Hobbs
>
> 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 {{<ErrorMessage code=0000 [Server error] 
> message="java.lang.IllegalArgumentException: expected one element but was: 
> <org.apache.cassandra.db.index.composites.CompositesSearcher@156b5576, 
> org.apache.cassandra.db.index.composites.CompositesSearcher@39b7c0f6>">}}
> Steps to reproduce:
> {code}
> cqlsh:cs> CREATE TABLE test (
>       ...   id1 text,
>       ...   id2 text,
>       ...   column1 text,
>       ...   column2 text,
>       ...   collection set<text>,
>       ...   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;
> <ErrorMessage code=0000 [Server error] 
> message="java.lang.IllegalArgumentException: expected one element but was: 
> <org.apache.cassandra.db.index.composites.CompositesSearcher@68e37722, 
> org.apache.cassandra.db.index.composites.CompositesSearcher@2da28efa>">
> {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;
> <ErrorMessage code=0000 [Server error] 
> message="java.lang.IllegalArgumentException: expected one element but was: 
> <org.apache.cassandra.db.index.composites.CompositesSearcher@3ca899f1, 
> org.apache.cassandra.db.index.composites.CompositesSearcher@6112bc53>">
> {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)

Reply via email to