David Handermann created NIFI-13978:
---------------------------------------
Summary: Improve Performance of Record Date Time Parsing
Key: NIFI-13978
URL: https://issues.apache.org/jira/browse/NIFI-13978
Project: Apache NiFi
Issue Type: Improvement
Components: Core Framework
Reporter: David Handermann
Assignee: David Handermann
Recent changes to handle time zones when parsing strings to LocalDateTime
objects for Record processing resulted in sub-optimal performance.
Specifically, parsing strings with timestamp patterns that did not include a
time zone require two object resolution attempts due to the use of
{{DateTimeFormatter.parseBest()}} with {{ZonedDateTime::from}} and then
{{LocalDateTime::from}}.
Instead of relying on multiple passes try-catch handling in {{parseBest()}},
using the standard {{parse()}} method with a custom {{TemporalQuery}} avoids
multiple passes. The {{parse()}} method handles parsing a string to a map of
fields, and then calls the provided {{TemporalQuery}} to resolve the requested
object type. The {{TemporalAccessor}} can be queried for a {{ZoneId}} to
determine whether to resolve the object as a {{LocalDateTime}} or a
{{ZonedDateTime}} for subsequent conversion to a {{LocalDateTime}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)