You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Alex Petrov (JIRA)" <ji...@apache.org> on 2016/05/06 11:30:13 UTC

[jira] [Commented] (CASSANDRA-7396) Allow selecting Map key, List index

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

Alex Petrov commented on CASSANDRA-7396:
----------------------------------------

Wanted to point out that {{serializeForNativeProtocol}} and {{reserializeForNativeProtocol}} might have some bigger implications for [https://issues.apache.org/jira/browse/CASSANDRA-7826], especially {{reserializeForNativeProtocol}}. 

The previous version of {{serializedValues}} in collections was taking a "short" path as it was simply packing things together. Now, it has some more logic which includes comparing. It might be good to leave {{serializedValues}} intact (possibly making it protected?) and filtering out the needed Cells or wrapping it into some sort of filtering iterator if required. 

As for {{reserializeForNativeProtocol}}, I ran into similar problem of logic duplication between {{Maps}}/{{Sets}}/{{Lists}} {{::refromSerialized}} classes, which currently have decoding logic when creating {{Value}} classes and {{get}} method. 

This might mean that we'll have:
  * decoding the value from native protocol and composes {{Cells}} in {{Maps/Value::fromSerialized}}
  * serializing {{Cell}} for native protocol in {{MapType::serializedValues}}
  * serialising a full {{Value}} for native protocol in {{Maps/Value::get}}
  * re-serialising, which is kind of of combination of {{fromSerialised}} and {{Value::get}} with filtering out values in-between.

Having all of that together, I'm not sure what would be the best way to abstract or generalise it all. I just wanted to point out that it might be multiplying complexity together with nested cells, so finding some common grounds would ease integration of both features.

One possible solution for all that might be having some sort of intermediate representation similar to {{Cell}} that would encapsulate logic, and yielding {{Cell}} when applicable or serving as a container when we just need to take a ByteBuffer from one format and yield ByteBuffer of the other. 

> 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: Robert Stupp
>              Labels: cql, docs-impacting
>             Fix For: 3.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.4#6332)