0
votes

I am trying to load a csv file into cassandra using the dsbulk utility. I am getting timestamp format issue.

Source  : dance,204b0700-7214-3809-9da1-fe5499113b20,1953-08-26 10:00:00+0000,Roman Holiday,,,\u000a
java.lang.IllegalArgumentException: Could not parse '1953-08-26 10:00:00+0000'; accepted formats are: temporal string (e.g. '2018-09-20T07:52:19.921Z') or numeric value (milliseconds since 1970-01-01T00:00:00Z)

Suppressed: java.text.ParseException: Invalid number format: 1953-08-26 10:00:00+0000
Suppressed: java.time.format.DateTimeParseException: Text '1953-08-26 10:00:00+0000' could not be parsed: Invalid value for MonthOfYear (valid values 1 - 12): 0
Caused by: java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0

The input file is of this format:

cat videos_by_tag.csv.mini2
customs house,d4acc6b9-f9b8-708e-5f7e-9df19a24bf5a,2001-07-12 10:00:00+0000,The Score,,,
dance,204b0700-7214-3809-9da1-fe5499113b20,1953-08-26 10:00:00+0000,Roman Holiday,,,
dance,262ebef4-0626-4758-d0cd-4b72ad1526a7,2000-09-21 10:00:00+0000,Dancer in the Dark ,,,
dance,3eea5ebb-6be2-9bdc-68e2-cabf89070855,2015-02-16 08:00:00+0000,Blue,,,
family estate,5b2eb210-b092-3f9c-de29-ea388b5964ae,1993-10-18 10:00:00+0000,The House of the Spirits ,,,

I tried overriding the timestamp format option. Did not help.

codec.timestamp = "yyyy-mm-dd HH:MM:SS+NNNN"

Versions

  • DSE version: 6.0.0
  • DataStax Bulk Loade: v1.0.1
  • Cassandra: 4.0.0.2284

Table structure:

CREATE TABLE killrvideo.videos_by_tag ( tag text, videoid uuid, added_date timestamp, name text, preview_image_location text, tagged_date timestamp, userid uuid, PRIMARY KEY (tag, videoid) ) WITH CLUSTERING ORDER BY (videoid ASC)

Please advise.

1
Could you share dsbulk version, cassandra version and table structure? - Horia
Actually dse version instead of cassandra. - Horia
dse -v : 6.0.0; DataStax Bulk Loader v1.0.1; Cassandra 4.0.0.2284 ; CREATE TABLE killrvideo.videos_by_tag ( tag text, videoid uuid, added_date timestamp, name text, preview_image_location text, tagged_date timestamp, userid uuid, PRIMARY KEY (tag, videoid) ) WITH CLUSTERING ORDER BY (videoid ASC) Thank You. - Prak_Rum
Have you tried using dsbulk 1.2.0? Using 1.2.0 the import was successful. When using 1.0.1 I got the same error. I did some research on documentation and it seems that only a few patterns are supported. So one thing you could do, if using another dsbulk version is not possible, is to change you timestamp format - instead of 1953-08-26 10:00:00+0000 you should have 1953-08-26T10:00:00+00 - Horia
Thanks a lot Horia. Using the new version solved this problem. Can you please post it is a answer. Also, ran into one more issue. If the column is defined as set<text> , copy command is successfully loads "{'bible', 'moses', 'ramses'}" & "{'televison'}" . But, dsbulk fails when there are multiple values with com.datastax.driver.core.exceptions.InvalidTypeException: Could not parse as Json. Have you faced this issue? - Prak_Rum

1 Answers

1
votes

Have you tried using dsbulk 1.2.0? Using 1.2.0 the import was successful.

When using 1.0.1 I got the same error.

I did some research on documentation and it seems that only a few timestamps patterns are supported.

So there would be two possible solutions:

  • use dsbulk 1.2.0 version
  • reformat your csv file and change timestamp format; for instance, instead of 1953-08-26 10:00:00+0000 you should have 1953-08-26T10:00:00+00.