You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Matt Burgess (Jira)" <ji...@apache.org> on 2020/02/26 22:59:00 UTC

[jira] [Created] (NIFI-7208) PutSQL doesn't handle nanoseconds

Matt Burgess created NIFI-7208:
----------------------------------

             Summary: PutSQL doesn't handle nanoseconds
                 Key: NIFI-7208
                 URL: https://issues.apache.org/jira/browse/NIFI-7208
             Project: Apache NiFi
          Issue Type: Bug
          Components: Extensions
            Reporter: Matt Burgess


According to the documentation PutSQL should be able to manage nanoseconds:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.0/org.apache.nifi.processors.standard.PutSQL/

".]sql.args.N.format [...] as specified according to java.time.format.DateTimeFormatter"

DateTimeFormatter should be able to manage nanoseconds.

The issue seems to be happening in JdbcCommon.java

Line 840-843:
final DateTimeFormatter dtFormatter = getDateTimeFormatter(valueFormat);
TemporalAccessor accessor = dtFormatter.parse(parameterValue);
java.util.Date parsedDate = java.util.Date.from(Instant.from(accessor));
lTimestamp = parsedDate.getTime();

It seems to be truncated on line 842
java.util.Date parsedDate = java.util.Date.from(Instant.from(accessor));

as java.util.Date doesn't handle nanoseconds. A Java time construct that can handle nanoseconds should be used instead of Date.





--
This message was sent by Atlassian Jira
(v8.3.4#803005)