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

Benjamin Lerer commented on CASSANDRA-7396:
-------------------------------------------

Forbidding these selectors is, in my opinion, different from what is done for 
clustering keys and inequality predicates. Before to {{3.0}} we were preventing 
any clustering restrictions after an inequality predicate, simply because we 
had not put in place a mechanism to handle those queries. Since {{3.0}}, we 
allow them as long as {{ALLOW FILTERING}} is specified.

CQL allow things like {{SELECT v + 1 - 1 FROM myTable}}, even if it is 
inefficient. One of the problem of CQL is that it has a lot of corner cases, 
that makes the language difficult to use and I have seen a lot of complains 
about it. Which is why I am not in favor rejecting some specific mix of 
selectors.

Moreover, you do not really want to forbid further operations after a slice as 
a query like {{SELECT filterMap(m\[1..\])\[..2\] FROM ...}} can totally make 
sense. And blocking a query like {{SELECT m\[1..\]\[..2\] FROM ...}} but not a 
query like {{SELECT filterMap(m\[1..\])\[..2\] FROM ...}}, even if the 
{{filterMap}} function is not doing any filtering, is also inconsistent.

So, from consistency point of view, I would argue that we should keep the 
current behavior and not forbid further restrictions after a slice.
The operations perfomed by the selectors are straight forward:
* {{\[?\]}}: returns a collection element
* {{\[?..?\]}}: returns a slice of the collection

There is no notion of {{inner}} or {{outer}} collections because the selectors 
can be used on a collection that does not contains another collection.
  
 

> Allow selecting Map key, List index
> -----------------------------------
>
>                 Key: CASSANDRA-7396
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7396
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: CQL
>            Reporter: Jonathan Ellis
>            Assignee: Sylvain Lebresne
>              Labels: cql, docs-impacting
>             Fix For: 4.x
>
>         Attachments: 7396_unit_tests.txt
>
>
> Allow "SELECT map['key]" and "SELECT list[index]."  (Selecting a UDT subfield 
> is already supported.)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to