Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ff9c6d6
Initial commit
uros-db Aug 4, 2025
4e79dd8
Cleanup
uros-db Aug 18, 2025
a6bf88d
Merge branch 'apache:master' into python-try_make_timestamp_ntz
uros-db Aug 27, 2025
c707a1e
Python linter
uros-db Aug 27, 2025
53b30e9
Update tests
uros-db Aug 27, 2025
87c2327
Python lint fixes
uros-db Aug 29, 2025
3a6e03a
Python lint fixes
uros-db Aug 29, 2025
8180018
fix: doc-string
Yicong-Huang Sep 17, 2025
853b9c8
fix: doc-string
Yicong-Huang Sep 17, 2025
46f6b10
fix: doc-string
Yicong-Huang Sep 19, 2025
eadad20
wip: use keyword arguments only
Yicong-Huang Sep 19, 2025
ce643c2
use keyword arguments for date and time
Yicong-Huang Sep 22, 2025
b5936cf
refactor: clean up docstrings for make_timestamp_ntz function
Yicong-Huang Sep 22, 2025
91740e6
refactor: improve code readability in make_timestamp_ntz function by …
Yicong-Huang Sep 22, 2025
da60214
refactor: replace __builtins__ sum calls with built-in sum for improv…
Yicong-Huang Sep 22, 2025
338a23d
refactor: enhance try_make_timestamp_ntz function with improved argum…
Yicong-Huang Sep 23, 2025
d581527
refactor: enhance make_timestamp_ntz and try_make_timestamp_ntz funct…
Yicong-Huang Sep 23, 2025
a868cf2
refactor: update comments in make_timestamp_ntz and try_make_timestam…
Yicong-Huang Sep 23, 2025
83f701f
refactor: add type casting for arguments in make_timestamp_ntz and tr…
Yicong-Huang Sep 23, 2025
0d1f37b
refactor: enforce keyword-only arguments in make_timestamp_ntz functi…
Yicong-Huang Sep 23, 2025
860fc53
refactor: replace keyword-only arguments with *args in make_timestamp…
Yicong-Huang Sep 23, 2025
260df29
refactor: swap error message keys for clarity in error-conditions.json
Yicong-Huang Sep 23, 2025
93c99bd
refactor: simplify make_timestamp_ntz usage by removing mixed argumen…
Yicong-Huang Sep 24, 2025
873cf4a
refactor: streamline make_timestamp_ntz and try_make_timestamp_ntz fu…
Yicong-Huang Sep 24, 2025
66e1685
refactor: update error handling in make_timestamp_ntz to use CANNOT_S…
Yicong-Huang Sep 24, 2025
bb42aeb
refactor: improve argument validation and error handling in make_time…
Yicong-Huang Sep 24, 2025
31f33a9
refactor: enhance try_make_timestamp_ntz function to handle None para…
Yicong-Huang Sep 24, 2025
0696390
test: expand make_timestamp_ntz test cases to cover various argument …
Yicong-Huang Sep 24, 2025
6fb47d8
fix: shorten doc string
Yicong-Huang Sep 24, 2025
a704c54
doc: add more examples in doc-string
Yicong-Huang Sep 24, 2025
d028c14
test: update exception handling in make_timestamp_ntz tests to raise …
Yicong-Huang Sep 24, 2025
107ac4f
test: remove unused imports in make_timestamp_ntz test cases for clea…
Yicong-Huang Sep 24, 2025
5acd80c
doc: format output examples in make_timestamp_ntz documentation for i…
Yicong-Huang Sep 24, 2025
a3be61c
refactor: update try_make_timestamp_ntz function to use casting for p…
Yicong-Huang Sep 25, 2025
b824f78
refactor: enhance try_make_timestamp_ntz function to raise PySparkVal…
Yicong-Huang Sep 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 96 additions & 6 deletions python/pyspark/sql/connect/functions/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4019,6 +4019,7 @@ def try_make_timestamp_ltz(
try_make_timestamp_ltz.__doc__ = pysparkfuncs.try_make_timestamp_ltz.__doc__


@overload
def make_timestamp_ntz(
years: "ColumnOrName",
months: "ColumnOrName",
Expand All @@ -4027,14 +4028,59 @@ def make_timestamp_ntz(
mins: "ColumnOrName",
secs: "ColumnOrName",
) -> Column:
return _invoke_function_over_columns(
"make_timestamp_ntz", years, months, days, hours, mins, secs
)
...


@overload
def make_timestamp_ntz(
*,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need *?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is to mark the date and time (anything after *) are keyword only. Otherwise it will be marked as positional as well, then mypy would complain.

date: "ColumnOrName",
time: "ColumnOrName",
) -> Column:
...


def make_timestamp_ntz(
years: Optional["ColumnOrName"] = None,
months: Optional["ColumnOrName"] = None,
days: Optional["ColumnOrName"] = None,
hours: Optional["ColumnOrName"] = None,
mins: Optional["ColumnOrName"] = None,
secs: Optional["ColumnOrName"] = None,
*,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need *?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

date: Optional["ColumnOrName"] = None,
time: Optional["ColumnOrName"] = None,
) -> Column:
if years is not None:
if any(arg is not None for arg in [date, time]):
raise PySparkValueError(
errorClass="CANNOT_SET_TOGETHER",
messageParameters={"arg_list": "years|months|days|hours|mins|secs and date|time"},
)
return _invoke_function_over_columns(
"make_timestamp_ntz",
cast("ColumnOrName", years),
cast("ColumnOrName", months),
cast("ColumnOrName", days),
cast("ColumnOrName", hours),
cast("ColumnOrName", mins),
cast("ColumnOrName", secs),
)
else:
if any(arg is not None for arg in [years, months, days, hours, mins, secs]):
raise PySparkValueError(
errorClass="CANNOT_SET_TOGETHER",
messageParameters={"arg_list": "years|months|days|hours|mins|secs and date|time"},
)
return _invoke_function_over_columns(
"make_timestamp_ntz", cast("ColumnOrName", date), cast("ColumnOrName", time)
)


make_timestamp_ntz.__doc__ = pysparkfuncs.make_timestamp_ntz.__doc__


@overload
def try_make_timestamp_ntz(
years: "ColumnOrName",
months: "ColumnOrName",
Expand All @@ -4043,9 +4089,53 @@ def try_make_timestamp_ntz(
mins: "ColumnOrName",
secs: "ColumnOrName",
) -> Column:
return _invoke_function_over_columns(
"try_make_timestamp_ntz", years, months, days, hours, mins, secs
)
...


@overload
def try_make_timestamp_ntz(
*,
date: "ColumnOrName",
time: "ColumnOrName",
) -> Column:
...


def try_make_timestamp_ntz(
years: Optional["ColumnOrName"] = None,
months: Optional["ColumnOrName"] = None,
days: Optional["ColumnOrName"] = None,
hours: Optional["ColumnOrName"] = None,
mins: Optional["ColumnOrName"] = None,
secs: Optional["ColumnOrName"] = None,
*,
date: Optional["ColumnOrName"] = None,
time: Optional["ColumnOrName"] = None,
) -> Column:
if years is not None:
if any(arg is not None for arg in [date, time]):
raise PySparkValueError(
errorClass="CANNOT_SET_TOGETHER",
messageParameters={"arg_list": "years|months|days|hours|mins|secs and date|time"},
)
return _invoke_function_over_columns(
"try_make_timestamp_ntz",
cast("ColumnOrName", years),
cast("ColumnOrName", months),
cast("ColumnOrName", days),
cast("ColumnOrName", hours),
cast("ColumnOrName", mins),
cast("ColumnOrName", secs),
)
else:
if any(arg is not None for arg in [years, months, days, hours, mins, secs]):
raise PySparkValueError(
errorClass="CANNOT_SET_TOGETHER",
messageParameters={"arg_list": "years|months|days|hours|mins|secs and date|time"},
)
return _invoke_function_over_columns(
"try_make_timestamp_ntz", cast("ColumnOrName", date), cast("ColumnOrName", time)
)


try_make_timestamp_ntz.__doc__ = pysparkfuncs.try_make_timestamp_ntz.__doc__
Expand Down
Loading