[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-8147: -- Component/s: (was: Local Write-Read Paths) > Secondary indexing of map keys does not work properly when mixing contains > and contains_key > --- > > Key: CASSANDRA-8147 > URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 > Project: Cassandra > Issue Type: Bug > Components: CQL >Reporter: Benjamin Lerer >Assignee: Benjamin Lerer >Priority: Minor > Fix For: 2.1.2 > > Attachments: CASSANDRA-8147-V2-PART2.txt, CASSANDRA-8147-V2.txt, > CASSANDRA-8147.txt > > > 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: > {code} > @Test > public void testMapKeyContainsAndValueContains() throws Throwable > { > createTable("CREATE TABLE %s (account text, id int, categories > map, 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"))); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-8147: -- Component/s: Local Write-Read Paths CQL > Secondary indexing of map keys does not work properly when mixing contains > and contains_key > --- > > Key: CASSANDRA-8147 > URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 > Project: Cassandra > Issue Type: Bug > Components: CQL, Local Write-Read Paths >Reporter: Benjamin Lerer >Assignee: Benjamin Lerer >Priority: Minor > Fix For: 2.1.2 > > Attachments: CASSANDRA-8147-V2-PART2.txt, CASSANDRA-8147-V2.txt, > CASSANDRA-8147.txt > > > 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: > {code} > @Test > public void testMapKeyContainsAndValueContains() throws Throwable > { > createTable("CREATE TABLE %s (account text, id int, categories > map, 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"))); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-8147: -- Attachment: CASSANDRA-8147-V2-PART2.txt Additional patch that replaces Relation.Type and Index.Operator by Operator and fix the last remaining issue. Secondary indexing of map keys does not work properly when mixing contains and contains_key --- Key: CASSANDRA-8147 URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 Project: Cassandra Issue Type: Bug Reporter: Benjamin Lerer Assignee: Benjamin Lerer Priority: Minor Fix For: 2.1.2 Attachments: CASSANDRA-8147-V2-PART2.txt, CASSANDRA-8147-V2.txt, CASSANDRA-8147.txt 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: {code} @Test public void testMapKeyContainsAndValueContains() throws Throwable { createTable(CREATE TABLE %s (account text, id int, categories maptext,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))); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tyler Hobbs updated CASSANDRA-8147: --- Fix Version/s: 2.1.2 Secondary indexing of map keys does not work properly when mixing contains and contains_key --- Key: CASSANDRA-8147 URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 Project: Cassandra Issue Type: Bug Reporter: Benjamin Lerer Assignee: Benjamin Lerer Priority: Minor Fix For: 2.1.2 Attachments: CASSANDRA-8147-V2.txt, CASSANDRA-8147.txt 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: {code} @Test public void testMapKeyContainsAndValueContains() throws Throwable { createTable(CREATE TABLE %s (account text, id int, categories maptext,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))); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-8147: -- Attachment: CASSANDRA-8147-V2.txt Patch resulting from the merge of the V1 patch and of the one of CASSANDRA-8155 Secondary indexing of map keys does not work properly when mixing contains and contains_key --- Key: CASSANDRA-8147 URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 Project: Cassandra Issue Type: Bug Reporter: Benjamin Lerer Assignee: Benjamin Lerer Priority: Minor Attachments: CASSANDRA-8147-V2.txt, CASSANDRA-8147.txt 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: {code} @Test public void testMapKeyContainsAndValueContains() throws Throwable { createTable(CREATE TABLE %s (account text, id int, categories maptext,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))); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-8147: -- Attachment: CASSANDRA-8147.txt The problem was cause by the fact that the IndexSearcher was trying to use the key index to search for the contains value. This patch fix this problem and also fix the SelectStatement check for the indexed column (if we do a select contains on a map were only the key is indexed we should reject the query). The patch also replace the index option Strings with constants to avoid typos issues. Secondary indexing of map keys does not work properly when mixing contains and contains_key --- Key: CASSANDRA-8147 URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 Project: Cassandra Issue Type: Bug Reporter: Benjamin Lerer Assignee: Benjamin Lerer Priority: Minor Attachments: CASSANDRA-8147.txt 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: {code} @Test public void testMapKeyContainsAndValueContains() throws Throwable { createTable(CREATE TABLE %s (account text, id int, categories maptext,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))); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sylvain Lebresne updated CASSANDRA-8147: Reviewer: Tyler Hobbs Secondary indexing of map keys does not work properly when mixing contains and contains_key --- Key: CASSANDRA-8147 URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 Project: Cassandra Issue Type: Bug Reporter: Benjamin Lerer Assignee: Benjamin Lerer Priority: Minor Attachments: CASSANDRA-8147.txt 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: {code} @Test public void testMapKeyContainsAndValueContains() throws Throwable { createTable(CREATE TABLE %s (account text, id int, categories maptext,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))); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sylvain Lebresne updated CASSANDRA-8147: Assignee: Benjamin Lerer Secondary indexing of map keys does not work properly when mixing contains and contains_key --- Key: CASSANDRA-8147 URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 Project: Cassandra Issue Type: Bug Reporter: Benjamin Lerer Assignee: Benjamin Lerer Priority: Minor 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: {code} @Test public void testMapKeyContainsAndValueContains() throws Throwable { createTable(CREATE TABLE %s (account text, id int, categories maptext,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))); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin Lerer updated CASSANDRA-8147: -- Since Version: 2.1.0 Secondary indexing of map keys does not work properly when mixing contains and contains_key --- Key: CASSANDRA-8147 URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 Project: Cassandra Issue Type: Bug Reporter: Benjamin Lerer Priority: Minor 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: {code} @Test public void testMapKeyContainsAndValueContains() throws Throwable { createTable(CREATE TABLE %s (account text, id int, categories maptext,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))); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CASSANDRA-8147) Secondary indexing of map keys does not work properly when mixing contains and contains_key
[ https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Russ Hatch updated CASSANDRA-8147: -- Tester: Russ Hatch Secondary indexing of map keys does not work properly when mixing contains and contains_key --- Key: CASSANDRA-8147 URL: https://issues.apache.org/jira/browse/CASSANDRA-8147 Project: Cassandra Issue Type: Bug Reporter: Benjamin Lerer Priority: Minor 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: {code} @Test public void testMapKeyContainsAndValueContains() throws Throwable { createTable(CREATE TABLE %s (account text, id int, categories maptext,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))); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)