Nifi - Unable to dump the changed date format column to Cassandra (putcassandrarecord) - InvalidQueryException : Expected 4 byte long for date(10)

Author: sanciya

Originally Sourced from: https://stackoverflow.com/questions/59335431/nifi-unable-to-dump-the-changed-date-format-column-to-cassandra-putcassandrar

I have an usecase to dump the data from csv to cassandra. My source CSV data has one date column which is in the format d-MMM-yy.

eg (Sample input date):

date,destination_name,destination,maximum,minimum    
1-Dec-15,Albuquerque,120,48,24 

I tried changing the date format to yyyy-MM-dd using CSVReader (Record Reader) and CSVWriter (Record Writer) inside updateattribute processor (along with other column data manipulation activity)

CSV Reader properties: - CsvReader

Avro Schema defined inside CSVReader: - avroschema

CSV Writer properties: - csvwriter

Avro Schema defined inside CSVWriter: - avroschema

Output of CSVWriter:

date,destination_name,destination,maximum,minimum
2015-12-01,ALBUQUERQUE,120,48,24

At the final step I have PutCassandraRecord processor, where I defined CSVReader (as Record Reader) with schemaText property as avroschema

But while executing flow, this putcassandrarecord routes to Failure state due to below error - error

Cassandra table structure:

CREATE TABLE date_dump.forecast ( destination_name text,date date,destination int,maximum int,minimum int, PRIMARY KEY (destination_name, date) )

Could anyone help here to fix this issue, to dump the date column into cassandra table.