[ 
https://issues.apache.org/jira/browse/NIFI-12426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17790765#comment-17790765
 ] 

David Handermann commented on NIFI-12426:
-----------------------------------------

Thanks for highlighting this issue [~mattyb149].

It is worth noting that the SimpleDateFormat does not round microseconds to 
milliseconds when parsing a timestamp string containing microsecond precision, 
and the actual timestamp is off by several seconds. For this reason, it may be 
better to avoid changing the RegexDateTimeMatcher until the SimpleDateFormat 
references have been changes to use the DateTimeFormatter, which supports 
nanosecond precision. Otherwise, passing the check could result in unexpected 
timestamp conversion.

> Support microseconds in RegexDateTimeMatcher
> --------------------------------------------
>
>                 Key: NIFI-12426
>                 URL: https://issues.apache.org/jira/browse/NIFI-12426
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Matt Burgess
>            Assignee: Matt Burgess
>            Priority: Major
>             Fix For: 1.25.0, 2.0.0
>
>
> If a timestamp in the input has microseconds and a RecordReader is using 
> Infer Schema, the data type will be inferred as a string rather than a 
> timestamp regardless of the Timestamp Format property in the reader. Although 
> SimpleDateFormat doesn't support microseconds, it is forgiving in the parsing 
> of a timestamp string and accepts ".SSSSSS" as a milliseconds format even 
> though the microseconds will not be honored.
> However when inferring the schema, the input must also pass the 
> RegexDateTimeMatcher which checks that it "looks like" a timestamp and within 
> the legitimate length boundaries. This matcher enforces a 3-digit length of 
> milliseconds and will fail to match input with microseconds. This matcher 
> should accept 6 digits of fractional seconds and allow the other matchers to 
> proceed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to