[
https://issues.apache.org/jira/browse/CASSANDRA-10849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15154254#comment-15154254
]
Sylvain Lebresne commented on CASSANDRA-10849:
----------------------------------------------
As I hinted in CASSANDRA-11064, that {{CQL3Type.toCQLLiteral}} method converts
between native protocol values and CQL literals. Given that
# both have clear separate representation of {{null}} and _empty collections_
# both {{null}} and _empty_ are valid values for both frozen and non-frozen
collections (it's true that these 2 values are actually equal for non-frozen
collections and not for frozen ones, but they are still valid values in both
case)
then I don't see a point in making a difference based on the frozeness of the
collection, i.e. I suggest we should change the 3rd point of the description to
convert from {{"null"}} to {{null}} as for frozen collections. Though that last
change is already part of the patch for CASSANDRA-11064 so I assuming we commit
that patch we can just close this.
Let me note for the record that converting {{null}} to an empty collection
literal for multi-cell collection is no incorrect per se since {{null}} and
_empty_ represents the same thing in that case. But it is also making things
more complex for no good reason imo. In particular that would mean in
CASSANDRA-11064 that we'd have to account for the fact that converting back and
forth between literals and native protocol values doesn't yield the identity,
which is messy.
> Decide how to handle with null multi-cell collections
> -----------------------------------------------------
>
> Key: CASSANDRA-10849
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10849
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Robert Stupp
> Priority: Minor
>
> CASSANDRA-10650 introduced the ability to generate the CQL literal from a
> serialized representation - currently only used to store a UDA's INITCOND.
> The code to generate the CQL literal for a {{null}} collection deals with
> that in the following way:
> * null frozen collections --> CQL literal {{null}}
> * empty frozen collections --> CQL literal {{[]}} (or {{\{\}}} for maps)
> * null multi-cell collections --> CQL literal {{[]}} (or {{\{\}}} for maps) ;
> there's no way to distinguish null from empty
> * empty multi-cell collections --> CQL literal {{[]}} (or {{\{\}}} for maps)
> ; there's no way to distinguish null from empty
> CASSANDRA-10840 exposed that the handling is not optimal and the patch deals
> with this by using a "frozen" state type to generate the CQL literal.
> It's currently not a critical thing yet - just want to know whether it's ok
> how CASSANDRA-10840 handles this or {{CQL3Type.toCQLLiteral}} should be
> changed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)