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

cqlsh COPY FROM cannot parse timestamp in partition key if table contains a counter value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.2.9, 3.0.10, 3.10
    • Legacy/Tools
    • None
    • Normal

    Description

      This sample table:

      CREATE TABLE test (columnname text, day timestamp, israndom boolean, columnvalue text, counter counter, PRIMARY KEY ((columnname, day, israndom), columnvalue));
      

      with this sample data:

      origins|2016-10-01 00:00:00+0000|False|ACTUAL|6
      origins|2016-10-01 00:00:00+0000|False|ADGMOB|4
      origins|2016-10-01 00:00:00+0000|False|ANONPM|4
      origins|2016-10-01 00:00:00+0000|False|CSRT2L|76
      origins|2016-10-01 00:00:00+0000|False|DIAGOP|18
      origins|2016-10-01 00:00:00+0000|False|E-SOFT|17
      origins|2016-10-01 00:00:00+0000|False|E-TASK|10
      

      when imported with

      COPY ks.test FROM 'test.csv' WITH DELIMITER = '|';
      

      will generate a parse error:

      Failed to import 7 rows: ParseError - can't interpret u"'2016-10-01 00:00:00+0000'" as a date with this format: %Y-%m-%d %H:%M:%S%z,  given up without retries
      

      The problem is that when a counter value is present, we don't use prepared statements and so we typically don't convert values unless they are part of the partition key. We also add quotes for certain types, such as timestamps. The problem is that we do not remove such quotes before parsing the partition key values, therefore ending up with a parse error.

      Attachments

        Activity

          People

            stefania Stefania Alborghetti
            stefania Stefania Alborghetti
            Stefania Alborghetti
            Paulo Motta (Deprecated)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: