You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2014/08/11 12:32:12 UTC

[jira] [Commented] (CASSANDRA-7506) querying secondary index using complete collection should warn/error

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

Sylvain Lebresne commented on CASSANDRA-7506:
---------------------------------------------

The fix looks good, but I think we should move the test up to apply to all relations. For instance:
{noformat}
CREATE TABLE foo (a int PRIMARY KEY, b set<int>, c int);
CREATE INDEX ON foo(c)");

INSERT INTO foo(a, b, c) VALUES (0, 2, {1});
SELECT * FROM foo WHERE c = 2 AND b > {0} ALLOW FILTERING;
{noformat}
is currently not properly rejected, and end up with
{noformat}
org.apache.cassandra.exceptions.InvalidRequestException: Not enough bytes to read a list
    at org.apache.cassandra.cql3.Sets$Value.fromSerialized(Sets.java:158)
    at org.apache.cassandra.cql3.Sets$Marker.bind(Sets.java:237)
    at org.apache.cassandra.cql3.Sets$Marker.bind(Sets.java:226)
    at org.apache.cassandra.cql3.Sets$Adder.doAdd(Sets.java:271)
    at org.apache.cassandra.cql3.Sets$Setter.execute(Sets.java:253)
    at org.apache.cassandra.cql3.statements.UpdateStatement.addUpdateForKey(UpdateStatement.java:97)
    at org.apache.cassandra.cql3.statements.ModificationStatement.getMutations(ModificationStatement.java:672)
    at org.apache.cassandra.cql3.statements.ModificationStatement.executeInternal(ModificationStatement.java:639)
{noformat}

Haven't checked 2.0 but I wonder if it's affected too (we can't create index on collections in 2.0 but that's really not necessary for this bug).

> querying secondary index using complete collection should warn/error
> --------------------------------------------------------------------
>
>                 Key: CASSANDRA-7506
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7506
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: cassandra 2.1.0-rc2, java 1.7.0_60
>            Reporter: Russ Hatch
>            Assignee: Tyler Hobbs
>             Fix For: 2.1.1
>
>         Attachments: 7506-v2.txt, 7506.txt
>
>
> Cassandra does not seem to support querying a set literal like so:
> {noformat}
> select * from testtable where pkey='foo' and mycollection = {'one', 'two'};
> {noformat}
> We currently don't let the user know this query is problematic, rather we just return no rows.
> To reproduce:
> {noformat}
> create keyspace test with replication = {'class': 'SimpleStrategy', 'replication_factor':1} ;
> use test ;
> create table testtable (pkey text PRIMARY KEY, mycollection set<text>);
> create index on testtable (mycollection);
> insert into testtable (pkey, mycollection) VALUES ( 'foo', {'one','two'};
> cqlsh:test> select * from testtable where pkey='foo' and mycollection = {'one', 'two'};
> (0 rows)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)