uros-b commented on code in PR #57476:
URL: https://github.com/apache/spark/pull/57476#discussion_r3700462939


##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -8243,6 +8243,58 @@ def round(col: "ColumnOrName", scale: 
Optional[Union[Column, int]] = None) -> Co
         return _invoke_function_over_columns("round", col, scale)
 
 
+@_try_remote_functions
+def truncate(col: "ColumnOrName", scale: Optional[Union[Column, int]] = None) 
-> Column:
+    """
+    Truncate the given value toward zero to `scale` decimal places when 
`scale` >= 0,
+    or to the left of the decimal point when `scale` < 0. `scale` defaults to 
0.
+
+    Unlike :func:`round`, the result is always rounded toward zero, and unlike 
:func:`floor`
+    negative values are not rounded toward negative infinity.
+
+    .. versionadded:: 4.3.0
+
+    Parameters
+    ----------
+    col : :class:`~pyspark.sql.Column` or column name
+        The target column or column name to truncate.
+        A column that evaluates to a numeric.
+    scale : :class:`~pyspark.sql.Column` or int, optional
+        An optional parameter to control the number of decimal places to keep.
+        A column that evaluates to an integer. Must be a constant. Defaults to 
0.
+
+    Returns
+    -------
+    :class:`~pyspark.sql.Column`
+        A column for the truncated value.
+        Returns a column of the same type as the input.
+
+    See Also
+    --------
+    :meth:`pyspark.sql.functions.round`

Review Comment:
   The See Also should also probably point at trunc, floor, and ceil



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