zhengruifeng commented on code in PR #48624:
URL: https://github.com/apache/spark/pull/48624#discussion_r1817987415


##########
python/docs/source/reference/pyspark.sql/functions.rst:
##########
@@ -279,6 +279,9 @@ Date and Timestamp Functions
     make_timestamp
     make_timestamp_ltz
     make_timestamp_ntz
+    try_make_timestamp

Review Comment:
   shall we keep the function names sorted alphabetical?



##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -21314,6 +21314,109 @@ def make_timestamp(
         )
 
 
+@_try_remote_functions
+def try_make_timestamp(
+    years: "ColumnOrName",
+    months: "ColumnOrName",
+    days: "ColumnOrName",
+    hours: "ColumnOrName",
+    mins: "ColumnOrName",
+    secs: "ColumnOrName",
+    timezone: Optional["ColumnOrName"] = None,
+) -> Column:
+    """
+    ANSI-compliant version of make_timestamp function.
+    Try to create timestamp from years, months, days, hours, mins, secs and 
timezone fields.
+    The result data type is consistent with the value of configuration 
`spark.sql.timestampType`.
+    The function returns NULL on invalid inputs.
+
+    .. versionadded:: 4.0.0
+
+    Parameters
+    ----------
+    years : :class:`~pyspark.sql.Column` or str

Review Comment:
   ```suggestion
       years : :class:`~pyspark.sql.Column` or column name
   ```
   
   
   I have some users complained that it is unclear whether `str` is a literal 
string or column name, so I am changing the pydocs (in other PRs).
   
   For the new functions in this PR, let's clarify that the `str` is a column 
name.



-- 
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]

Reply via email to