cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Lerer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-7396) Allow selecting Map key, List index
Date Tue, 23 May 2017 09:32:05 GMT

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

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

{quote}There's some incorrectness with nested slice/element selections:{quote}

I had a look at the queries and the results are actually the good ones. 

{code}
cqlsh> select m[1..][2] from foo.t1 where id='1';

 m[1..][2]
-----------
      null
{code}

{{m\[1..\]}} is not returning a single value. It is returning a slice of the map which is
also in this case the original map: {{*\{1:\{ 2: 'one-two'\} \}*}}.
{{\[2\]}} requires the map entry with the key {{2}} which does not exist. Due to that a {{null}}
is returned. 

{code}
cqlsh> select m[1][..2] from foo.t1 where id='1';

 m[1][..2]
----------------
 {2: 'one-two'}
{code}
{{m\[1\]}} returns the map-entry with the key 1: {{*\{2: 'one-two'\}*}}. {{\[..2\]}} return
a slice of that map which include the map-entry with the key , so also: {{*\{2: 'one-two'\}*}}
 


{code}
cqlsh> select m[1..][..2] from foo.t1 where id='1';

 m[1..][..2]
---------------------
 {1: {2: 'one-two'}}
{code}
{{m\[1..\]}} is returning a slice of the map which is also in this case the original map:
{{*\{\{1: \{2: 'one-two'\} \}*}} and {{\[..2\]}} returns another slice of the map which is
also the original map.

> 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-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message