[ 
https://issues.apache.org/jira/browse/CASSANDRA-4511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13825335#comment-13825335
 ] 

Sylvain Lebresne commented on CASSANDRA-4511:
---------------------------------------------

bq. I'm struggling to think of a use case for indexing map keys

One thing that comes into mind is tags, but where you want to attach some data 
to it. Say, when was the tag added, or maybe whom added it. In that case, you 
could imagine wanting to index both the keys (the tag itself, to know what 
object has tag X) and the values (for instance to know 'which object did user Y 
tagged').

And btw, technically there is not a whole lot of difficulty adding this, we 
just need to go a bit over the 2ndary index API to make sure we can add more 
than one index on a given name. But that API probably need some cleanup anyway.

bq. Also, it occurs to me that we don't need to add new syntax

True. But I'll note that 1) we don't, technically speaking, support this syntax 
currently, we only support 'IN ?' and 'IN (...)', so it save adding one token 
to the lexer but doesn't entirely save from updating the grammar and 2) 
internally, I still think we'd want to keep it a separate case from other IN 
because it has different rules anyway. Overall, I don't mind using IN over 
CONTAINS if we think that's a better syntax but I don't think one of the 
arguments should be "because it makes things easier internally" (didn't meant 
to imply this was your argument btw, just making sure we agree on why we would 
make the choice) because I don't think that's true.

In any case, as far as I'm concerned, I don't care a whole lot between CONTAINS 
and IN, expect maybe that it feels easier to extend the syntax to map keys with 
CONTAINS (using CONTAINS KEY).

> Secondary index support for CQL3 collections 
> ---------------------------------------------
>
>                 Key: CASSANDRA-4511
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4511
>             Project: Cassandra
>          Issue Type: Improvement
>    Affects Versions: 1.2.0 beta 1
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>             Fix For: 2.1
>
>         Attachments: 4511.txt
>
>
> We should allow to 2ndary index on collections. A typical use case would be 
> to add a 'tag set<String>' to say a user profile and to query users based on 
> what tag they have.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to