zhengruifeng commented on code in PR #51831:
URL: https://github.com/apache/spark/pull/51831#discussion_r2374795224
##########
python/pyspark/sql/connect/functions/builtin.py:
##########
@@ -4027,14 +4028,96 @@ 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(
+ *,
+ 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,
+ *,
+ date: Optional["ColumnOrName"] = None,
+ time: Optional["ColumnOrName"] = None,
+) -> Column:
+ # 6 positional/keyword arguments: years, months, days, hours, mins, secs
Review Comment:
I think we can simplify it a bit:
```
if year is not None:
if any(arg is not None for arg in [date, time]):
raise CANNOT_SET_TOGETHER
return _invoke_function_over_columns("make_timestamp_ntz", years, ...)
else:
if any(arg is not None for arg in [years, months, days, hours, mins,
secs]):
raise CANNOT_SET_TOGETHER
return _invoke_function_over_columns("make_timestamp_ntz", date, time)
```
`_invoke_function_over_columns` will raise `NOT_COLUMN_OR_STR` if a input is
None
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]