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

Sylvain Lebresne commented on CASSANDRA-7492:
---------------------------------------------

While I don't entirely disagree that using v2 encoding inside UDT for the 
protocol v2 would be somewhat more "logical", the reason we do it this way is 
that UDT values are directly stored inside cell values, and so not forcing a 
particular fixed encode would require us to deserialize/reserialize values 
every time in the case of the protocol v2. It would be possible to do it, but 
it's slightly annoying to do. Also, my experience with the java driver is that 
it's annoying to have to pass the protocol version around everywhere, and not 
having to do it inside UDT is actually a bit nicer (though of course, you 
mileage might vary depending on the actual driver implementation).

Overall, it would be possible to change the encoding now but the current 
behaviour is well defined so I'd be in favour of letting it be, especially this 
close to a final release. Besides, that UDT are supported in the protocol v2 is 
kind of a detail in the first place: if a driver don't want to support them in 
the protocol v2, that's perfectly fine.

> Udt inner collections under protocol 2
> --------------------------------------
>
>                 Key: CASSANDRA-7492
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7492
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: Cassandra 2.1-rc2
>            Reporter: Jorge Bay
>            Priority: Minor
>
> Consider the following schema:
> {code:sql}
> CREATE TYPE phone (alias text, number text, country_code int);
> CREATE TYPE contact (first_name text, last_name text, birth_date timestamp, 
> phones set<phone>, emails set<text>);
> CREATE TABLE users_contacts (id int PRIMARY KEY, contact_value contact);
> {code}
> Under protocol v2, Cassandra serializes the phone *set* within contact udt, 
> it uses protocol v3 collections format (4 byte lengths).
> As an UDT is a composition of other types, it makes sense to maintain the 
> other types formatting (in this case 2 byte length).
> Possibly related to CASSANDRA-7472



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to