Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[SPARK-23329][SQL] Formatting fixes, changed scaladoc references
  • Loading branch information
misutoth committed Mar 2, 2018
commit 627e204ed03cfd6caa06e8f64dc605b62f4d2e5e
13 changes: 9 additions & 4 deletions python/pyspark/sql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a newline here. Seems doc could be broken.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

: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
Expand Down
92 changes: 46 additions & 46 deletions sql/core/src/main/scala/org/apache/spark/sql/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1313,47 +1313,47 @@ 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
*/
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
*/
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
*/
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
*/
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
*/
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
Expand All @@ -1364,10 +1364,10 @@ object functions {
* @param y coordinate on y-axis
* @param x coordinate on x-axis
* @return the <i>theta</i> component of the point
* (<i>r</i>,&nbsp;<i>theta</i>)
* (<i>r</i>, <i>theta</i>)
* in polar coordinates that corresponds to the point
* (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates,
* as if computed by [[java.lang.Math#atan2]]
* (<i>x</i>, <i>y</i>) in Cartesian coordinates,
* as if computed by `java.lang.Math.atan2`
*
* @group math_funcs
* @since 1.4.0
Expand All @@ -1378,10 +1378,10 @@ object functions {
* @param y coordinate on y-axis
* @param xName coordinate on x-axis
* @return the <i>theta</i> component of the point
* (<i>r</i>,&nbsp;<i>theta</i>)
* (<i>r</i>, <i>theta</i>)
* in polar coordinates that corresponds to the point
* (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates,
* as if computed by [[java.lang.Math#atan2]]
* (<i>x</i>, <i>y</i>) in Cartesian coordinates,
* as if computed by `java.lang.Math.atan2`
*
* @group math_funcs
* @since 1.4.0
Expand All @@ -1392,10 +1392,10 @@ object functions {
* @param yName coordinate on y-axis
* @param x coordinate on x-axis
* @return the <i>theta</i> component of the point
* (<i>r</i>,&nbsp;<i>theta</i>)
* (<i>r</i>, <i>theta</i>)
* in polar coordinates that corresponds to the point
* (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates,
* as if computed by [[java.lang.Math#atan2]]
* (<i>x</i>, <i>y</i>) in Cartesian coordinates,
* as if computed by `java.lang.Math.atan2`
*
* @group math_funcs
* @since 1.4.0
Expand All @@ -1406,10 +1406,10 @@ object functions {
* @param yName coordinate on y-axis
* @param xName coordinate on x-axis
* @return the <i>theta</i> component of the point
* (<i>r</i>,&nbsp;<i>theta</i>)
* (<i>r</i>, <i>theta</i>)
* in polar coordinates that corresponds to the point
* (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates,
* as if computed by [[java.lang.Math#atan2]]
* (<i>x</i>, <i>y</i>) in Cartesian coordinates,
* as if computed by `java.lang.Math.atan2`
*
* @group math_funcs
* @since 1.4.0
Expand All @@ -1421,10 +1421,10 @@ object functions {
* @param y coordinate on y-axis
* @param xValue coordinate on x-axis
* @return the <i>theta</i> component of the point
* (<i>r</i>,&nbsp;<i>theta</i>)
* (<i>r</i>, <i>theta</i>)
* in polar coordinates that corresponds to the point
* (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates,
* as if computed by [[java.lang.Math#atan2]]
* (<i>x</i>, <i>y</i>) in Cartesian coordinates,
* as if computed by `java.lang.Math.atan2`
*
* @group math_funcs
* @since 1.4.0
Expand All @@ -1435,10 +1435,10 @@ object functions {
* @param yName coordinate on y-axis
* @param xValue coordinate on x-axis
* @return the <i>theta</i> component of the point
* (<i>r</i>,&nbsp;<i>theta</i>)
* (<i>r</i>, <i>theta</i>)
* in polar coordinates that corresponds to the point
* (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates,
* as if computed by [[java.lang.Math#atan2]]
* (<i>x</i>, <i>y</i>) in Cartesian coordinates,
* as if computed by `java.lang.Math.atan2`
*
* @group math_funcs
* @since 1.4.0
Expand All @@ -1449,10 +1449,10 @@ object functions {
* @param yValue coordinate on y-axis
* @param x coordinate on x-axis
* @return the <i>theta</i> component of the point
* (<i>r</i>,&nbsp;<i>theta</i>)
* (<i>r</i>, <i>theta</i>)
* in polar coordinates that corresponds to the point
* (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates,
* as if computed by [[java.lang.Math#atan2]]
* (<i>x</i>, <i>y</i>) in Cartesian coordinates,
* as if computed by `java.lang.Math.atan2`
*
* @group math_funcs
* @since 1.4.0
Expand All @@ -1463,10 +1463,10 @@ object functions {
* @param yValue coordinate on y-axis
* @param xName coordinate on x-axis
* @return the <i>theta</i> component of the point
* (<i>r</i>,&nbsp;<i>theta</i>)
* (<i>r</i>, <i>theta</i>)
* in polar coordinates that corresponds to the point
* (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates,
* as if computed by [[java.lang.Math#atan2]]
* (<i>x</i>, <i>y</i>) in Cartesian coordinates,
* as if computed by `java.lang.Math.atan2`
*
* @group math_funcs
* @since 1.4.0
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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]]
Copy link
Member

@HyukjinKwon HyukjinKwon Feb 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, but the @param and @return were fine .. I thought a doc like:

  * Computes the hyperbolic tangent of the given value.  
  *
  * @param e hyperbolic angle
  * @return hyperbolic tangent computed by [[java.lang.Math#tanh]]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way the description and the return value text would be redundant. For this reason it was proposed during the discussion of the issue to keep only the @return part.

* @return hyperbolic tangent of the given value, as if computed by `java.lang.Math.tanh`
*
* @group math_funcs
* @since 1.4.0
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down