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

LIMIT fetches one less than requested value

    XMLWordPrintableJSON

Details

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

    Description

      Using Cassandra 1.2.11, the following sequence demonstrates the issue:

      CREATE TABLE blah (key text, column text, value text, PRIMARY KEY (key, column)) WITH COMPACT STORAGE;
      INSERT INTO blah (key, column, value) VALUES ('a', 'a', 'a');
      INSERT INTO blah (key, column, value) VALUES ('a', 'b', 'e');
      INSERT INTO blah (key, column, value) VALUES ('a', 'c', 'e');
      INSERT INTO blah (key, column, value) VALUES ('a', 'd', 'e');
      INSERT INTO blah (key, column, value) VALUES ('a', 'e', 'e');
      SELECT column FROM blah WHERE key = 'a' AND column < 'c' ORDER BY column DESC LIMIT 2;
      
       column
      --------
            b
      

      However I would expect columns b and a to both be returned. Only seems to be an issue if the range bound is an exact match, and only if ORDER BY column DESC is used.

      Attachments

        1. 6330.txt
          2 kB
          Sylvain Lebresne

        Activity

          People

            slebresne Sylvain Lebresne
            BrandenVisser Branden Visser
            Sylvain Lebresne
            Aleksey Yeschenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: