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

Cqlsh COPY fails importing Map<String,List<String>>, ParseError unhashable type list

    XMLWordPrintableJSON

Details

    • Normal

    Description

      When importing data with the COPY command into a column family that has a map<text, frozen<list<text>>> field, I get a unhashable type: 'list' error. Here is how to reproduce:

      CREATE TABLE table1 (
          col1 int PRIMARY KEY,
          col2map map<text, frozen<list<text>>>
      );
      
      insert into table1 (col1, col2map) values (1, {'key': ['value1']});
      
      cqlsh:ks> copy table1 to 'table1.csv';
      
      
      table1.csv file content:
      1,{'key': ['value1']}
      
      
      cqlsh:ks> copy table1 from 'table1.csv';
      ...
      Failed to import 1 rows: ParseError - Failed to parse {'key': ['value1']} : unhashable type: 'list',  given up without retries
      Failed to process 1 rows; failed rows written to kv_table1.err
      Processed: 1 rows; Rate:       2 rows/s; Avg. rate:       2 rows/s
      1 rows imported from 1 files in 0.420 seconds (0 skipped).
      

      But it works fine for Map<String, Set<String>>.

      CREATE TABLE table2 (
          col1 int PRIMARY KEY,
          col2map map<text, frozen<set<text>>>
      );
      
      insert into table2 (col1, col2map) values (1, {'key': {'value1'}});
      
      cqlsh:ks> copy table2 to 'table2.csv';
      
      
      table2.csv file content:
      1,{'key': {'value1'}}
      
      
      cqlsh:ks> copy table2 from 'table2.csv';
      Processed: 1 rows; Rate:       2 rows/s; Avg. rate:       2 rows/s
      1 rows imported from 1 files in 0.417 seconds (0 skipped).
      

      The exception seems to arrive in convert_map function in ImportConversion class inside copyutil.py.

      Attachments

        Activity

          People

            stefania Stefania Alborghetti
            nicolaen Nicolae Namolovan
            Stefania Alborghetti
            Alex Petrov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: