feat: add a function to parse a string without timezone to local timestamp #3787
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
None
Closes #.
Rationale for this change
Recently in my system, I update arrow from 23 to 32, and I found return from function
string_to_timestamp_nanos
is changed.Before #2814, function
string_to_timestamp_nanos
return a local timestamp when parsing a string without an explicit time zone.After #2814, I found the function
string_to_timestamp_nanos
return a UTC timestamp when parsing a string without an explicit time zone.In my scene, I need the former.
What changes are included in this PR?
Add a function
string_to_local_timestamp_nanos
which interprets strings without an explicit time zone astimestamps with offsets of the local time on the machine.
For example,
2022-12-30T09:26:56.123
is interpreted as a local timestamp in the timezone of the machine. For example, if the system timezone is set to Asia/Shanghai (UTC+8) the timestamp will be interpreted as though it were2022-12-30T09:26:56.123+08:00
Are there any user-facing changes?