exceptionfactory commented on pull request #4677:
URL: https://github.com/apache/nifi/pull/4677#issuecomment-731351810


   Thanks for the background @adenes that is helpful to know.  I agree with you 
that the underlying issue is related to using `java.sql.Date` for representing 
dates without times.
   
   Looking at the unit test you referenced in TestConvertRecord and stepping 
through the code, it looks like the better place to address the problem is in 
`DataTypeUtils.toDate()` where `DateFormat.parse()` creates a `java.util.Date`. 
 As you described, when walking through the unit test, the parse result returns 
a `java.util.Date` with a local time zone, which skews the resulting 
`java.sql.Date`.  Replacing DateFormat with `LocalDate.parse()` and using 
`java.sql.Date.valueOf()` avoids the skewed return value.  Making the change at 
that level would avoid the need to readjust values later on.
   
   Making the change in `DataTypeUtils.toDate()` will probably have other 
consequences, but that seems like it is worth considering to get to the root of 
the problem.
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to