[jira] [Updated] (CASSANDRA-7206) UDT - allow null / non-existant attributes

2014-05-23 Thread Sylvain Lebresne (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-7206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne updated CASSANDRA-7206:


Attachment: 7206.txt

> 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)


[jira] [Updated] (CASSANDRA-7206) UDT - allow null / non-existant attributes

2014-05-23 Thread Sylvain Lebresne (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-7206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne updated CASSANDRA-7206:


Attachment: (was: 7206.txt)

> 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
>
>
> 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)


[jira] [Updated] (CASSANDRA-7206) UDT - allow null / non-existant attributes

2014-05-22 Thread Jonathan Ellis (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-7206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jonathan Ellis updated CASSANDRA-7206:
--

Reviewer: Aleksey Yeschenko

> 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)


[jira] [Updated] (CASSANDRA-7206) UDT - allow null / non-existant attributes

2014-05-22 Thread Sylvain Lebresne (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-7206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne updated CASSANDRA-7206:


Attachment: 7206.txt

Attaching rather simple patch for that. This makes fields optional in the query 
strings (so queries don't break when new fields are added), though it also 
allows to set the field to null explicitly (which is equivalent).

One minor annoyance in the patch is updating the fromString and getString for 
the UserType class. We can't simple use "null" to represent nulls since that 
could theoretically conflict with a field value being the string "null". But 
since this is all only use by SSTableExport/SSTableImport for which we probably 
don't care to have a perfect output, I just went with representing nulls with 
the '@' (totally random choice) and some escaping to avoid conflicts.

I've pushed a simple dtests in the user type tests. I'll jump into the "let's 
do CQL tests in the unit suites" when I have more time.

> 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)


[jira] [Updated] (CASSANDRA-7206) UDT - allow null / non-existant attributes

2014-05-15 Thread Sylvain Lebresne (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-7206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne updated CASSANDRA-7206:


Fix Version/s: 2.1 rc1

> 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
> Fix For: 2.1 rc1
>
>
> 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)