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

Secondary indexing of map keys does not work properly when mixing contains and contains_key

    XMLWordPrintableJSON

Details

    • Low

    Description

      If you have a table with a map column and an index on the map key selecting data using a contains key and a contains will not return the expected data.

      The problem can be reproduced using the following unit test:

          @Test
          public void testMapKeyContainsAndValueContains() throws Throwable
          {
              createTable("CREATE TABLE %s (account text, id int, categories map<text,text>, PRIMARY KEY (account, id))");
              createIndex("CREATE INDEX ON %s(keys(categories))");
      
              execute("INSERT INTO %s (account, id , categories) VALUES (?, ?, ?)", "test", 5, map("lmn", "foo"));
      
              assertRows(execute("SELECT * FROM %s WHERE account = ? AND id = ? AND categories CONTAINS KEY ? AND categories CONTAINS ? ALLOW FILTERING", "test", 5, "lmn", "foo"), row("test", 5, map("lmn", "foo")));  
          }
      

      Attachments

        1. CASSANDRA-8147-V2-PART2.txt
          106 kB
          Benjamin Lerer
        2. CASSANDRA-8147-V2.txt
          24 kB
          Benjamin Lerer
        3. CASSANDRA-8147.txt
          21 kB
          Benjamin Lerer

        Issue Links

          Activity

            People

              blerer Benjamin Lerer
              blerer Benjamin Lerer
              Benjamin Lerer
              Tom Hobbs
              Russ Hatch Russ Hatch
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: