Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-7206

UDT - allow null / non-existant attributes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.1 rc1
    • Legacy/CQL
    • None

    Description

      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:

      CREATE TYPE foo (
         attr_one text,
         attr_two int );
      
      CREATE TABLE bar (
         id int,
         comp foo );
      
      INSERT INTO bar (id, com) VALUES (1, {attr_one: 'cassandra', attr_two: 2});
      

      works

      INSERT INTO bar (id, com) VALUES (1, {attr_one: 'cassandra'});
      

      does not work

      ALTER TYPE foo ADD attr_three timestamp;
      
      INSERT INTO bar (id, com) VALUES (1, {attr_one: 'cassandra', attr_two: 2});
      

      will no longer work (missing attribute)

      Attachments

        1. 7206.txt
          5 kB
          Sylvain Lebresne

        Issue Links

          Activity

            People

              slebresne Sylvain Lebresne
              snazy Robert Stupp
              Sylvain Lebresne
              Aleksey Yeschenko
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: