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

Copy from csv file with duration type fields fails to import

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • 4.0.x
    • Tool/cqlsh
    • None
    • Code
    • Normal
    • Low Hanging Fruit
    • User Report
    • All
    • None

    Description

      Getting error:

      cqlsh> COPY users.user_credentials_by_email FROM '/home/ubuntu/users.csv' WITH HEADER = FALSE AND NULL='null';
      Using 3 child processes
      
      Starting copy of users.user_credentials_by_email with columns [email, la_duration].
      Failed to make batch statement: Received an argument of invalid type for column "la_duration". Expected: <class 'cassandra.cqltypes.DurationType'>, Got: <type 'str'>; (DurationType arguments must be a Duration.)_
      Failed to import 1 rows: TypeError - Received an argument of invalid type for column "la_duration". Expected: <class 'cassandra.cqltypes.DurationType'>, Got: <type 'str'>; (DurationType arguments must be a Duration.), given up without retries
      Failed to process 1 rows; failed rows written to import_users_user_credentials_by_email.err
      Processed: 1 rows; Rate: 2 rows/s; Avg. rate: 2 rows/s
      0 rows imported from 1 files in 0.431 seconds (0 skipped).
      

      To Reproduce:

      CREATE KEYSPACE users WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1 } AND durable_writes = true;
      
      CREATE TABLE users.user_credentials_by_email (
      email text,
      la_duration duration,
      PRIMARY KEY(email)
      );
      

      create users.csv file with:

      LA@LA.com,8m26s482ms
      

      Run:

      COPY users.user_credentials_by_email FROM 'users.csv' WITH HEADER = FALSE AND NULL='null';
      

      Attachments

        1. error_cassandra_copy_from_1.JPG
          118 kB
          Brijesh Dungarakoti
        2. error_cassandra_copy_from_2.JPG
          97 kB
          Brijesh Dungarakoti

        Issue Links

          Activity

            People

              Unassigned Unassigned
              brigesh.dungarakoti Brijesh Dungarakoti
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: