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

CQL3: Allow renaming PK columns to ease upgrade from thrift

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 1.2.0 beta 2
    • Legacy/CQL
    • None
    • Low

    Description

      Say you have a clicks CF in thrift storing for each user a timeline of which links it clicked on. It may have a definition like:

      create column family clicks with key_validation_class = UUIDType and comparator = TimeUUIDType and default_validation_class = UTF8Type
      

      In CQL3, you can access that thrift created CF as if it had been defined by:

      CREATE TABLE clicks (
        key uuid,
        column timeuuid,
        value text,
        PRIMARY KEY (key, column)
      ) WITH COMPACT STORAGE
      

      In other words, CQL3 will pick default names for the key_alias, column_aliases and value_alias metadata. It's ok but it would be more user friendly to use if the user could rename those to something better. Today, the only solution would be to remove the schema and re-create the table in CQL3. We can make that simpler by adding support for:

      ALTER TABLE clicks RENAME key to user_id;
      ALTER TABLE clicks RENAME column to insertion_time;
      ALTER TABLE clicks RENAME value to url_clicked; 
      

      Of course such rename statement won't be applicable to all columns. Namely, we can only allow renaming PK columns and in some compact storage cases the value. But that's probably still worth adding.

      Attachments

        1. 4822.txt
          8 kB
          Sylvain Lebresne
        2. 4822-2.txt
          14 kB
          Sylvain Lebresne

        Activity

          People

            slebresne Sylvain Lebresne
            slebresne Sylvain Lebresne
            Sylvain Lebresne
            Jonathan Ellis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: