zhengruifeng commented on code in PR #42775:
URL: https://github.com/apache/spark/pull/42775#discussion_r1314346571
##########
python/pyspark/sql/functions.py:
##########
@@ -2385,25 +2416,54 @@ def signum(col: "ColumnOrName") -> Column:
Examples
--------
- >>> df = spark.range(1)
- >>> df.select(signum(lit(-5))).show()
- +----------+
- |SIGNUM(-5)|
- +----------+
- | -1.0|
- +----------+
-
- >>> df.select(signum(lit(6))).show()
- +---------+
- |SIGNUM(6)|
- +---------+
- | 1.0|
- +---------+
+ >>> import pyspark.sql.functions as sf
+ >>> spark.range(1).select(
+ ... sf.signum(sf.lit(-5)),
+ ... sf.signum(sf.lit(6))
+ ... ).show()
+ +----------+---------+
+ |SIGNUM(-5)|SIGNUM(6)|
+ +----------+---------+
+ | -1.0| 1.0|
+ +----------+---------+
"""
return _invoke_function_over_columns("signum", col)
-sign = signum
+@try_remote_functions
+def sign(col: "ColumnOrName") -> Column:
+ """
+ Computes the signum of the given value.
+
+ .. versionadded:: 1.4.0
+
+ .. versionchanged:: 3.4.0
Review Comment:
it should be 3.4 here, since we had `sign = signum`
--
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]