fix: add timezone and special formats support for cast string to timestamp#3730
Open
parthchandra wants to merge 4 commits intoapache:mainfrom
Open
fix: add timezone and special formats support for cast string to timestamp#3730parthchandra wants to merge 4 commits intoapache:mainfrom
parthchandra wants to merge 4 commits intoapache:mainfrom
Conversation
Contributor
Author
Contributor
Author
|
There is one more follow up PR after this to enable it for all cases and mark this cast as compatible |
andygrove
reviewed
Mar 20, 2026
| // Year only: 4-7 digits, optionally negative | ||
| ( | ||
| Regex::new(r"^\d{4,5}$").unwrap(), | ||
| Regex::new(r"^-?\d{4,7}$").unwrap(), |
Member
There was a problem hiding this comment.
Do these regex expressions get compiled for every invocation of timestamp_parser_with_tz?
andygrove
reviewed
Mar 20, 2026
| } else { | ||
| (1i32, value) | ||
| }; | ||
| let values: Vec<_> = date_part.split(['T', ' ', '-', ':', '.']).collect(); |
Member
There was a problem hiding this comment.
This is pre-existing code, but worth noting that this is allocating multiple strings and a vec for each date. This seems expensive.
andygrove
reviewed
Mar 20, 2026
Comment on lines
+1123
to
+1124
| /// If `value` ends with a UTC offset suffix (`Z`, `+HH:MM`, or `-HH:MM`), returns the | ||
| /// stripped string and the offset in seconds. Returns `None` if no offset suffix is present. |
Member
There was a problem hiding this comment.
What is the behavior for offsets other than the ones that are supported so far?
andygrove
reviewed
Mar 20, 2026
| // Check if datetime is not None | ||
| let tz_datetime = match datetime.single() { | ||
| // Spark uses the offset before daylight savings change so we need to use earliest() | ||
| // Return None for LocalResult::None which is the invalid time in a DST spring forward gap). |
Member
There was a problem hiding this comment.
Do existing tests cover any DST spring forward gaps?
Member
|
Thanks @parthchandra. Could you run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.