Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Date is not parsed as expected in Csv Reader Processor

Solved Go to solution
Highlighted

Date is not parsed as expected in Csv Reader Processor

New Contributor

I have a pipeline where input source is GetFile , reading csv files ,updating date format using UpdateRecord and then saving in my sql database. Configuration to update time format is :property=>${field.value:toDate("mm/dd/yyyy hh:mm:ss"):format("YYYY-MM-DD HH:mm:ss")}

 

Problem is I am getting date parsing exception at Update Record and date value read by CSV reader is 4/5/2019 0:00. Getting : Cannot parse attribute value as a date; date format: mm/dd/yyyy hh:mm:ss; attribute value: 4/5/2019 0:00

However when i open csv in excel , i get the date as 4/5/2019 12:00:00 AM , but in Notepad++ it is 4/5/2019 0:00. I am confused now where exactly the problem is with csv reader or updateRecord configuration. 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Date is not parsed as expected in Csv Reader Processor

Master Collaborator

@Savi 

 

I think you only need one date format in your nifi expression language.  

 

Next, it seems you know what format it is upstream (source), and what it needs to be for downstream.   Based on your expression need,  you should play the flow up to the csv reader processor and then List Queue on the FlowFiles and inspect the attributes.  Adjust the expression, and retest until the attribute format meets the required format.    Inspecting the dates upstream won't show you what the date looks like after expression and before the reader.   Often times I find myself testing a flow step by step, each step confirming the attributes needed are correct for the next step.  Never moving forward to the next step until I am sure the attributes are correct after visual inspection.

 


 


If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.  


 


Thanks,



Steven @ DFHZ

View solution in original post

1 REPLY 1

Re: Date is not parsed as expected in Csv Reader Processor

Master Collaborator

@Savi 

 

I think you only need one date format in your nifi expression language.  

 

Next, it seems you know what format it is upstream (source), and what it needs to be for downstream.   Based on your expression need,  you should play the flow up to the csv reader processor and then List Queue on the FlowFiles and inspect the attributes.  Adjust the expression, and retest until the attribute format meets the required format.    Inspecting the dates upstream won't show you what the date looks like after expression and before the reader.   Often times I find myself testing a flow step by step, each step confirming the attributes needed are correct for the next step.  Never moving forward to the next step until I am sure the attributes are correct after visual inspection.

 


 


If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.  


 


Thanks,



Steven @ DFHZ

View solution in original post

Don't have an account?
Coming from Hortonworks? Activate your account here