You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Alex Petrov (JIRA)" <ji...@apache.org> on 2016/10/05 06:58:20 UTC

[jira] [Comment Edited] (CASSANDRA-12149) NullPointerException on SELECT using index with token restrictions fully overriden by other PK restrictions

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

Alex Petrov edited comment on CASSANDRA-12149 at 10/5/16 6:57 AM:
------------------------------------------------------------------

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.

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

{{3.0}} is not applicable as we do not allow slices on non-token PK restrictions there.


was (Author: ifesdjeen):
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)