-
Notifications
You must be signed in to change notification settings - Fork 28.8k
[SPARK-53547] [Python] Add make_timestamp_ntz overload with date/time parameters #52329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[SPARK-53547] [Python] Add make_timestamp_ntz overload with date/time parameters #52329
Conversation
Add support for make_timestamp_ntz(date=..., time=...) overload in PySpark. This implements SPARK-51162 to provide an alternative way to create local date-time values using separate date and time columns.
This reverts commit 579c45a.
@@ -25155,10 +25175,14 @@ def make_timestamp_ntz( | |||
mins : :class:`~pyspark.sql.Column` or column name | |||
The minute-of-hour to represent, from 0 to 59 | |||
secs : :class:`~pyspark.sql.Column` or column name | |||
The second-of-minute and its micro-fraction to represent, from 0 to 60. | |||
The second-of-minute and its micro-fraction to represent, from 0 to 60.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is that intentional?
) -> Column: | ||
""" | ||
Create local date-time from years, months, days, hours, mins, secs fields. | ||
Create local date-time from years, months, days, hours, mins, secs fields, or from date and time fields. | ||
If the configuration `spark.sql.ansi.enabled` is false, the function returns NULL | ||
on invalid inputs. Otherwise, it will throw an error instead. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add a .. versionchanged::
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Which version should I use? (4.1?)
PR titles typically follow [SPARK-xxxxx][PYTHON].. |
…ror handling - Add WRONG_NUM_ARGS error class to error-conditions.json - Update make_timestamp_ntz in builtin.py to use PySparkValueError with WRONG_NUM_ARGS - Update make_timestamp_ntz in connect/builtin.py to use PySparkValueError with WRONG_NUM_ARGS - Update test cases to expect PySparkValueError with proper error class and message parameters
- Change error message from 'either all 6 components or both date and time' to '(years, months, days, hours, mins, secs) or (date, time)' - Update consistently across builtin.py, connect/builtin.py, and test_functions.py - Provides clearer guidance to users about expected parameter names
Fixed! |
What changes were proposed in this pull request?
Add support for make_timestamp_ntz(date=..., time=...) overload in PySpark. This implements SPARK-53547 to provide an alternative way to create local date-time values using separate date and time columns.
Why are the changes needed?
We need to align with Scala side API to make it flexible for users to create a timestamp with date and time.
Does this PR introduce any user-facing change?
New PySpark function.
How was this patch tested?
Added unit tests.
Was this patch authored or co-authored using generative AI tooling?
Tests Generated-by: Cursor