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

Alex Petrov commented on CASSANDRA-12149:
-----------------------------------------

This problem was not related strictly to SASI, so I have adjusted the title 
accordingly. Example code that'd fail:

{code}
    @Test
    public void testTokenAndIndex() throws Throwable
    {
        createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY KEY 
(a, b, c))");
        createIndex("CREATE INDEX ON %s(c)");

        for (int i = 0; i < 10; i++)
        {
            execute("INSERT INTO %s (a,b,c,d) VALUES (?, ?, ?, ?)", i, i, i, i);
            execute("INSERT INTO %s (a,b,c,d) VALUES (?, ?, ?, ?)", i, i + 10, 
i + 10, i + 10);
        }

        beforeAndAfterFlush(() -> {
            assertRows(execute("SELECT * FROM %s WHERE token(a) > token(8) AND 
a = 9 AND c = 9 ALLOW FILTERING"),
                       row(9, 9, 9, 9));

            assertRows(execute("SELECT * FROM %s WHERE token(a) > token(8) AND 
a > 8 ALLOW FILTERING"),
                       row(9, 9, 9, 9),
                       row(9, 19, 19, 19));
        });
    }
{code}

We could use non-token restrictions when token restrictions are fully overriden 
by other results.

|[12419-trunk|https://github.com/ifesdjeen/cassandra/tree/12419-trunk]|[dtest|http://cassci.datastax.com/job/ifesdjeen-12419-trunk-dtest/]|[utest|http://cassci.datastax.com/job/ifesdjeen-12419-trunk-testall/]|
|[12419-3.0|https://github.com/ifesdjeen/cassandra/tree/12419-3.0]|[dtest|http://cassci.datastax.com/job/ifesdjeen-12419-3.0-dtest/]|[utest|http://cassci.datastax.com/job/ifesdjeen-12419-3.0-testall/]|
|[12419-3.X|https://github.com/ifesdjeen/cassandra/tree/12419-3.X]|[dtest|http://cassci.datastax.com/job/ifesdjeen-12419-3.X-dtest/]|[utest|http://cassci.datastax.com/job/ifesdjeen-12419-3.X-testall/]|

> NullPointerException on SELECT using index with token restrictions fully 
> overriden by other PK restrictions 
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-12149
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12149
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Andrey Konstantinov
>            Assignee: Alex Petrov
>         Attachments: CASSANDRA-12149.txt
>
>
> If I execute the sequence of queries (see the attached file), Cassandra 
> aborts a connection reporting NPE on server side. SELECT query without token 
> range filter works, but does not work when token range filter is specified. 
> My intent was to issue multiple SELECT queries targeting the same single 
> partition, filtered by a column indexed by SASI, partitioning results by 
> different token ranges.
> Output from cqlsh on SELECT is the following:
> {code}
> cqlsh> SELECT namespace, entity, timestamp, feature1, feature2 FROM 
> mykeyspace.myrecordtable WHERE namespace = 'ns2' AND entity = 'entity2' AND 
> feature1 > 11 AND feature1 < 31  AND token(namespace, entity) <= 
> 9223372036854775807;
> ServerError: <ErrorMessage code=0000 [Server error] 
> message="java.lang.NullPointerException">
> {code}



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

Reply via email to