Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 21 additions & 13 deletions R/pkg/R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ setMethod("abs",
})

#' @details
#' \code{acos}: Computes the cosine inverse of the given value; the returned angle is in
#' the range 0.0 through pi.
#' \code{acos}: Returns the inverse cosine of the given value,
#' as if computed by \code{java.lang.Math.acos()}
#'
#' @rdname column_math_functions
#' @export
Expand Down Expand Up @@ -334,8 +334,8 @@ setMethod("ascii",
})

#' @details
#' \code{asin}: Computes the sine inverse of the given value; the returned angle is in
#' the range -pi/2 through pi/2.
#' \code{asin}: Returns the inverse sine of the given value,
#' as if computed by \code{java.lang.Math.asin()}
#'
#' @rdname column_math_functions
#' @export
Expand All @@ -349,8 +349,8 @@ setMethod("asin",
})

#' @details
#' \code{atan}: Computes the tangent inverse of the given value; the returned angle is in the range
#' -pi/2 through pi/2.
#' \code{atan}: Returns the inverse tangent of the given value,
#' as if computed by \code{java.lang.Math.atan()}
#'
#' @rdname column_math_functions
#' @export
Expand Down Expand Up @@ -613,7 +613,8 @@ setMethod("covar_pop", signature(col1 = "characterOrColumn", col2 = "characterOr
})

#' @details
#' \code{cos}: Computes the cosine of the given value. Units in radians.
#' \code{cos}: Returns the cosine of the given value,
#' as if computed by \code{java.lang.Math.cos()}. Units in radians.
#'
#' @rdname column_math_functions
#' @aliases cos cos,Column-method
Expand All @@ -627,7 +628,8 @@ setMethod("cos",
})

#' @details
#' \code{cosh}: Computes the hyperbolic cosine of the given value.
#' \code{cosh}: Returns the hyperbolic cosine of the given value,
#' as if computed by \code{java.lang.Math.cosh()}.
#'
#' @rdname column_math_functions
#' @aliases cosh cosh,Column-method
Expand Down Expand Up @@ -1463,7 +1465,8 @@ setMethod("sign", signature(x = "Column"),
})

#' @details
#' \code{sin}: Computes the sine of the given value. Units in radians.
#' \code{sin}: Returns the sine of the given value,
#' as if computed by \code{java.lang.Math.sin()}. Units in radians.
#'
#' @rdname column_math_functions
#' @aliases sin sin,Column-method
Expand All @@ -1477,7 +1480,8 @@ setMethod("sin",
})

#' @details
#' \code{sinh}: Computes the hyperbolic sine of the given value.
#' \code{sinh}: Returns the hyperbolic sine of the given value,
#' as if computed by \code{java.lang.Math.sinh()}.
#'
#' @rdname column_math_functions
#' @aliases sinh sinh,Column-method
Expand Down Expand Up @@ -1653,7 +1657,9 @@ setMethod("sumDistinct",
})

#' @details
#' \code{tan}: Computes the tangent of the given value. Units in radians.
#' \code{tan}: Returns the tangent of the given value,
#' as if computed by \code{java.lang.Math.tan()}.
#' Units in radians.
#'
#' @rdname column_math_functions
#' @aliases tan tan,Column-method
Expand All @@ -1667,7 +1673,8 @@ setMethod("tan",
})

#' @details
#' \code{tanh}: Computes the hyperbolic tangent of the given value.
#' \code{tanh}: Returns the hyperbolic tangent of the given value,
#' as if computed by \code{java.lang.Math.tanh()}.
#'
#' @rdname column_math_functions
#' @aliases tanh tanh,Column-method
Expand Down Expand Up @@ -1973,7 +1980,8 @@ setMethod("year",

#' @details
#' \code{atan2}: Returns the angle theta from the conversion of rectangular coordinates
#' (x, y) to polar coordinates (r, theta). Units in radians.
#' (x, y) to polar coordinates (r, theta),
#' as if computed by \code{java.lang.Math.atan2()}. Units in radians.
#'
#' @rdname column_math_functions
#' @aliases atan2 atan2,Column-method
Expand Down
62 changes: 38 additions & 24 deletions python/pyspark/sql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,15 @@ def _():

_functions_1_4 = {
# unary math functions
'acos': 'Computes the cosine inverse of the given value; the returned angle is in the range' +
'0.0 through pi.',
'asin': 'Computes the sine inverse of the given value; the returned angle is in the range' +
'-pi/2 through pi/2.',
'atan': 'Computes the tangent inverse of the given value; the returned angle is in the range' +
'-pi/2 through pi/2',
'acos': ':return: inverse cosine of `col`, as if computed by `java.lang.Math.acos()`',
'asin': ':return: inverse sine of `col`, as if computed by `java.lang.Math.asin()`',
'atan': ':return: inverse tangent of `col`, as if computed by `java.lang.Math.atan()`',
'cbrt': 'Computes the cube-root of the given value.',
'ceil': 'Computes the ceiling of the given value.',
'cos': """Computes the cosine of the given value.

:param col: :class:`DoubleType` column, units in radians.""",
'cosh': 'Computes the hyperbolic cosine of the given value.',
'cos': """:param col: angle in radians
:return: cosine of the angle, as if computed by `java.lang.Math.cos()`.""",
'cosh': """:param col: hyperbolic angle
:return: hyperbolic cosine of the angle, as if computed by `java.lang.Math.cosh()`""",
'exp': 'Computes the exponential of the given value.',
'expm1': 'Computes the exponential of the given value minus one.',
'floor': 'Computes the floor of the given value.',
Expand All @@ -127,14 +124,16 @@ def _():
'rint': 'Returns the double value that is closest in value to the argument and' +
' is equal to a mathematical integer.',
'signum': 'Computes the signum of the given value.',
'sin': """Computes the sine of the given value.

:param col: :class:`DoubleType` column, units in radians.""",
'sinh': 'Computes the hyperbolic sine of the given value.',
'tan': """Computes the tangent of the given value.

:param col: :class:`DoubleType` column, units in radians.""",
'tanh': 'Computes the hyperbolic tangent of the given value.',
'sin': """:param col: angle in radians
:return: sine of the angle, as if computed by `java.lang.Math.sin()`""",
'sinh': """:param col: hyperbolic angle
:return: hyperbolic sine of the given value,
as if computed by `java.lang.Math.sinh()`""",
'tan': """:param col: angle in radians
:return: tangent of the given value, as if computed by `java.lang.Math.tan()`""",
'tanh': """:param col: hyperbolic angle
:return: hyperbolic tangent of the given value,
as if computed by `java.lang.Math.tanh()`""",
'toDegrees': '.. note:: Deprecated in 2.1, use :func:`degrees` instead.',
'toRadians': '.. note:: Deprecated in 2.1, use :func:`radians` instead.',
'bitwiseNOT': 'Computes bitwise not.',
Expand Down Expand Up @@ -173,16 +172,31 @@ def _():

_functions_2_1 = {
# unary math functions
'degrees': 'Converts an angle measured in radians to an approximately equivalent angle ' +
'measured in degrees.',
'radians': 'Converts an angle measured in degrees to an approximately equivalent angle ' +
'measured in radians.',
'degrees': """
Converts an angle measured in radians to an approximately equivalent angle
measured in degrees.
:param col: angle in radians
:return: angle in degrees, as if computed by `java.lang.Math.toDegrees()`
""",
'radians': """
Converts an angle measured in degrees to an approximately equivalent angle
measured in radians.
:param col: angle in degrees
:return: angle in radians, as if computed by `java.lang.Math.toRadians()`
""",
}

# math functions that take two arguments as input
_binary_mathfunctions = {
'atan2': 'Returns the angle theta from the conversion of rectangular coordinates (x, y) to' +
'polar coordinates (r, theta). Units in radians.',
'atan2': """
:param col1: coordinate on y-axis
:param col2: coordinate on x-axis
:return: the `theta` component of the point
(`r`, `theta`)
in polar coordinates that corresponds to the point
(`x`, `y`) in Cartesian coordinates,
as if computed by `java.lang.Math.atan2()`
""",
'hypot': 'Computes ``sqrt(a^2 + b^2)`` without intermediate overflow or underflow.',
'pow': 'Returns the value of the first argument raised to the power of the second argument.',
}
Expand Down
Loading