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/12/11 14:28:13 UTC

[jira] [Commented] (CASSANDRA-8456) Some valid index queries can be considered as invalid

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

Sylvain Lebresne commented on CASSANDRA-8456:
---------------------------------------------

I don't think that's correct, for the reason explained in CASSANDRA-8418: those query do require filtering since the partition key is not provided.

> Some valid index queries can be considered as invalid
> -----------------------------------------------------
>
>                 Key: CASSANDRA-8456
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8456
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Benjamin Lerer
>            Assignee: Benjamin Lerer
>
> Some secondary index queries are rejected or need ALLOW FILTERING but should not. It seems that in certain case {{SelectStatement}} use index filtering for clustering column restrictions while it should be using clustering column slices.
> The following unit tests can be used to reproduce the problem in 3.0
> {code}
>     @Test
>     public void testMultipleClusteringWithIndex() throws Throwable
>     {
>         createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, PRIMARY KEY (a, b, c, d))");
>         createIndex("CREATE INDEX ON %s (b)");
>         createIndex("CREATE INDEX ON %s (e)");
>         execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 0, 0, 0, 0);
>         execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 0, 1, 0, 1);
>         execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 0, 1, 1, 2);
>         execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 1, 0, 0, 0);
>         execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 1, 1, 0, 1);
>         execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 1, 1, 1, 2);
>         execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 2, 0, 0, 0);
>         assertRows(execute("SELECT * FROM %s WHERE (b, c) = (?, ?)", 1, 1),
>                    row(0, 1, 1, 0, 1),
>                    row(0, 1, 1, 1, 2));
>     }
>     @Test
>     public void testMultiplePartitionKeyAndMultiClusteringWithIndex() throws Throwable
>     {
>         createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, f int, PRIMARY KEY ((a, b), c, d, e))");
>         createIndex("CREATE INDEX ON %s (c)");
>         createIndex("CREATE INDEX ON %s (f)");
>         execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 0, 0, 0, 0, 0, 0);
>         execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 0, 0, 0, 1, 0, 1);
>         execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 0, 0, 0, 1, 1, 2);
>         execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 0, 0, 1, 0, 0, 3);
>         execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 0, 0, 1, 1, 0, 4);
>         execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 0, 0, 1, 1, 1, 5);
>         execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 0, 0, 2, 0, 0, 6);
>         assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c) IN ((?), (?)) AND f = ?", 0, 1, 2, 5),
>                    row(0, 0, 1, 1, 1, 5));
>         assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c, d) IN ((?, ?)) AND f = ?", 0, 1, 1, 5),
>                    row(0, 0, 1, 1, 1, 5));
>         assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c) >= (?) AND f = ?", 0, 1, 5),
>                    row(0, 0, 1, 1, 1, 5));
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)