[
https://issues.apache.org/jira/browse/CASSANDRA-8147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14181135#comment-14181135
]
Benjamin Lerer commented on CASSANDRA-8147:
-------------------------------------------
I like the {{supportsOperator}} approach of CASSANDRA-8155 but I think that we
should do the validation during the preparation phase of the select statement
and not at execution time. It seems more user friendly to me.
So personally I would kind of merge the two patches as follow:
* Use the constants instead of String options and tests from this patch
* Use the {{supportsOperator}} approach of CASSANDRA-8155 instead of
{{isValidIndexFor}} in the {{SecondaryIndex}} as I found it much nicer
* Keep some validation in the SelectStatement during the preparation phase (if
you do not like the approach of this patch we can use an other one).
> 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
> 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")));
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)