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

PER PARTITION LIMIT does not work properly for multi-partition query with ORDER BY

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 3.6
    • None
    • None
    • Normal

    Description

      Multi-partition queries with PER PARTITION LIMIT with ORDER BY do not respect the PER PARTITION LIMIT.

      The problem can be reproduced with the following unit test:

          @Test
          public void testPerPartitionLimitWithMultiPartitionQueryAndOrderBy() throws Throwable
          {
              createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY (a, b))");
      
              for (int i = 0; i < 5; i++)
              {
                  for (int j = 0; j < 5; j++)
                  {
                      execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", i, j, j);
                  }
              }
      
              assertRows(execute("SELECT * FROM %s WHERE a IN (2, 3) ORDER BY b DESC PER PARTITION LIMIT ?", 2),
                                      row(2, 4, 4),
                                      row(3, 4, 4),
                                      row(2, 3, 3),
                                      row(3, 3, 3));
          }
      

      Attachments

        Activity

          People

            ifesdjeen Alex Petrov
            blerer Benjamin Lerer
            Alex Petrov
            Benjamin Lerer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: