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

Filtering on clustering columns in reversed order with BETWEEN return invalid results

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 5.1
    • CQL/Interpreter
    • None

    Description

      As noted by maedhroz, filtering on clustering columns in reverser order do not work properly.

      The problem can be reproduced using the following test:

      @Test
      public void testReverseAndBetweenMemtableFiltering()
      {
          createTable("CREATE TABLE %s(p int, c int, c2 int, abbreviation ascii, PRIMARY KEY (p, c, c2)) WITH CLUSTERING ORDER BY (c DESC, c2 DESC)");
      
          execute("INSERT INTO %s(p, c, c2, abbreviation) VALUES (0, 1, 1, 'CA')");
          execute("INSERT INTO %s(p, c, c2, abbreviation) VALUES (0, 2, 2, 'MA')");
          execute("INSERT INTO %s(p, c, c2, abbreviation) VALUES (0, 3, 3, 'MA')");
          execute("INSERT INTO %s(p, c, c2, abbreviation) VALUES (0, 4, 4, 'TX')");
      
          ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c2 BETWEEN 2 AND 3 ALLOW FILTERING");
          assertRowsNet(betweenRowsNet, row (0, 3, 3, "MA"), row (0, 2, 2, "MA")); // NO RESULTS?
      }
      

      The issue is due to the fact that the comparison performed in BETWEEN.isSatisfied ignore the ReversedType.

      Attachments

        1. ci_summary.html
          33 kB
          Caleb Rackliffe

        Issue Links

          Activity

            People

              blerer Benjamin Lerer
              blerer Benjamin Lerer
              Benjamin Lerer
              Caleb Rackliffe
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: