[
https://issues.apache.org/jira/browse/CASSANDRA-7206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14008346#comment-14008346
]
Robert Stupp commented on CASSANDRA-7206:
-----------------------------------------
Just a note:
cqlsh has some problems when selecting null/nil attributes in UDTs (with latest
C* 2.1 build from githib today - commit
3aef07dbaac8234832f34aa8f087e24ec18723a9)
{code}
cqlsh> CREATE KEYSPACE demo WITH replication =
{'class':'SimpleStrategy','replication_factor':1};
cqlsh> CREATE TYPE demo.phone ( cntry varchar, city varchar, num varchar );
cqlsh:demo> CREATE TYPE demo.address ( street varchar, city varchar, country
varchar, ph_num phone );
cqlsh:demo> CREATE TABLE demo.user ( name varchar, main_address address ,
addresses map<varchar,address>, primary key (name));
cqlsh:demo> INSERT INTO demo.user (name, main_address) values ('snazy',
{street:null, city:'Cologne', ph_num:null});
cqlsh:demo> select * from demo.user;
Traceback (most recent call last):
File "build/dist/bin/cqlsh", line 865, in perform_simple_statement
rows = self.session.execute(statement, trace=self.tracing_enabled)
File
"/Users/snazy/devel/cassandra/cassandra/build/dist/bin/../lib/cassandra-driver-internal-only-1.1.2.zip/cassandra-driver-1.1.2/cassandra/cluster.py",
line 1026, in execute
result = future.result(timeout)
File
"/Users/snazy/devel/cassandra/cassandra/build/dist/bin/../lib/cassandra-driver-internal-only-1.1.2.zip/cassandra-driver-1.1.2/cassandra/cluster.py",
line 2300, in result
raise self._final_exception
error: unpack requires a string argument of length 4
{code}
> UDT - allow null / non-existant attributes
> ------------------------------------------
>
> Key: CASSANDRA-7206
> URL: https://issues.apache.org/jira/browse/CASSANDRA-7206
> Project: Cassandra
> Issue Type: Improvement
> Components: Core
> Reporter: Robert Stupp
> Assignee: Sylvain Lebresne
> Fix For: 2.1 rc1
>
> Attachments: 7206.txt
>
>
> C* 2.1 CQL User-Defined-Types are really fine and useful.
> But it lacks the possibility to omit attributes or set them to null.
> Would be great to have the possibility to create UDT "instances" with some
> attributes missing.
> Also changing the UDT definition (for example: {{alter type add new_attr}})
> will break running applications that rely on the "previous" definition of the
> UDT.
> For exmple:
> {code}
> CREATE TYPE foo (
> attr_one text,
> attr_two int );
> CREATE TABLE bar (
> id int,
> comp foo );
> {code}
> {code}
> INSERT INTO bar (id, com) VALUES (1, {attr_one: 'cassandra', attr_two: 2});
> {code}
> works
> {code}
> INSERT INTO bar (id, com) VALUES (1, {attr_one: 'cassandra'});
> {code}
> does not work
> {code}
> ALTER TYPE foo ADD attr_three timestamp;
> {code}
> {code}
> INSERT INTO bar (id, com) VALUES (1, {attr_one: 'cassandra', attr_two: 2});
> {code}
> will no longer work (missing attribute)
--
This message was sent by Atlassian JIRA
(v6.2#6252)