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

Secondary index query on partition key columns might not return all the rows.

    XMLWordPrintableJSON

Details

    • Correctness - API / Semantic Implementation
    • Normal

    Description

      A secondary index query on a partition key column will, apparently, not return the empty partitions with static data.

      The following unit test can be used to reproduce the problem.

          public void testIndexOnPartitionKeyWithStaticColumnAndNoRows() throws Throwable
          {
              createTable("CREATE TABLE %s (pk1 int, pk2 int, c int, s int static, v int, PRIMARY KEY((pk1, pk2), c))");
              createIndex("CREATE INDEX ON %s (pk2)");
              execute("INSERT INTO %s (pk1, pk2, c, s, v) VALUES (?, ?, ?, ?, ?)", 1, 1, 1, 9, 1);
              execute("INSERT INTO %s (pk1, pk2, c, s, v) VALUES (?, ?, ?, ?, ?)", 1, 1, 2, 9, 2);
              execute("INSERT INTO %s (pk1, pk2, s) VALUES (?, ?, ?)", 2, 1, 9);
              execute("INSERT INTO %s (pk1, pk2, c, s, v) VALUES (?, ?, ?, ?, ?)", 3, 1, 1, 9, 1);
      
              assertRows(execute("SELECT * FROM %s WHERE pk2 = ?", 1),
                         row(1, 1, 1, 9, 1),
                         row(1, 1, 2, 9, 2),
                         row(2, 1, null, 9, null), <-- is not returned
                         row(3, 1, 1, 9, 1));
          }
      

      Attachments

        Activity

          People

            adelapena Andres de la Peña
            blerer Benjamin Lerer
            Andres de la Peña
            Benjamin Lerer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: