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

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

bq. How could this extend to user types?

Technically, we'd need versions of the existing CompositesIndex (the one on 
"regular" columns and the 2 new ones introduced by this patch for user types 
within collections) that knows how to reach into the value to find the actual 
value indexed. But that should be fairly straightforward.

Syntax-wise, that's a harder problem :). For user types not in a collection, 
the simplest solution seems to just use the dot notation (so SELECT * FROM bar 
WHERE x.y = 'foo') but I suppose your meant user types in collections, i.e, 
given
{noformat}
CREATE USER TYPE sometype (y text, z text)
CREATE TABLE bar (k int PRIMARY KEY, x set<sometype>)
{noformat}
how do you index the 'y' field of the values in 'x'. In which case I don't 
really have a good syntax to offer so far, not even to declare the index in the 
first place. Maybe we'd have to resort to some sort of variable binding, 
something like
{noformat}
SELECT * FROM bar WHERE $e.y = 'foo' FOR $e IN x
{noformat}
(where I use a '$' to make it clear that '$e' would just be some form of 
query-local variable but we can do without it)

bq. Since maps are basically one of the big replacements for dynamic columns

Oh My...


> 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