From 0a0c4aede61a89465b474d292baf9aef773f7a80 Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Tue, 13 Feb 2018 15:34:26 +0100 Subject: [PATCH 01/10] [SPARK-23329][SQL] Fix documentation of trigonometric functions --- .../expressions/mathExpressions.scala | 76 ++++++-- .../org/apache/spark/sql/functions.scala | 164 ++++++++++++------ 2 files changed, 177 insertions(+), 63 deletions(-) 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 d8dc0862f1141..dd89d6faf2834 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 @@ -170,7 +170,7 @@ case class Pi() extends LeafMathExpression(math.Pi, "PI") // scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the inverse cosine (a.k.a. arccosine) of `expr` if -1<=`expr`<=1 or NaN otherwise.", + usage = "_FUNC_(expr) - Returns the inverse cosine (a.k.a. arc cosine) of `expr`, as if computed by `java.lang.Math._FUNC_`.", examples = """ Examples: > SELECT _FUNC_(1); @@ -183,7 +183,7 @@ case class Acos(child: Expression) extends UnaryMathExpression(math.acos, "ACOS" // scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the inverse sine (a.k.a. arcsine) the arc sin of `expr` if -1<=`expr`<=1 or NaN otherwise.", + usage = "_FUNC_(expr) - Returns the inverse sine (a.k.a. arc sine) the arc sin of `expr`, as if computed by `java.lang.Math._FUNC_`.", examples = """ Examples: > SELECT _FUNC_(0); @@ -196,7 +196,7 @@ case class Asin(child: Expression) extends UnaryMathExpression(math.asin, "ASIN" // scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the inverse tangent (a.k.a. arctangent).", + usage = "_FUNC_(expr) - Returns the inverse tangent (a.k.a. arc tangent) of `expr`, as if computed by `java.lang.Math._FUNC_`.", examples = """ Examples: > SELECT _FUNC_(0); @@ -252,7 +252,12 @@ case class Ceil(child: Expression) extends UnaryMathExpression(math.ceil, "CEIL" } @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the cosine of `expr`.", + usage = "_FUNC_(expr) - Returns the cosine of `expr`, as if computed by `java.lang.Math._FUNC_`.", + arguments = + """ + Arguments: + * expr - angle in radians + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -262,6 +267,11 @@ case class Cos(child: Expression) extends UnaryMathExpression(math.cos, "COS") @ExpressionDescription( usage = "_FUNC_(expr) - Returns the hyperbolic cosine of `expr`.", + arguments = + """ + Arguments: + * expr - hyperbolic angle. + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -512,7 +522,12 @@ case class Rint(child: Expression) extends UnaryMathExpression(math.rint, "ROUND case class Signum(child: Expression) extends UnaryMathExpression(math.signum, "SIGNUM") @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the sine of `expr`.", + usage = "_FUNC_(expr) - Returns the sine of `expr`, as if computed by `java.lang.Math._FUNC_`.", + arguments = + """ + Arguments: + * expr - angle in radians + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -520,8 +535,14 @@ case class Signum(child: Expression) extends UnaryMathExpression(math.signum, "S """) case class Sin(child: Expression) extends UnaryMathExpression(math.sin, "SIN") +// scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the hyperbolic sine of `expr`.", + usage = "_FUNC_(expr) - Returns hyperbolic sine of `expr`, as if computed by `java.lang.Math._FUNC_`.", + arguments = + """ + Arguments: + * expr - hyperbolic angle + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -538,8 +559,14 @@ case class Sinh(child: Expression) extends UnaryMathExpression(math.sinh, "SINH" """) case class Sqrt(child: Expression) extends UnaryMathExpression(math.sqrt, "SQRT") +// scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the tangent of `expr`.", + usage = "_FUNC_(expr) - Returns the tangent of `expr`, as if computed by `java.lang.Math._FUNC_`.", + arguments = + """ + Arguments: + * expr - angle in radians + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -548,7 +575,13 @@ case class Sqrt(child: Expression) extends UnaryMathExpression(math.sqrt, "SQRT" case class Tan(child: Expression) extends UnaryMathExpression(math.tan, "TAN") @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the cotangent of `expr`.", + usage = "_FUNC_(expr) - Returns the cotangent of `expr` ," + + "as if computed by `1/java.lang.Math._FUNC_`.", + arguments = + """ + Arguments: + * expr - angle in radians + """, examples = """ Examples: > SELECT _FUNC_(1); @@ -562,7 +595,12 @@ case class Cot(child: Expression) } @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the hyperbolic tangent of `expr`.", + usage = "_FUNC_(expr) - Returns the hyperbolic tangent of `expr`, as if computed by `java.lang.Math._FUNC_`.", + arguments = + """ + Arguments: + * expr - hyperbolic angle + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -572,6 +610,11 @@ case class Tanh(child: Expression) extends UnaryMathExpression(math.tanh, "TANH" @ExpressionDescription( usage = "_FUNC_(expr) - Converts radians to degrees.", + arguments = + """ + Arguments: + * expr - angle in radians + """, examples = """ Examples: > SELECT _FUNC_(3.141592653589793); @@ -583,6 +626,11 @@ case class ToDegrees(child: Expression) extends UnaryMathExpression(math.toDegre @ExpressionDescription( usage = "_FUNC_(expr) - Converts degrees to radians.", + arguments = + """ + Arguments: + * expr - angle in degrees + """, examples = """ Examples: > SELECT _FUNC_(180); @@ -770,7 +818,13 @@ case class Unhex(child: Expression) extends UnaryExpression with ImplicitCastInp // scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr1, expr2) - Returns the angle in radians between the positive x-axis of a plane and the point given by the coordinates (`expr1`, `expr2`).", + usage = "_FUNC_(exprY, exprX) - Returns the angle in radians between the positive x-axis of a plane and the point given by the coordinates (`exprX`, `exprY`), as if computed by `java.lang.Math._FUNC_`.", + arguments = + """ + Arguments: + * exprY - coordinate on y-axis + * exprX - coordinate on x-axis + """, examples = """ Examples: > SELECT _FUNC_(0, 0); @@ -804,7 +858,6 @@ case class Pow(left: Expression, right: Expression) } } - /** * Bitwise left shift. * @@ -916,7 +969,6 @@ case class ShiftRightUnsigned(left: Expression, right: Expression) case class Hypot(left: Expression, right: Expression) extends BinaryMathExpression(math.hypot, "HYPOT") - /** * Computes the logarithm of a number. * 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 0d54c02c3d06f..2da4c91785a4b 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,17 +1313,16 @@ object functions { ////////////////////////////////////////////////////////////////////////////////////////////// /** - * Computes the cosine inverse of the given value; the returned angle is in the range - * 0.0 through pi. + * @return angle in radians whose cosine is `e`, as if computed by [[java.lang.Math#acos]] * * @group math_funcs * @since 1.4.0 */ def acos(e: Column): Column = withExpr { Acos(e.expr) } + // scalastyle:off line.size.limit /** - * Computes the cosine inverse of the given column; the returned angle is in the range - * 0.0 through pi. + * @return angle in radians whose cosine is `columnName` as if computed by [[java.lang.Math#acos]] * * @group math_funcs * @since 1.4.0 @@ -1331,8 +1330,7 @@ object functions { def acos(columnName: String): Column = acos(Column(columnName)) /** - * Computes the sine inverse of the given value; the returned angle is in the range - * -pi/2 through pi/2. + * @return angle in radians whose sine is `e`, as if computed by [[java.lang.Math#asin]] * * @group math_funcs * @since 1.4.0 @@ -1340,8 +1338,7 @@ object functions { def asin(e: Column): Column = withExpr { Asin(e.expr) } /** - * Computes the sine inverse of the given column; the returned angle is in the range - * -pi/2 through pi/2. + * @return angle in radians whose sine is `columnName`, as if computed by [[java.lang.Math#asin]] * * @group math_funcs * @since 1.4.0 @@ -1349,17 +1346,16 @@ object functions { def asin(columnName: String): Column = asin(Column(columnName)) /** - * Computes the tangent inverse of the given column; the returned angle is in the range - * -pi/2 through pi/2 + * @return angle in radians whose tangent is `e`, as if computed by [[java.lang.Math#atan]] * * @group math_funcs * @since 1.4.0 */ def atan(e: Column): Column = withExpr { Atan(e.expr) } + // scalastyle:off line.size.limit /** - * Computes the tangent inverse of the given column; the returned angle is in the range - * -pi/2 through pi/2 + * @return angle in radians whose tangent is `columnName`, as if computed by [[java.lang.Math#atan]] * * @group math_funcs * @since 1.4.0 @@ -1367,77 +1363,118 @@ object functions { def atan(columnName: String): Column = atan(Column(columnName)) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). Units in radians. + * + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Column, r: Column): Column = withExpr { Atan2(l.expr, r.expr) } + def atan2(y: Column, x: Column): Column = withExpr { Atan2(y.expr, x.expr) } /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Column, rightName: String): Column = atan2(l, Column(rightName)) + def atan2(y: Column, xName: String): Column = atan2(y, Column(xName)) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(leftName: String, r: Column): Column = atan2(Column(leftName), r) + def atan2(yName: String, x: Column): Column = atan2(Column(yName), x) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(leftName: String, rightName: String): Column = - atan2(Column(leftName), Column(rightName)) + def atan2(yName: String, xName: String): Column = + atan2(Column(yName), Column(xName)) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Column, r: Double): Column = atan2(l, lit(r)) + def atan2(y: Column, xValue: Double): Column = atan2(y, lit(xValue)) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(leftName: String, r: Double): Column = atan2(Column(leftName), r) + def atan2(yName: String, xValue: Double): Column = atan2(Column(yName), xValue) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Double, r: Column): Column = atan2(lit(l), r) + def atan2(yValue: Double, x: Column): Column = atan2(lit(yValue), x) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Double, rightName: String): Column = atan2(l, Column(rightName)) + def atan2(yValue: Double, xName: String): Column = atan2(yValue, Column(xName)) /** * An expression that returns the string representation of the binary value of the given long @@ -1500,7 +1537,8 @@ object functions { } /** - * Computes the cosine of the given value. Units in radians. + * @param e angle in radians + * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] * * @group math_funcs * @since 1.4.0 @@ -1508,7 +1546,8 @@ object functions { def cos(e: Column): Column = withExpr { Cos(e.expr) } /** - * Computes the cosine of the given column. + * @param columnName angle in radians + * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] * * @group math_funcs * @since 1.4.0 @@ -1516,7 +1555,8 @@ object functions { def cos(columnName: String): Column = cos(Column(columnName)) /** - * Computes the hyperbolic cosine of the given value. + * @param e angle in radians + * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] * * @group math_funcs * @since 1.4.0 @@ -1524,7 +1564,8 @@ object functions { def cosh(e: Column): Column = withExpr { Cosh(e.expr) } /** - * Computes the hyperbolic cosine of the given column. + * @param columnName angle in radians + * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] * * @group math_funcs * @since 1.4.0 @@ -1967,7 +2008,8 @@ object functions { def signum(columnName: String): Column = signum(Column(columnName)) /** - * Computes the sine of the given value. Units in radians. + * @param e angle in radians + * @return sine of the angle, as if computed by [[java.lang.Math#sin]] * * @group math_funcs * @since 1.4.0 @@ -1975,7 +2017,8 @@ object functions { def sin(e: Column): Column = withExpr { Sin(e.expr) } /** - * Computes the sine of the given column. + * @param columnName angle in radians + * @return sine of the angle, as if computed by [[java.lang.Math#sin]] * * @group math_funcs * @since 1.4.0 @@ -1983,7 +2026,8 @@ object functions { def sin(columnName: String): Column = sin(Column(columnName)) /** - * Computes the hyperbolic sine of the given value. + * @param e hyperbolic angle + * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] * * @group math_funcs * @since 1.4.0 @@ -1991,7 +2035,8 @@ object functions { def sinh(e: Column): Column = withExpr { Sinh(e.expr) } /** - * Computes the hyperbolic sine of the given column. + * @param columnName hyperbolic angle + * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] * * @group math_funcs * @since 1.4.0 @@ -1999,7 +2044,8 @@ object functions { def sinh(columnName: String): Column = sinh(Column(columnName)) /** - * Computes the tangent of the given value. Units in radians. + * @param e angle in radians + * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] * * @group math_funcs * @since 1.4.0 @@ -2007,7 +2053,8 @@ object functions { def tan(e: Column): Column = withExpr { Tan(e.expr) } /** - * Computes the tangent of the given column. + * @param columnName angle in radians + * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] * * @group math_funcs * @since 1.4.0 @@ -2015,7 +2062,8 @@ object functions { def tan(columnName: String): Column = tan(Column(columnName)) /** - * Computes the hyperbolic tangent of the given value. + * @param e hyperbolic angle + * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] * * @group math_funcs * @since 1.4.0 @@ -2023,7 +2071,9 @@ object functions { def tanh(e: Column): Column = withExpr { Tanh(e.expr) } /** - * Computes the hyperbolic tangent of the given column. + * @param columnName hyperbolic angle + * @return hyperbolic tangent of the given value, + * as if computed by [[java.lang.Math#tanh]] * * @group math_funcs * @since 1.4.0 @@ -2047,6 +2097,9 @@ 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 */ @@ -2055,6 +2108,9 @@ 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 */ @@ -2077,6 +2133,9 @@ 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 */ @@ -2085,6 +2144,9 @@ 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 */ @@ -2873,7 +2935,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 @@ -2929,7 +2991,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 From 168d7b3715c8ad19b68c9542ffdb90bcb126c312 Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Mon, 19 Feb 2018 16:34:35 +0100 Subject: [PATCH 02/10] [SPARK-23329][SQL] Removed unnecessary aligning, reworded inverse functions --- .../org/apache/spark/sql/functions.scala | 150 +++++++++--------- 1 file changed, 73 insertions(+), 77 deletions(-) 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 2da4c91785a4b..decd7086852b6 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,16 +1313,15 @@ object functions { ////////////////////////////////////////////////////////////////////////////////////////////// /** - * @return angle in radians whose cosine is `e`, as if computed by [[java.lang.Math#acos]] + * @return inverse cosine of `e` in radians, as if computed by [[java.lang.Math#acos]] * * @group math_funcs * @since 1.4.0 */ def acos(e: Column): Column = withExpr { Acos(e.expr) } - // scalastyle:off line.size.limit /** - * @return angle in radians whose cosine is `columnName` as if computed by [[java.lang.Math#acos]] + * @return inverse cosine of `columnName`, as if computed by [[java.lang.Math#acos]] * * @group math_funcs * @since 1.4.0 @@ -1330,7 +1329,7 @@ object functions { def acos(columnName: String): Column = acos(Column(columnName)) /** - * @return angle in radians whose sine is `e`, as if computed by [[java.lang.Math#asin]] + * @return inverse sine of `e` in radians, as if computed by [[java.lang.Math#asin]] * * @group math_funcs * @since 1.4.0 @@ -1338,7 +1337,7 @@ object functions { def asin(e: Column): Column = withExpr { Asin(e.expr) } /** - * @return angle in radians whose sine is `columnName`, as if computed by [[java.lang.Math#asin]] + * @return inverse sine of `columnName`, as if computed by [[java.lang.Math#asin]] * * @group math_funcs * @since 1.4.0 @@ -1346,16 +1345,15 @@ object functions { def asin(columnName: String): Column = asin(Column(columnName)) /** - * @return angle in radians whose tangent is `e`, as if computed by [[java.lang.Math#atan]] + * @return inverse tangent of `e`, as if computed by [[java.lang.Math#atan]] * * @group math_funcs * @since 1.4.0 */ def atan(e: Column): Column = withExpr { Atan(e.expr) } - // scalastyle:off line.size.limit /** - * @return angle in radians whose tangent is `columnName`, as if computed by [[java.lang.Math#atan]] + * @return inverse tangent of `columnName`, as if computed by [[java.lang.Math#atan]] * * @group math_funcs * @since 1.4.0 @@ -1363,14 +1361,13 @@ 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]] + * @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]] * * @group math_funcs * @since 1.4.0 @@ -1378,13 +1375,13 @@ object functions { def atan2(y: Column, x: Column): Column = withExpr { Atan2(y.expr, x.expr) } /** - * @param y coordinate on y-axis + * @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]] + * @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]] * * @group math_funcs * @since 1.4.0 @@ -1393,12 +1390,12 @@ object functions { /** * @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]] + * @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]] * * @group math_funcs * @since 1.4.0 @@ -1408,11 +1405,11 @@ object functions { /** * @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]] + * @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]] * * @group math_funcs * @since 1.4.0 @@ -1421,13 +1418,13 @@ object functions { atan2(Column(yName), Column(xName)) /** - * @param y coordinate on y-axis + * @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]] + * @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]] * * @group math_funcs * @since 1.4.0 @@ -1435,13 +1432,13 @@ object functions { def atan2(y: Column, xValue: Double): Column = atan2(y, lit(xValue)) /** - * @param yName coordinate on y-axis + * @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]] + * @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]] * * @group math_funcs * @since 1.4.0 @@ -1450,12 +1447,12 @@ object functions { /** * @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]] + * @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]] * * @group math_funcs * @since 1.4.0 @@ -1464,12 +1461,12 @@ object functions { /** * @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]] + * @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]] * * @group math_funcs * @since 1.4.0 @@ -1538,7 +1535,7 @@ object functions { /** * @param e angle in radians - * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] + * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] * * @group math_funcs * @since 1.4.0 @@ -1547,7 +1544,7 @@ object functions { /** * @param columnName angle in radians - * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] + * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] * * @group math_funcs * @since 1.4.0 @@ -1556,7 +1553,7 @@ object functions { /** * @param e angle in radians - * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] + * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] * * @group math_funcs * @since 1.4.0 @@ -1565,7 +1562,7 @@ object functions { /** * @param columnName angle in radians - * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] + * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] * * @group math_funcs * @since 1.4.0 @@ -2009,7 +2006,7 @@ object functions { /** * @param e angle in radians - * @return sine of the angle, as if computed by [[java.lang.Math#sin]] + * @return sine of the angle, as if computed by [[java.lang.Math#sin]] * * @group math_funcs * @since 1.4.0 @@ -2018,7 +2015,7 @@ object functions { /** * @param columnName angle in radians - * @return sine of the angle, as if computed by [[java.lang.Math#sin]] + * @return sine of the angle, as if computed by [[java.lang.Math#sin]] * * @group math_funcs * @since 1.4.0 @@ -2027,7 +2024,7 @@ object functions { /** * @param e hyperbolic angle - * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] + * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] * * @group math_funcs * @since 1.4.0 @@ -2036,7 +2033,7 @@ object functions { /** * @param columnName hyperbolic angle - * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] + * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] * * @group math_funcs * @since 1.4.0 @@ -2045,7 +2042,7 @@ object functions { /** * @param e angle in radians - * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] + * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] * * @group math_funcs * @since 1.4.0 @@ -2053,7 +2050,7 @@ object functions { def tan(e: Column): Column = withExpr { Tan(e.expr) } /** - * @param columnName angle in radians + * @param columnName angle in radians * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] * * @group math_funcs @@ -2063,7 +2060,7 @@ object functions { /** * @param e hyperbolic angle - * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] + * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] * * @group math_funcs * @since 1.4.0 @@ -2071,9 +2068,8 @@ 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]] + * @param columnName hyperbolic angle + * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] * * @group math_funcs * @since 1.4.0 @@ -2097,8 +2093,8 @@ 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]] + * @param e angle in radians + * @return angle in degrees, as if computed by [[java.lang.Math#toDegrees]] * * @group math_funcs * @since 2.1.0 @@ -2108,8 +2104,8 @@ 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]] + * @param columnName angle in radians + * @return angle in degrees, as if computed by [[java.lang.Math#toDegrees]] * * @group math_funcs * @since 2.1.0 @@ -2133,8 +2129,8 @@ 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]] + * @param e angle in degrees + * @return angle in radians, as if computed by [[java.lang.Math#toRadians]] * * @group math_funcs * @since 2.1.0 @@ -2144,8 +2140,8 @@ 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]] + * @param columnName angle in degrees + * @return angle in radians, as if computed by [[java.lang.Math#toRadians]] * * @group math_funcs * @since 2.1.0 From 2586b0f25ae0e563374c03d1db37d08aaf0c8c08 Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Tue, 20 Feb 2018 00:11:53 +0100 Subject: [PATCH 03/10] [SPARK-23329][SQL] Fixed formatting of long lines, reverted line break removals --- .../expressions/mathExpressions.scala | 59 ++++++++++++------- 1 file changed, 39 insertions(+), 20 deletions(-) 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 dd89d6faf2834..bfdfc54348c29 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 @@ -168,9 +168,11 @@ case class Pi() extends LeafMathExpression(math.Pi, "PI") //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// -// scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the inverse cosine (a.k.a. arc cosine) of `expr`, as if computed by `java.lang.Math._FUNC_`.", + usage = """ + _FUNC_(expr) - Returns the inverse cosine (a.k.a. arc cosine) of `expr`, as if computed by + `java.lang.Math._FUNC_`. + """, examples = """ Examples: > SELECT _FUNC_(1); @@ -178,12 +180,13 @@ case class Pi() extends LeafMathExpression(math.Pi, "PI") > SELECT _FUNC_(2); NaN """) -// scalastyle:on line.size.limit case class Acos(child: Expression) extends UnaryMathExpression(math.acos, "ACOS") -// scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the inverse sine (a.k.a. arc sine) the arc sin of `expr`, as if computed by `java.lang.Math._FUNC_`.", + usage = """ + _FUNC_(expr) - Returns the inverse sine (a.k.a. arc sine) the arc sin of `expr`, + as if computed by `java.lang.Math._FUNC_`. + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -191,18 +194,18 @@ case class Acos(child: Expression) extends UnaryMathExpression(math.acos, "ACOS" > SELECT _FUNC_(2); NaN """) -// scalastyle:on line.size.limit case class Asin(child: Expression) extends UnaryMathExpression(math.asin, "ASIN") -// scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the inverse tangent (a.k.a. arc tangent) of `expr`, as if computed by `java.lang.Math._FUNC_`.", + usage = """ + _FUNC_(expr) - Returns the inverse tangent (a.k.a. arc tangent) of `expr`, as if computed by + `java.lang.Math._FUNC_` + """, examples = """ Examples: > SELECT _FUNC_(0); 0.0 """) -// scalastyle:on line.size.limit case class Atan(child: Expression) extends UnaryMathExpression(math.atan, "ATAN") @ExpressionDescription( @@ -252,7 +255,10 @@ case class Ceil(child: Expression) extends UnaryMathExpression(math.ceil, "CEIL" } @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the cosine of `expr`, as if computed by `java.lang.Math._FUNC_`.", + usage = """ + _FUNC_(expr) - Returns the cosine of `expr`, as if computed by + `java.lang.Math._FUNC_`. + """, arguments = """ Arguments: @@ -535,9 +541,11 @@ case class Signum(child: Expression) extends UnaryMathExpression(math.signum, "S """) case class Sin(child: Expression) extends UnaryMathExpression(math.sin, "SIN") -// scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns hyperbolic sine of `expr`, as if computed by `java.lang.Math._FUNC_`.", + usage = """ + _FUNC_(expr) - Returns hyperbolic sine of `expr`, as if computed by + `java.lang.Math._FUNC_`. + """, arguments = """ Arguments: @@ -559,9 +567,11 @@ case class Sinh(child: Expression) extends UnaryMathExpression(math.sinh, "SINH" """) case class Sqrt(child: Expression) extends UnaryMathExpression(math.sqrt, "SQRT") -// scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the tangent of `expr`, as if computed by `java.lang.Math._FUNC_`.", + usage = """ + _FUNC_(expr) - Returns the tangent of `expr`, as if computed by + `java.lang.Math._FUNC_`. + """, arguments = """ Arguments: @@ -575,8 +585,10 @@ case class Sqrt(child: Expression) extends UnaryMathExpression(math.sqrt, "SQRT" case class Tan(child: Expression) extends UnaryMathExpression(math.tan, "TAN") @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the cotangent of `expr` ," + - "as if computed by `1/java.lang.Math._FUNC_`.", + usage = """ + _FUNC_(expr) - Returns the cotangent of `expr`, as if computed by + `1/java.lang.Math._FUNC_`. + """, arguments = """ Arguments: @@ -595,7 +607,10 @@ case class Cot(child: Expression) } @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the hyperbolic tangent of `expr`, as if computed by `java.lang.Math._FUNC_`.", + usage = """ + _FUNC_(expr) - Returns the hyperbolic tangent of `expr`, as if computed by + `java.lang.Math._FUNC_`. + """, arguments = """ Arguments: @@ -816,9 +831,12 @@ case class Unhex(child: Expression) extends UnaryExpression with ImplicitCastInp //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// -// scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(exprY, exprX) - Returns the angle in radians between the positive x-axis of a plane and the point given by the coordinates (`exprX`, `exprY`), as if computed by `java.lang.Math._FUNC_`.", + usage = """ + _FUNC_(exprY, exprX) - Returns the angle in radians between the positive x-axis of a plane + and the point given by the coordinates (`exprX`, `exprY`), as if computed by + `java.lang.Math._FUNC_`. + """, arguments = """ Arguments: @@ -830,7 +848,6 @@ case class Unhex(child: Expression) extends UnaryExpression with ImplicitCastInp > SELECT _FUNC_(0, 0); 0.0 """) -// scalastyle:on line.size.limit case class Atan2(left: Expression, right: Expression) extends BinaryMathExpression(math.atan2, "ATAN2") { @@ -858,6 +875,7 @@ case class Pow(left: Expression, right: Expression) } } + /** * Bitwise left shift. * @@ -969,6 +987,7 @@ case class ShiftRightUnsigned(left: Expression, right: Expression) case class Hypot(left: Expression, right: Expression) extends BinaryMathExpression(math.hypot, "HYPOT") + /** * Computes the logarithm of a number. * From 8550a27636a508a4953076691a5b5a36c7e24824 Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Tue, 20 Feb 2018 12:39:35 +0100 Subject: [PATCH 04/10] [SPARK-23329][SQL] Make usage text consistent with other docs, reverted functions.scala changes because it should be updated with functions.py and functions.R --- .../expressions/mathExpressions.scala | 33 ++-- .../org/apache/spark/sql/functions.scala | 160 ++++++------------ 2 files changed, 62 insertions(+), 131 deletions(-) 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 From 40da9982b0d96a661f7dab4126c619e56a600f94 Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Tue, 20 Feb 2018 14:17:35 +0100 Subject: [PATCH 05/10] [SPARK-23329][SQL] Formatting finetunings --- .../expressions/mathExpressions.scala | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) 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 c2178f10aa6bb..816ae9ae74729 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 @@ -262,7 +262,7 @@ case class Ceil(child: Expression) extends UnaryMathExpression(math.ceil, "CEIL" arguments = """ Arguments: * expr - angle in radians - """, + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -271,11 +271,14 @@ case class Ceil(child: Expression) extends UnaryMathExpression(math.ceil, "CEIL" case class Cos(child: Expression) extends UnaryMathExpression(math.cos, "COS") @ExpressionDescription( - usage = "_FUNC_(expr) - Returns the hyperbolic cosine of `expr`.", + usage = """ + _FUNC_(expr) - Returns the hyperbolic cosine of `expr`, as if computed by + `java.lang.Math._FUNC_`. + """, arguments = """ Arguments: - * expr - hyperbolic angle. - """, + * expr - hyperbolic angle + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -530,7 +533,7 @@ case class Signum(child: Expression) extends UnaryMathExpression(math.signum, "S arguments = """ Arguments: * expr - angle in radians - """, + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -545,7 +548,7 @@ case class Sin(child: Expression) extends UnaryMathExpression(math.sin, "SIN") arguments = """ Arguments: * expr - hyperbolic angle - """, + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -564,13 +567,12 @@ case class Sqrt(child: Expression) extends UnaryMathExpression(math.sqrt, "SQRT" @ExpressionDescription( usage = """ - _FUNC_(expr) - Returns the tangent of `expr`, as if computed by - `java.lang.Math._FUNC_`. + _FUNC_(expr) - Returns the tangent of `expr`, as if computed by `java.lang.Math._FUNC_`. """, arguments = """ Arguments: * expr - angle in radians - """, + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -580,13 +582,12 @@ case class Tan(child: Expression) extends UnaryMathExpression(math.tan, "TAN") @ExpressionDescription( usage = """ - _FUNC_(expr) - Returns the cotangent of `expr`, as if computed by - `1/java.lang.Math._FUNC_`. + _FUNC_(expr) - Returns the cotangent of `expr`, as if computed by `1/java.lang.Math._FUNC_`. """, arguments = """ Arguments: * expr - angle in radians - """, + """, examples = """ Examples: > SELECT _FUNC_(1); @@ -607,7 +608,7 @@ case class Cot(child: Expression) arguments = """ Arguments: * expr - hyperbolic angle - """, + """, examples = """ Examples: > SELECT _FUNC_(0); @@ -620,7 +621,7 @@ case class Tanh(child: Expression) extends UnaryMathExpression(math.tanh, "TANH" arguments = """ Arguments: * expr - angle in radians - """, + """, examples = """ Examples: > SELECT _FUNC_(3.141592653589793); @@ -635,7 +636,7 @@ case class ToDegrees(child: Expression) extends UnaryMathExpression(math.toDegre arguments = """ Arguments: * expr - angle in degrees - """, + """, examples = """ Examples: > SELECT _FUNC_(180); @@ -831,7 +832,7 @@ case class Unhex(child: Expression) extends UnaryExpression with ImplicitCastInp Arguments: * exprY - coordinate on y-axis * exprX - coordinate on x-axis - """, + """, examples = """ Examples: > SELECT _FUNC_(0, 0); From 0e4e15a178e7484b2d3706adc8994f226ce0f29a Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Wed, 21 Feb 2018 08:56:51 +0100 Subject: [PATCH 06/10] [SPARK-23329][SQL] Fix documentation of functions.R, functions.scala, functions.py --- R/pkg/R/functions.R | 23 ++- python/pyspark/sql/functions.py | 53 +++--- .../org/apache/spark/sql/functions.scala | 160 ++++++++++++------ 3 files changed, 148 insertions(+), 88 deletions(-) diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R index 9f7c6317cd924..5ea3fd8de760e 100644 --- a/R/pkg/R/functions.R +++ b/R/pkg/R/functions.R @@ -278,8 +278,7 @@ 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}: Computes the inverse cosine of the given value, as if computed by \code{java.lang.Math.acos()} #' #' @rdname column_math_functions #' @export @@ -334,8 +333,7 @@ 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}: Computes the inverse sine of the given value, as if computed by \code{java.lang.Math.asin()} #' #' @rdname column_math_functions #' @export @@ -349,8 +347,7 @@ 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}: Computes the inverse tangent of the given value, as if computed by \code{java.lang.Math.atan()} #' #' @rdname column_math_functions #' @export @@ -613,7 +610,7 @@ setMethod("covar_pop", signature(col1 = "characterOrColumn", col2 = "characterOr }) #' @details -#' \code{cos}: Computes the cosine of the given value. Units in radians. +#' \code{cos}: Computes 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 @@ -627,7 +624,7 @@ setMethod("cos", }) #' @details -#' \code{cosh}: Computes the hyperbolic cosine of the given value. +#' \code{cosh}: Computes 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 @@ -1463,7 +1460,7 @@ setMethod("sign", signature(x = "Column"), }) #' @details -#' \code{sin}: Computes the sine of the given value. Units in radians. +#' \code{sin}: Computes 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 @@ -1477,7 +1474,7 @@ setMethod("sin", }) #' @details -#' \code{sinh}: Computes the hyperbolic sine of the given value. +#' \code{sinh}: Computes 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 @@ -1653,7 +1650,7 @@ setMethod("sumDistinct", }) #' @details -#' \code{tan}: Computes the tangent of the given value. Units in radians. +#' \code{tan}: Computes 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 @@ -1667,7 +1664,7 @@ setMethod("tan", }) #' @details -#' \code{tanh}: Computes the hyperbolic tangent of the given value. +#' \code{tanh}: Computes 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 @@ -1973,7 +1970,7 @@ 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 diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py index 9bb9c323a5a60..6959be116b4c8 100644 --- a/python/pyspark/sql/functions.py +++ b/python/pyspark/sql/functions.py @@ -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.', @@ -127,14 +124,14 @@ 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.', @@ -173,16 +170,24 @@ 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.', } 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 0d54c02c3d06f..4f9eb52c64f41 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,8 +1313,7 @@ object functions { ////////////////////////////////////////////////////////////////////////////////////////////// /** - * Computes the cosine inverse of the given value; the returned angle is in the range - * 0.0 through pi. + * @return inverse cosine of `e` in radians, as if computed by [[java.lang.Math#acos]] * * @group math_funcs * @since 1.4.0 @@ -1322,8 +1321,7 @@ object functions { def acos(e: Column): Column = withExpr { Acos(e.expr) } /** - * Computes the cosine inverse of the given column; the returned angle is in the range - * 0.0 through pi. + * @return inverse cosine of `columnName`, as if computed by [[java.lang.Math#acos]] * * @group math_funcs * @since 1.4.0 @@ -1331,8 +1329,7 @@ object functions { def acos(columnName: String): Column = acos(Column(columnName)) /** - * Computes the sine inverse of the given value; the returned angle is in the range - * -pi/2 through pi/2. + * @return inverse sine of `e` in radians, as if computed by [[java.lang.Math#asin]] * * @group math_funcs * @since 1.4.0 @@ -1340,8 +1337,7 @@ object functions { def asin(e: Column): Column = withExpr { Asin(e.expr) } /** - * Computes the sine inverse of the given column; the returned angle is in the range - * -pi/2 through pi/2. + * @return inverse sine of `columnName`, as if computed by [[java.lang.Math#asin]] * * @group math_funcs * @since 1.4.0 @@ -1349,8 +1345,7 @@ object functions { def asin(columnName: String): Column = asin(Column(columnName)) /** - * Computes the tangent inverse of the given column; the returned angle is in the range - * -pi/2 through pi/2 + * @return inverse tangent of `e`, as if computed by [[java.lang.Math#atan]] * * @group math_funcs * @since 1.4.0 @@ -1358,8 +1353,7 @@ object functions { def atan(e: Column): Column = withExpr { Atan(e.expr) } /** - * Computes the tangent inverse of the given column; the returned angle is in the range - * -pi/2 through pi/2 + * @return inverse tangent of `columnName`, as if computed by [[java.lang.Math#atan]] * * @group math_funcs * @since 1.4.0 @@ -1367,77 +1361,117 @@ object functions { def atan(columnName: String): Column = atan(Column(columnName)) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). Units in radians. + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Column, r: Column): Column = withExpr { Atan2(l.expr, r.expr) } + def atan2(y: Column, x: Column): Column = withExpr { Atan2(y.expr, x.expr) } /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Column, rightName: String): Column = atan2(l, Column(rightName)) + def atan2(y: Column, xName: String): Column = atan2(y, Column(xName)) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(leftName: String, r: Column): Column = atan2(Column(leftName), r) + def atan2(yName: String, x: Column): Column = atan2(Column(yName), x) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(leftName: String, rightName: String): Column = - atan2(Column(leftName), Column(rightName)) + def atan2(yName: String, xName: String): Column = + atan2(Column(yName), Column(xName)) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Column, r: Double): Column = atan2(l, lit(r)) + def atan2(y: Column, xValue: Double): Column = atan2(y, lit(xValue)) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(leftName: String, r: Double): Column = atan2(Column(leftName), r) + def atan2(yName: String, xValue: Double): Column = atan2(Column(yName), xValue) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Double, r: Column): Column = atan2(lit(l), r) + def atan2(yValue: Double, x: Column): Column = atan2(lit(yValue), x) /** - * Returns the angle theta from the conversion of rectangular coordinates (x, y) to - * polar coordinates (r, theta). + * @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]] * * @group math_funcs * @since 1.4.0 */ - def atan2(l: Double, rightName: String): Column = atan2(l, Column(rightName)) + def atan2(yValue: Double, xName: String): Column = atan2(yValue, Column(xName)) /** * An expression that returns the string representation of the binary value of the given long @@ -1500,7 +1534,8 @@ object functions { } /** - * Computes the cosine of the given value. Units in radians. + * @param e angle in radians + * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] * * @group math_funcs * @since 1.4.0 @@ -1508,7 +1543,8 @@ object functions { def cos(e: Column): Column = withExpr { Cos(e.expr) } /** - * Computes the cosine of the given column. + * @param columnName angle in radians + * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] * * @group math_funcs * @since 1.4.0 @@ -1516,7 +1552,8 @@ object functions { def cos(columnName: String): Column = cos(Column(columnName)) /** - * Computes the hyperbolic cosine of the given value. + * @param e hyperbolic angle + * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] * * @group math_funcs * @since 1.4.0 @@ -1524,7 +1561,8 @@ object functions { def cosh(e: Column): Column = withExpr { Cosh(e.expr) } /** - * Computes the hyperbolic cosine of the given column. + * @param columnName hyperbolic angle + * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] * * @group math_funcs * @since 1.4.0 @@ -1967,7 +2005,8 @@ object functions { def signum(columnName: String): Column = signum(Column(columnName)) /** - * Computes the sine of the given value. Units in radians. + * @param e angle in radians + * @return sine of the angle, as if computed by [[java.lang.Math#sin]] * * @group math_funcs * @since 1.4.0 @@ -1975,7 +2014,8 @@ object functions { def sin(e: Column): Column = withExpr { Sin(e.expr) } /** - * Computes the sine of the given column. + * @param columnName angle in radians + * @return sine of the angle, as if computed by [[java.lang.Math#sin]] * * @group math_funcs * @since 1.4.0 @@ -1983,7 +2023,8 @@ object functions { def sin(columnName: String): Column = sin(Column(columnName)) /** - * Computes the hyperbolic sine of the given value. + * @param e hyperbolic angle + * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] * * @group math_funcs * @since 1.4.0 @@ -1991,7 +2032,8 @@ object functions { def sinh(e: Column): Column = withExpr { Sinh(e.expr) } /** - * Computes the hyperbolic sine of the given column. + * @param columnName hyperbolic angle + * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] * * @group math_funcs * @since 1.4.0 @@ -1999,7 +2041,8 @@ object functions { def sinh(columnName: String): Column = sinh(Column(columnName)) /** - * Computes the tangent of the given value. Units in radians. + * @param e angle in radians + * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] * * @group math_funcs * @since 1.4.0 @@ -2007,7 +2050,8 @@ object functions { def tan(e: Column): Column = withExpr { Tan(e.expr) } /** - * Computes the tangent of the given column. + * @param columnName angle in radians + * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] * * @group math_funcs * @since 1.4.0 @@ -2015,7 +2059,8 @@ object functions { def tan(columnName: String): Column = tan(Column(columnName)) /** - * Computes the hyperbolic tangent of the given value. + * @param e hyperbolic angle + * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] * * @group math_funcs * @since 1.4.0 @@ -2023,7 +2068,8 @@ object functions { def tanh(e: Column): Column = withExpr { Tanh(e.expr) } /** - * Computes the hyperbolic tangent of the given column. + * @param columnName hyperbolic angle + * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] * * @group math_funcs * @since 1.4.0 @@ -2047,6 +2093,9 @@ 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 */ @@ -2055,6 +2104,9 @@ 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 */ @@ -2077,6 +2129,9 @@ 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 */ @@ -2085,6 +2140,9 @@ 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 */ @@ -2873,7 +2931,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 @@ -2929,7 +2987,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 From fcf1338a3345c3f57f274f0e9bea813a24fbe581 Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Wed, 28 Feb 2018 10:01:39 -0800 Subject: [PATCH 07/10] [SPARK-23329][SQL] Fixed line length --- R/pkg/R/functions.R | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R index 5ea3fd8de760e..f16af638ef7b3 100644 --- a/R/pkg/R/functions.R +++ b/R/pkg/R/functions.R @@ -278,7 +278,8 @@ setMethod("abs", }) #' @details -#' \code{acos}: Computes the inverse cosine of the given value, as if computed by \code{java.lang.Math.acos()} +#' \code{acos}: Computes the inverse cosine of the given value, +#' as if computed by \code{java.lang.Math.acos()} #' #' @rdname column_math_functions #' @export @@ -333,7 +334,8 @@ setMethod("ascii", }) #' @details -#' \code{asin}: Computes the inverse sine of the given value, as if computed by \code{java.lang.Math.asin()} +#' \code{asin}: Computes the inverse sine of the given value, +#' as if computed by \code{java.lang.Math.asin()} #' #' @rdname column_math_functions #' @export @@ -347,7 +349,8 @@ setMethod("asin", }) #' @details -#' \code{atan}: Computes the inverse tangent of the given value, as if computed by \code{java.lang.Math.atan()} +#' \code{atan}: Computes the inverse tangent of the given value, +#' as if computed by \code{java.lang.Math.atan()} #' #' @rdname column_math_functions #' @export @@ -610,7 +613,8 @@ setMethod("covar_pop", signature(col1 = "characterOrColumn", col2 = "characterOr }) #' @details -#' \code{cos}: Computes the cosine of the given value, as if computed by \code{java.lang.Math.cos()}. Units in radians. +#' \code{cos}: Computes 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 @@ -624,7 +628,8 @@ setMethod("cos", }) #' @details -#' \code{cosh}: Computes the hyperbolic cosine of the given value, as if computed by \code{java.lang.Math.cosh()}. +#' \code{cosh}: Computes 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 @@ -1460,7 +1465,8 @@ setMethod("sign", signature(x = "Column"), }) #' @details -#' \code{sin}: Computes the sine of the given value, as if computed by \code{java.lang.Math.sin()}. Units in radians. +#' \code{sin}: Computes 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 @@ -1474,7 +1480,8 @@ setMethod("sin", }) #' @details -#' \code{sinh}: Computes the hyperbolic sine of the given value, as if computed by \code{java.lang.Math.sinh()}. +#' \code{sinh}: Computes 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 @@ -1650,7 +1657,9 @@ setMethod("sumDistinct", }) #' @details -#' \code{tan}: Computes the tangent of the given value, as if computed by \code{java.lang.Math.tan()}. Units in radians. +#' \code{tan}: Computes 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 @@ -1664,7 +1673,8 @@ setMethod("tan", }) #' @details -#' \code{tanh}: Computes the hyperbolic tangent of the given value, as if computed by \code{java.lang.Math.tanh()}. +#' \code{tanh}: Computes 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 @@ -1970,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), as if computed by \code{java.lang.Math.atan2()}. 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 From 2ea1f18b6c9b5208485c6a007ce4a6366423fbee Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Wed, 28 Feb 2018 13:39:54 -0800 Subject: [PATCH 08/10] [SPARK-23329][SQL] Fixed line length of functions.py --- python/pyspark/sql/functions.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py index 6959be116b4c8..765a03ff27b5b 100644 --- a/python/pyspark/sql/functions.py +++ b/python/pyspark/sql/functions.py @@ -127,11 +127,13 @@ def _(): '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()`""", + :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()`""", + :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.', @@ -170,7 +172,7 @@ def _(): _functions_2_1 = { # unary math functions - 'degrees': """Converts an angle measured in radians to an approximately equivalent angle + '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()`""", From 10afda5d97146af7e02cc3b18968f89f074e093c Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Thu, 1 Mar 2018 15:06:34 -0800 Subject: [PATCH 09/10] [SPARK-23329][SQL] Fixed python style problem --- R/pkg/R/functions.R | 18 +++++++++--------- python/pyspark/sql/functions.py | 16 +++++++++------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R index f16af638ef7b3..29ee146ab14f9 100644 --- a/R/pkg/R/functions.R +++ b/R/pkg/R/functions.R @@ -278,7 +278,7 @@ setMethod("abs", }) #' @details -#' \code{acos}: Computes the inverse cosine of the given value, +#' \code{acos}: Returns the inverse cosine of the given value, #' as if computed by \code{java.lang.Math.acos()} #' #' @rdname column_math_functions @@ -334,7 +334,7 @@ setMethod("ascii", }) #' @details -#' \code{asin}: Computes the inverse sine of the given value, +#' \code{asin}: Returns the inverse sine of the given value, #' as if computed by \code{java.lang.Math.asin()} #' #' @rdname column_math_functions @@ -349,7 +349,7 @@ setMethod("asin", }) #' @details -#' \code{atan}: Computes the inverse tangent of the given value, +#' \code{atan}: Returns the inverse tangent of the given value, #' as if computed by \code{java.lang.Math.atan()} #' #' @rdname column_math_functions @@ -613,7 +613,7 @@ setMethod("covar_pop", signature(col1 = "characterOrColumn", col2 = "characterOr }) #' @details -#' \code{cos}: Computes the cosine of the given value, +#' \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 @@ -628,7 +628,7 @@ 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 @@ -1465,7 +1465,7 @@ setMethod("sign", signature(x = "Column"), }) #' @details -#' \code{sin}: Computes the sine of the given value, +#' \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 @@ -1480,7 +1480,7 @@ 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 @@ -1657,7 +1657,7 @@ setMethod("sumDistinct", }) #' @details -#' \code{tan}: Computes the tangent of the given value, +#' \code{tan}: Returns the tangent of the given value, #' as if computed by \code{java.lang.Math.tan()}. #' Units in radians. #' @@ -1673,7 +1673,7 @@ 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 diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py index 765a03ff27b5b..0e9dd04ec5372 100644 --- a/python/pyspark/sql/functions.py +++ b/python/pyspark/sql/functions.py @@ -128,12 +128,12 @@ def _(): :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()`""", + 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()`""", + 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.', @@ -183,13 +183,15 @@ def _(): # math functions that take two arguments as input _binary_mathfunctions = { - 'atan2': """:param col1: coordinate on y-axis + '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()`""", + (`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.', } From 627e204ed03cfd6caa06e8f64dc605b62f4d2e5e Mon Sep 17 00:00:00 2001 From: Mihaly Toth Date: Fri, 2 Mar 2018 15:49:06 -0800 Subject: [PATCH 10/10] [SPARK-23329][SQL] Formatting fixes, changed scaladoc references --- python/pyspark/sql/functions.py | 13 ++- .../org/apache/spark/sql/functions.scala | 92 +++++++++---------- 2 files changed, 55 insertions(+), 50 deletions(-) diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py index 0e9dd04ec5372..b9c0c57262c5d 100644 --- a/python/pyspark/sql/functions.py +++ b/python/pyspark/sql/functions.py @@ -172,13 +172,18 @@ def _(): _functions_2_1 = { # unary math functions - 'degrees': """Converts an angle measured in radians to an approximately equivalent angle + '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. + :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()`""", + :return: angle in radians, as if computed by `java.lang.Math.toRadians()` + """, } # math functions that take two arguments as input 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 4f9eb52c64f41..c9ca9a8996344 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,7 @@ object functions { ////////////////////////////////////////////////////////////////////////////////////////////// /** - * @return inverse cosine of `e` in radians, as if computed by [[java.lang.Math#acos]] + * @return inverse cosine of `e` in radians, as if computed by `java.lang.Math.acos` * * @group math_funcs * @since 1.4.0 @@ -1321,7 +1321,7 @@ object functions { def acos(e: Column): Column = withExpr { Acos(e.expr) } /** - * @return inverse cosine of `columnName`, as if computed by [[java.lang.Math#acos]] + * @return inverse cosine of `columnName`, as if computed by `java.lang.Math.acos` * * @group math_funcs * @since 1.4.0 @@ -1329,7 +1329,7 @@ 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]] + * @return inverse sine of `e` in radians, as if computed by `java.lang.Math.asin` * * @group math_funcs * @since 1.4.0 @@ -1337,7 +1337,7 @@ object functions { def asin(e: Column): Column = withExpr { Asin(e.expr) } /** - * @return inverse sine of `columnName`, as if computed by [[java.lang.Math#asin]] + * @return inverse sine of `columnName`, as if computed by `java.lang.Math.asin` * * @group math_funcs * @since 1.4.0 @@ -1345,7 +1345,7 @@ object functions { def asin(columnName: String): Column = asin(Column(columnName)) /** - * @return inverse tangent of `e`, as if computed by [[java.lang.Math#atan]] + * @return inverse tangent of `e`, as if computed by `java.lang.Math.atan` * * @group math_funcs * @since 1.4.0 @@ -1353,7 +1353,7 @@ object functions { def atan(e: Column): Column = withExpr { Atan(e.expr) } /** - * @return inverse tangent of `columnName`, as if computed by [[java.lang.Math#atan]] + * @return inverse tangent of `columnName`, as if computed by `java.lang.Math.atan` * * @group math_funcs * @since 1.4.0 @@ -1364,10 +1364,10 @@ object functions { * @param y coordinate on y-axis * @param x coordinate on x-axis * @return the theta component of the point - * (rtheta) + * (r, theta) * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * (x, y) in Cartesian coordinates, + * as if computed by `java.lang.Math.atan2` * * @group math_funcs * @since 1.4.0 @@ -1378,10 +1378,10 @@ object functions { * @param y coordinate on y-axis * @param xName coordinate on x-axis * @return the theta component of the point - * (rtheta) + * (r, theta) * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * (x, y) in Cartesian coordinates, + * as if computed by `java.lang.Math.atan2` * * @group math_funcs * @since 1.4.0 @@ -1392,10 +1392,10 @@ object functions { * @param yName coordinate on y-axis * @param x coordinate on x-axis * @return the theta component of the point - * (rtheta) + * (r, theta) * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * (x, y) in Cartesian coordinates, + * as if computed by `java.lang.Math.atan2` * * @group math_funcs * @since 1.4.0 @@ -1406,10 +1406,10 @@ object functions { * @param yName coordinate on y-axis * @param xName coordinate on x-axis * @return the theta component of the point - * (rtheta) + * (r, theta) * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * (x, y) in Cartesian coordinates, + * as if computed by `java.lang.Math.atan2` * * @group math_funcs * @since 1.4.0 @@ -1421,10 +1421,10 @@ object functions { * @param y coordinate on y-axis * @param xValue coordinate on x-axis * @return the theta component of the point - * (rtheta) + * (r, theta) * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * (x, y) in Cartesian coordinates, + * as if computed by `java.lang.Math.atan2` * * @group math_funcs * @since 1.4.0 @@ -1435,10 +1435,10 @@ object functions { * @param yName coordinate on y-axis * @param xValue coordinate on x-axis * @return the theta component of the point - * (rtheta) + * (r, theta) * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * (x, y) in Cartesian coordinates, + * as if computed by `java.lang.Math.atan2` * * @group math_funcs * @since 1.4.0 @@ -1449,10 +1449,10 @@ object functions { * @param yValue coordinate on y-axis * @param x coordinate on x-axis * @return the theta component of the point - * (rtheta) + * (r, theta) * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * (x, y) in Cartesian coordinates, + * as if computed by `java.lang.Math.atan2` * * @group math_funcs * @since 1.4.0 @@ -1463,10 +1463,10 @@ object functions { * @param yValue coordinate on y-axis * @param xName coordinate on x-axis * @return the theta component of the point - * (rtheta) + * (r, theta) * in polar coordinates that corresponds to the point - * (xy) in Cartesian coordinates, - * as if computed by [[java.lang.Math#atan2]] + * (x, y) in Cartesian coordinates, + * as if computed by `java.lang.Math.atan2` * * @group math_funcs * @since 1.4.0 @@ -1535,7 +1535,7 @@ object functions { /** * @param e angle in radians - * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] + * @return cosine of the angle, as if computed by `java.lang.Math.cos` * * @group math_funcs * @since 1.4.0 @@ -1544,7 +1544,7 @@ object functions { /** * @param columnName angle in radians - * @return cosine of the angle, as if computed by [[java.lang.Math#cos]] + * @return cosine of the angle, as if computed by `java.lang.Math.cos` * * @group math_funcs * @since 1.4.0 @@ -1553,7 +1553,7 @@ object functions { /** * @param e hyperbolic angle - * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] + * @return hyperbolic cosine of the angle, as if computed by `java.lang.Math.cosh` * * @group math_funcs * @since 1.4.0 @@ -1562,7 +1562,7 @@ object functions { /** * @param columnName hyperbolic angle - * @return hyperbolic cosine of the angle, as if computed by [[java.lang.Math#cosh]] + * @return hyperbolic cosine of the angle, as if computed by `java.lang.Math.cosh` * * @group math_funcs * @since 1.4.0 @@ -2006,7 +2006,7 @@ object functions { /** * @param e angle in radians - * @return sine of the angle, as if computed by [[java.lang.Math#sin]] + * @return sine of the angle, as if computed by `java.lang.Math.sin` * * @group math_funcs * @since 1.4.0 @@ -2015,7 +2015,7 @@ object functions { /** * @param columnName angle in radians - * @return sine of the angle, as if computed by [[java.lang.Math#sin]] + * @return sine of the angle, as if computed by `java.lang.Math.sin` * * @group math_funcs * @since 1.4.0 @@ -2024,7 +2024,7 @@ object functions { /** * @param e hyperbolic angle - * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] + * @return hyperbolic sine of the given value, as if computed by `java.lang.Math.sinh` * * @group math_funcs * @since 1.4.0 @@ -2033,7 +2033,7 @@ object functions { /** * @param columnName hyperbolic angle - * @return hyperbolic sine of the given value, as if computed by [[java.lang.Math#sinh]] + * @return hyperbolic sine of the given value, as if computed by `java.lang.Math.sinh` * * @group math_funcs * @since 1.4.0 @@ -2042,7 +2042,7 @@ object functions { /** * @param e angle in radians - * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] + * @return tangent of the given value, as if computed by `java.lang.Math.tan` * * @group math_funcs * @since 1.4.0 @@ -2051,7 +2051,7 @@ object functions { /** * @param columnName angle in radians - * @return tangent of the given value, as if computed by [[java.lang.Math#tan]] + * @return tangent of the given value, as if computed by `java.lang.Math.tan` * * @group math_funcs * @since 1.4.0 @@ -2060,7 +2060,7 @@ object functions { /** * @param e hyperbolic angle - * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] + * @return hyperbolic tangent of the given value, as if computed by `java.lang.Math.tanh` * * @group math_funcs * @since 1.4.0 @@ -2069,7 +2069,7 @@ object functions { /** * @param columnName hyperbolic angle - * @return hyperbolic tangent of the given value, as if computed by [[java.lang.Math#tanh]] + * @return hyperbolic tangent of the given value, as if computed by `java.lang.Math.tanh` * * @group math_funcs * @since 1.4.0 @@ -2094,7 +2094,7 @@ 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]] + * @return angle in degrees, as if computed by `java.lang.Math.toDegrees` * * @group math_funcs * @since 2.1.0 @@ -2105,7 +2105,7 @@ 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]] + * @return angle in degrees, as if computed by `java.lang.Math.toDegrees` * * @group math_funcs * @since 2.1.0 @@ -2130,7 +2130,7 @@ 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]] + * @return angle in radians, as if computed by `java.lang.Math.toRadians` * * @group math_funcs * @since 2.1.0 @@ -2141,7 +2141,7 @@ 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]] + * @return angle in radians, as if computed by `java.lang.Math.toRadians` * * @group math_funcs * @since 2.1.0