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

cqlsh: COPY FROM ignores NULL values in conversion

    Details

    • Severity:
      Normal

      Description

      COPY FROM fails to import empty values.

      For example:

      $ cat test.csv
      a,10,20
      b,30,
      c,50,60
      $ cqlsh
      cqlsh> create keyspace if not exists test with replication = {'class': 'SimpleStrategy', 'replication_factor':1};
      cqlsh> create table if not exists test.test (t text primary key, i1 int, i2 int);
      cqlsh> copy test.test (t,i1,i2) from 'test.csv';
      

      Imports:

      select * from test.test";
       t | i1 | i2
      ---+----+----
       a | 10 | 20
       c | 50 | 60
      (2 rows)
      

      and generates a ParseError - invalid literal for int() with base 10: '', given up without retries for the row with an empty value.

      It should import the empty value as a null and there should be no error:

      cqlsh> select * from test.test";
       t | i1 | i2
      ---+----+------
       a | 10 |   20
       c | 50 |   60
       b | 30 | null
      (3 rows)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Stefania Stefania
                Reporter:
                Stefania Stefania
                Authors:
                Stefania
                Reviewers:
                Paulo Motta
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: