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

Custom Types: failure to decode value when Custom Type is used as map key

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Urgent
    • Resolution: Duplicate
    • None
    • None
    • None
    • Critical

    Description

      Using 2.1 Beta through cqlsh:

       CREATE TYPE subject_id (
        ns        text,
        id        text
      );
      
      create table test (  id  int PRIMARY KEY, some_column map<subject_id, int>);
      

      Both methods of inserting records appear to work and return with no error:

      update test set some_column[{ns:'xyz.com', id:'userid'}] = 33 where id = 22222;
      
      insert into test (id, some_column) values (444, {{ns:'abc.com', id:'user2'}: 33});
      

      retrieving the records fails

      select * from test;
      

      returns:

      id    | some_column
      -------+------------------------------------------------------------------------------
         444 |  '\x00\x01\x00\x12\x00\x07abc.com\x00\x00\x05user2\x00\x00\x04\x00\x00\x00!'
       22222 | '\x00\x01\x00\x13\x00\x07xyz.com\x00\x00\x06userid\x00\x00\x04\x00\x00\x00!'
      
      (2 rows)
      
      Failed to decode value '\x00\x01\x00\x12\x00\x07abc.com\x00\x00\x05user2\x00\x00\x04\x00\x00\x00!' (for column 'some_column') as map<subject_id, int>: unhashable type: 'list'
      Failed to decode value '\x00\x01\x00\x13\x00\x07xyz.com\x00\x00\x06userid\x00\x00\x04\x00\x00\x00!' (for column 'some_column') as map<subject_id, int>: unhashable type: 'list'

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ryandb Ryan Berryman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: