diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala index bfdfc54348c29..c2178f10aa6bb 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala @@ -259,8 +259,7 @@ case class Ceil(child: Expression) extends UnaryMathExpression(math.ceil, "CEIL" _FUNC_(expr) - Returns the cosine of `expr`, as if computed by `java.lang.Math._FUNC_`. """, - arguments = - """ + arguments = """ Arguments: * expr - angle in radians """, @@ -273,8 +272,7 @@ case class Cos(child: Expression) extends UnaryMathExpression(math.cos, "COS") @ExpressionDescription( usage = "_FUNC_(expr) - Returns the hyperbolic cosine of `expr`.", - arguments = - """ + arguments = """ Arguments: * expr - hyperbolic angle. """, @@ -529,8 +527,7 @@ case class Signum(child: Expression) extends UnaryMathExpression(math.signum, "S @ExpressionDescription( usage = "_FUNC_(expr) - Returns the sine of `expr`, as if computed by `java.lang.Math._FUNC_`.", - arguments = - """ + arguments = """ Arguments: * expr - angle in radians """, @@ -543,11 +540,9 @@ case class Sin(child: Expression) extends UnaryMathExpression(math.sin, "SIN") @ExpressionDescription( usage = """ - _FUNC_(expr) - Returns hyperbolic sine of `expr`, as if computed by - `java.lang.Math._FUNC_`. + _FUNC_(expr) - Returns hyperbolic sine of `expr`, as if computed by `java.lang.Math._FUNC_`. """, - arguments = - """ + arguments = """ Arguments: * expr - hyperbolic angle """, @@ -572,8 +567,7 @@ case class Sqrt(child: Expression) extends UnaryMathExpression(math.sqrt, "SQRT" _FUNC_(expr) - Returns the tangent of `expr`, as if computed by `java.lang.Math._FUNC_`. """, - arguments = - """ + arguments = """ Arguments: * expr - angle in radians """, @@ -589,8 +583,7 @@ case class Tan(child: Expression) extends UnaryMathExpression(math.tan, "TAN") _FUNC_(expr) - Returns the cotangent of `expr`, as if computed by `1/java.lang.Math._FUNC_`. """, - arguments = - """ + arguments = """ Arguments: * expr - angle in radians """, @@ -611,8 +604,7 @@ case class Cot(child: Expression) _FUNC_(expr) - Returns the hyperbolic tangent of `expr`, as if computed by `java.lang.Math._FUNC_`. """, - arguments = - """ + arguments = """ Arguments: * expr - hyperbolic angle """, @@ -625,8 +617,7 @@ case class Tanh(child: Expression) extends UnaryMathExpression(math.tanh, "TANH" @ExpressionDescription( usage = "_FUNC_(expr) - Converts radians to degrees.", - arguments = - """ + arguments = """ Arguments: * expr - angle in radians """, @@ -641,8 +632,7 @@ case class ToDegrees(child: Expression) extends UnaryMathExpression(math.toDegre @ExpressionDescription( usage = "_FUNC_(expr) - Converts degrees to radians.", - arguments = - """ + arguments = """ Arguments: * expr - angle in degrees """, @@ -837,8 +827,7 @@ case class Unhex(child: Expression) extends UnaryExpression with ImplicitCastInp and the point given by the coordinates (`exprX`, `exprY`), as if computed by `java.lang.Math._FUNC_`. """, - arguments = - """ + arguments = """ Arguments: * exprY - coordinate on y-axis * exprX - coordinate on x-axis diff --git a/sql/core/src/main/scala/org/apache/spark/sql/functions.scala b/sql/core/src/main/scala/org/apache/spark/sql/functions.scala index decd7086852b6..0d54c02c3d06f 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/functions.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/functions.scala @@ -1313,7 +1313,8 @@ object functions { ////////////////////////////////////////////////////////////////////////////////////////////// /** - * @return inverse cosine of `e` in radians, as if computed by [[java.lang.Math#acos]] + * Computes the cosine inverse of the given value; the returned angle is in the range + * 0.0 through pi. * * @group math_funcs * @since 1.4.0 @@ -1321,7 +1322,8 @@ object functions { def acos(e: Column): Column = withExpr { Acos(e.expr) } /** - * @return inverse cosine of `columnName`, as if computed by [[java.lang.Math#acos]] + * Computes the cosine inverse of the given column; the returned angle is in the range + * 0.0 through pi. * * @group math_funcs * @since 1.4.0 @@ -1329,7 +1331,8 @@ object functions { def acos(columnName: String): Column = acos(Column(columnName)) /** - * @return inverse sine of `e` in radians, as if computed by [[java.lang.Math#asin]] + * Computes the sine inverse of the given value; the returned angle is in the range + * -pi/2 through pi/2. * * @group math_funcs * @since 1.4.0 @@ -1337,7 +1340,8 @@ object functions { def asin(e: Column): Column = withExpr { Asin(e.expr) } /** - * @return inverse sine of `columnName`, as if computed by [[java.lang.Math#asin]] + * Computes the sine inverse of the given column; the returned angle is in the range + * -pi/2 through pi/2. * * @group math_funcs * @since 1.4.0 @@ -1345,7 +1349,8 @@ object functions { def asin(columnName: String): Column = asin(Column(columnName)) /** - * @return inverse tangent of `e`, as if computed by [[java.lang.Math#atan]] + * Computes the tangent inverse of the given column; the returned angle is in the range + * -pi/2 through pi/2 * * @group math_funcs * @since 1.4.0 @@ -1353,7 +1358,8 @@ object functions { def atan(e: Column): Column = withExpr { Atan(e.expr) } /** - * @return inverse tangent of `columnName`, as if computed by [[java.lang.Math#atan]] + * Computes the tangent inverse of the given column; the returned angle is in the range + * -pi/2 through pi/2 * * @group math_funcs * @since 1.4.0 @@ -1361,117 +1367,77 @@ object functions { def atan(columnName: String): Column = atan(Column(columnName)) /** - * @param y coordinate on y-axis - * @param x coordinate on x-axis - * @return the theta component of the point - * (rtheta) - * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * Returns the angle theta from the conversion of rectangular coordinates (x, y) to + * polar coordinates (r, theta). Units in radians. * * @group math_funcs * @since 1.4.0 */ - def atan2(y: Column, x: Column): Column = withExpr { Atan2(y.expr, x.expr) } + def atan2(l: Column, r: Column): Column = withExpr { Atan2(l.expr, r.expr) } /** - * @param y coordinate on y-axis - * @param xName coordinate on x-axis - * @return the theta component of the point - * (rtheta) - * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * Returns the angle theta from the conversion of rectangular coordinates (x, y) to + * polar coordinates (r, theta). * * @group math_funcs * @since 1.4.0 */ - def atan2(y: Column, xName: String): Column = atan2(y, Column(xName)) + def atan2(l: Column, rightName: String): Column = atan2(l, Column(rightName)) /** - * @param yName coordinate on y-axis - * @param x coordinate on x-axis - * @return the theta component of the point - * (rtheta) - * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * Returns the angle theta from the conversion of rectangular coordinates (x, y) to + * polar coordinates (r, theta). * * @group math_funcs * @since 1.4.0 */ - def atan2(yName: String, x: Column): Column = atan2(Column(yName), x) + def atan2(leftName: String, r: Column): Column = atan2(Column(leftName), r) /** - * @param yName coordinate on y-axis - * @param xName coordinate on x-axis - * @return the theta component of the point - * (rtheta) - * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * Returns the angle theta from the conversion of rectangular coordinates (x, y) to + * polar coordinates (r, theta). * * @group math_funcs * @since 1.4.0 */ - def atan2(yName: String, xName: String): Column = - atan2(Column(yName), Column(xName)) + def atan2(leftName: String, rightName: String): Column = + atan2(Column(leftName), Column(rightName)) /** - * @param y coordinate on y-axis - * @param xValue coordinate on x-axis - * @return the theta component of the point - * (rtheta) - * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * Returns the angle theta from the conversion of rectangular coordinates (x, y) to + * polar coordinates (r, theta). * * @group math_funcs * @since 1.4.0 */ - def atan2(y: Column, xValue: Double): Column = atan2(y, lit(xValue)) + def atan2(l: Column, r: Double): Column = atan2(l, lit(r)) /** - * @param yName coordinate on y-axis - * @param xValue coordinate on x-axis - * @return the theta component of the point - * (rtheta) - * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * Returns the angle theta from the conversion of rectangular coordinates (x, y) to + * polar coordinates (r, theta). * * @group math_funcs * @since 1.4.0 */ - def atan2(yName: String, xValue: Double): Column = atan2(Column(yName), xValue) + def atan2(leftName: String, r: Double): Column = atan2(Column(leftName), r) /** - * @param yValue coordinate on y-axis - * @param x coordinate on x-axis - * @return the theta component of the point - * (rtheta) - * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * Returns the angle theta from the conversion of rectangular coordinates (x, y) to + * polar coordinates (r, theta). * * @group math_funcs * @since 1.4.0 */ - def atan2(yValue: Double, x: Column): Column = atan2(lit(yValue), x) + def atan2(l: Double, r: Column): Column = atan2(lit(l), r) /** - * @param yValue coordinate on y-axis - * @param xName coordinate on x-axis - * @return the theta component of the point - * (rtheta) - * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * Returns the angle theta from the conversion of rectangular coordinates (x, y) to + * polar coordinates (r, theta). * * @group math_funcs * @since 1.4.0 */ - def atan2(yValue: Double, xName: String): Column = atan2(yValue, Column(xName)) + def atan2(l: Double, rightName: String): Column = atan2(l, Column(rightName)) /** * An expression that returns the string representation of the binary value of the given long @@ -1534,8 +1500,7 @@ object functions { } /** - * @param e angle in radians - * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] + * Computes the cosine of the given value. Units in radians. * * @group math_funcs * @since 1.4.0 @@ -1543,8 +1508,7 @@ object functions { def cos(e: Column): Column = withExpr { Cos(e.expr) } /** - * @param columnName angle in radians - * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] + * Computes the cosine of the given column. * * @group math_funcs * @since 1.4.0 @@ -1552,8 +1516,7 @@ object functions { def cos(columnName: String): Column = cos(Column(columnName)) /** - * @param e angle in radians - * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] + * Computes the hyperbolic cosine of the given value. * * @group math_funcs * @since 1.4.0 @@ -1561,8 +1524,7 @@ object functions { def cosh(e: Column): Column = withExpr { Cosh(e.expr) } /** - * @param columnName angle in radians - * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] + * Computes the hyperbolic cosine of the given column. * * @group math_funcs * @since 1.4.0 @@ -2005,8 +1967,7 @@ object functions { def signum(columnName: String): Column = signum(Column(columnName)) /** - * @param e angle in radians - * @return sine of the angle, as if computed by [[java.lang.Math#sin]] + * Computes the sine of the given value. Units in radians. * * @group math_funcs * @since 1.4.0 @@ -2014,8 +1975,7 @@ object functions { def sin(e: Column): Column = withExpr { Sin(e.expr) } /** - * @param columnName angle in radians - * @return sine of the angle, as if computed by [[java.lang.Math#sin]] + * Computes the sine of the given column. * * @group math_funcs * @since 1.4.0 @@ -2023,8 +1983,7 @@ object functions { def sin(columnName: String): Column = sin(Column(columnName)) /** - * @param e hyperbolic angle - * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] + * Computes the hyperbolic sine of the given value. * * @group math_funcs * @since 1.4.0 @@ -2032,8 +1991,7 @@ object functions { def sinh(e: Column): Column = withExpr { Sinh(e.expr) } /** - * @param columnName hyperbolic angle - * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] + * Computes the hyperbolic sine of the given column. * * @group math_funcs * @since 1.4.0 @@ -2041,8 +1999,7 @@ object functions { def sinh(columnName: String): Column = sinh(Column(columnName)) /** - * @param e angle in radians - * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] + * Computes the tangent of the given value. Units in radians. * * @group math_funcs * @since 1.4.0 @@ -2050,8 +2007,7 @@ object functions { def tan(e: Column): Column = withExpr { Tan(e.expr) } /** - * @param columnName angle in radians - * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] + * Computes the tangent of the given column. * * @group math_funcs * @since 1.4.0 @@ -2059,8 +2015,7 @@ object functions { def tan(columnName: String): Column = tan(Column(columnName)) /** - * @param e hyperbolic angle - * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] + * Computes the hyperbolic tangent of the given value. * * @group math_funcs * @since 1.4.0 @@ -2068,8 +2023,7 @@ object functions { def tanh(e: Column): Column = withExpr { Tanh(e.expr) } /** - * @param columnName hyperbolic angle - * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] + * Computes the hyperbolic tangent of the given column. * * @group math_funcs * @since 1.4.0 @@ -2093,9 +2047,6 @@ object functions { /** * Converts an angle measured in radians to an approximately equivalent angle measured in degrees. * - * @param e angle in radians - * @return angle in degrees, as if computed by [[java.lang.Math#toDegrees]] - * * @group math_funcs * @since 2.1.0 */ @@ -2104,9 +2055,6 @@ object functions { /** * Converts an angle measured in radians to an approximately equivalent angle measured in degrees. * - * @param columnName angle in radians - * @return angle in degrees, as if computed by [[java.lang.Math#toDegrees]] - * * @group math_funcs * @since 2.1.0 */ @@ -2129,9 +2077,6 @@ object functions { /** * Converts an angle measured in degrees to an approximately equivalent angle measured in radians. * - * @param e angle in degrees - * @return angle in radians, as if computed by [[java.lang.Math#toRadians]] - * * @group math_funcs * @since 2.1.0 */ @@ -2140,9 +2085,6 @@ object functions { /** * Converts an angle measured in degrees to an approximately equivalent angle measured in radians. * - * @param columnName angle in degrees - * @return angle in radians, as if computed by [[java.lang.Math#toRadians]] - * * @group math_funcs * @since 2.1.0 */ @@ -2931,7 +2873,7 @@ object functions { * or equal to the `windowDuration`. Check * `org.apache.spark.unsafe.types.CalendarInterval` for valid duration * identifiers. This duration is likewise absolute, and does not vary - * according to a calendar. + * according to a calendar. * @param startTime The offset with respect to 1970-01-01 00:00:00 UTC with which to start * window intervals. For example, in order to have hourly tumbling windows that * start 15 minutes past the hour, e.g. 12:15-13:15, 13:15-14:15... provide @@ -2987,7 +2929,7 @@ object functions { * or equal to the `windowDuration`. Check * `org.apache.spark.unsafe.types.CalendarInterval` for valid duration * identifiers. This duration is likewise absolute, and does not vary - * according to a calendar. + * according to a calendar. * * @group datetime_funcs * @since 2.0.0