Benjamin Lerer created CASSANDRA-10955:
------------------------------------------

             Summary: Multi-partitions queries with ORDER BY can result in a NPE
                 Key: CASSANDRA-10955
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10955
             Project: Cassandra
          Issue Type: Bug
          Components: CQL
            Reporter: Benjamin Lerer
            Assignee: Benjamin Lerer


In the case of a table with static columns, if only the static columns have 
been set for some partitions, a multi-partitions query with an {{ORDER BY}} can 
cause a {{NPE}}.

The following unit test can be used to reproduce the problem:
{code}
    @Test
    public void testOrderByForInClauseWithNullValue() throws Throwable
    {
        createTable("CREATE TABLE %s (a int, b int, c int, s int static, d int, 
PRIMARY KEY (a, b, c))");

        execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 1, 1)");
        execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 2, 1)");
        execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 1, 1)");
        execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 2, 1)");

        execute("UPDATE %s SET s = 1 WHERE a = 1");
        execute("UPDATE %s SET s = 2 WHERE a = 2");
        execute("UPDATE %s SET s = 3 WHERE a = 3");

        assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) 
ORDER BY b DESC"),
                   row(2, 2, 2, 1, 2),
                   row(2, 2, 1, 1, 2),
                   row(1, 1, 2, 1, 1),
                   row(1, 1, 1, 1, 1),
                   row(3, null, null, null, 3));
    }
{code} 



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

Reply via email to