Skip to content

fix: Make cast string to timestamp compatible with Spark#3884

Open
parthchandra wants to merge 2 commits intoapache:mainfrom
parthchandra:cast-string-timestamp
Open

fix: Make cast string to timestamp compatible with Spark#3884
parthchandra wants to merge 2 commits intoapache:mainfrom
parthchandra:cast-string-timestamp

Conversation

@parthchandra
Copy link
Copy Markdown
Contributor

@parthchandra parthchandra commented Apr 2, 2026

Add addtional formats and handle edge cases.
Update compatibility guide

Which issue does this PR close?

Addressed #3775

Rationale for this change

Makes string to timestamp cast compatible with Spark by adding support for all remaining formats.

What changes are included in this PR?

Adds additional regexes, and parsing for timestamp formats that are supported by Spark. Marks the cast as compatible so unit tests do not fallback to Spark any more.

Important change: A big change in this implementation is that a new parameter has been introduced in Cast to indicate if the calling Spark version is 4.0-plus. This is because there are differences between how Spark parses timestamp strings between versions earlier than Spark 4, and versions after Spark 4. This flag is used in only some specific cases but is required to allow full compatibility

How are these changes tested?

Unit tests. Spark tests

Add addtional formats and handle edge cases.
Update compatibility guide
Spark version specific behaviour for cast string to timestamp
@parthchandra parthchandra force-pushed the cast-string-timestamp branch from 41de47d to 65d92c8 Compare April 3, 2026 17:36
@parthchandra parthchandra marked this pull request as ready for review April 3, 2026 20:04
@parthchandra parthchandra requested a review from andygrove April 3, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant