Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-10955

Multi-partitions queries with ORDER BY can result in a NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.2.5, 3.0.3, 3.3
    • Legacy/CQL
    • None
    • Normal

    Description

      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:

          @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));
          }
      

      Attachments

        1. 10955-2.2.txt
          5 kB
          Benjamin Lerer

        Activity

          People

            blerer Benjamin Lerer
            blerer Benjamin Lerer
            Benjamin Lerer
            Sam Tunnicliffe
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: