vojtechtoman opened a new pull request, #9833: URL: https://github.com/apache/arrow-datafusion/pull/9833
Eliminate duplicate parsing of the input and format strings in some cases ## Which issue does this PR relate to? Relates to #9090. ## What changes are included in this PR? The implementation of `to_timestamp(timestamp, format)` contains fallback logic to resort to `NaiveDateTime` if parsing into a `DateTime` fails. In such cases, the `timestamp` and `format` strings would be parsed twice. This PR uses `chrono::format::parse` directly (in the same way `DateTime::parse_from_str` and `NaiveDateTime::parse_from_str` do) to perform the parsing only once. This results in about 25% speed improvement in the `to_timestamp_with_formats` benchmark. ## Are these changes tested? Yes, existing tests. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
