cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Stupp (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-7396) Allow selecting Map key, List index
Date Thu, 18 May 2017 14:28:05 GMT

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

Robert Stupp commented on CASSANDRA-7396:
-----------------------------------------

Overall this patch looks pretty solid! Very nice work! Few comments and one bug though:
* Having unit tests for UDTs (frozen and non frozen) that include frozen and non-frozen collections
would be great.
* the javadoc param {{from}} is duplicated in {{getSliceFromSerialized}}
* Wonder, whether to return the {{baseType}} if {{ReversedType.getInstance()}} is called with
a {{ReversedType}} is more efficient than creating a {{ReversedType(ReversedType(someType))}}.
* {{WRITETIME()}} + {{TTL()}} don’t work with element/slice selections, but UDFs + CAST
do work with element/slice selections.
* IMO you can remove the copied javadocs on overrides/implementations
* A couple of “ugly” methods & constructs have been refactored and became way more
readable.
* There's some incorrectness with nested slice/element selections:

The unit and dtests look fine so far.

{code}
create keyspace foo WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter1':1};
CREATE TABLE foo.t1 (
    id text PRIMARY KEY,
    m map<float, frozen<map<int, text>>>,
    s set<decimal>
);

insert into foo.t1 (id,m) values ('1', {1: {2: 'one-two'}});

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

 m[1][2]
---------
 one-two

(1 rows)
cqlsh> select m[1..][2] from foo.t1 where id='1';

 m[1..][2]
-----------
      null

(1 rows)
cqlsh> select m[1][..2] from foo.t1 where id='1';

 m[1][..2]
----------------
 {2: 'one-two'}

(1 rows)
cqlsh> select m[1..][..2] from foo.t1 where id='1';

 m[1..][..2]
---------------------
 {1: {2: 'one-two'}}

(1 rows)
cqlsh> select m[1..][2] from foo.t1 where id='1';

 m[1..][2]
-----------
      null

(1 rows)
{code}


> 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