Repository navigation
feat(spark): add unix date and timestamp functions - #19892
Merged
Merged
Conversation
Jefffrey
approved these changes
Jan 25, 2026
| /// Returns the number of microseconds since epoch (1970-01-01 00:00:00 UTC) for the given timestamp. | ||
| /// <https://spark.apache.org/docs/latest/api/sql/index.html#unix_micros> | ||
| #[derive(Debug, PartialEq, Eq, Hash)] | ||
| pub struct SparkUnixMicros { |
Contributor
There was a problem hiding this comment.
We can consider making these (micros, millis, seconds) a unified struct with an inner enum field to differentiate the behaviour, like so:
datafusion/datafusion/spark/src/function/bitwise/bit_shift.rs
Lines 189 to 201 in e5e7636
We'd then have different constructors:
datafusion/datafusion/spark/src/function/bitwise/bit_shift.rs
Lines 253 to 263 in e5e7636
Which can be used like so:
datafusion/datafusion/spark/src/function/bitwise/mod.rs
Lines 27 to 41 in e5e7636
Contributor
|
Once CI passes we should be good to merge this |
…ns to clarify type requirements
Contributor
|
Thanks @cht42 |
de-bgunter
pushed a commit
to de-bgunter/datafusion
that referenced
this pull request
Mar 24, 2026
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes apache#123` indicates that this PR will close issue apache#123. --> - Closes apache#19891 - Part of #15914 ## Rationale for this change Add spark unix date and timestamp functions. ## What changes are included in this PR? New spark functions: - https://spark.apache.org/docs/latest/api/sql/index.html#unix_date - https://spark.apache.org/docs/latest/api/sql/index.html#unix_seconds - https://spark.apache.org/docs/latest/api/sql/index.html#unix_millis - https://spark.apache.org/docs/latest/api/sql/index.html#unix_micros ## Are these changes tested? yes in slt ## Are there any user-facing changes? yes
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.
Which issue does this PR close?
unix_date/micros/millis/secondsfunctions #19891datafusion-sparkSpark Compatible Functions datafusion-spark#5Rationale for this change
Add spark unix date and timestamp functions.
What changes are included in this PR?
New spark functions:
Are these changes tested?
yes in slt
Are there any user-facing changes?
yes