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

copy from csv import wrong values with udt having set when fields are not specified in correct order in csv

    XMLWordPrintableJSON

Details

    • Normal

    Description

      create KEYSPACE test WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': 1};

      CREATE TYPE test.my_udt (
      first_field text,
      second_field frozen<set<text>>
      );

      CREATE TABLE test.test ( key text, value my_udt, PRIMARY KEY (key));

      The following works as expected :

      INSERT INTO test.test (key , value ) VALUES ( 'key1', {second_field: {'test1', 'test2'}, first_field: 'first_field'});

      key | value
      -----+---------------------------------------------------------------
      key1 | {first_field: 'first_field', second_field: {'test1', 'test2'}}

      but when inserted using a .csv the result is wrong:

      "key1","{second_field: {'test1', 'test2'}, first_field: 'first_field'}"

      COPY test.test FROM '~/test.csv';

      key | value
      -----+---------------------------------------------------------------------
      key1 | {first_field: '{''test1'', ''test2''}', second_field: {'irst_fiel'}}

      it works as expected if the keys are in order:

      "key1","{first_field: 'first_field', second_field: {'test1', 'test2'}}")

      Attachments

        Activity

          People

            stefania Stefania Alborghetti
            qambard Quentin Ambard
            Stefania Alborghetti
            Paulo Motta
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: