You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2016/04/08 02:18:25 UTC

[jira] [Updated] (SPARK-14415) All functions should show usages by command `DESC FUNCTION`

     [ https://issues.apache.org/jira/browse/SPARK-14415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dongjoon Hyun updated SPARK-14415:
----------------------------------
    Description: 
Currently, many functions do now show usages like the followings.
{code}
scala> sql("desc function extended `sin`").collect().foreach(println)
[Function: sin]
[Class: org.apache.spark.sql.catalyst.expressions.Sin]
[Usage: To be added.]
[Extended Usage:
To be added.]
{code}

This PR adds descriptions for functions and adds a testcase prevent adding function without usage.
{code}
scala>  sql("desc function extended `sin`").collect().foreach(println);
[Function: sin]
[Class: org.apache.spark.sql.catalyst.expressions.Sin]
[Usage: sin(x) - Returns the sine of x.]
[Extended Usage:
> SELECT sin(0);
 0.0]
{code}

The only exceptions are `cube`, `grouping`, `grouping_id`, `rollup`, `window`.

  was:
For Spark SQL, this issue aims to show the following function (expression) description properly by adding `ExpressionDescription` annotation.

*Functions*
abs
acos
asin
atan
atan2
ascii
base64
bin
ceil
ceiling
concat
concat_ws
conv
cos
cosh
decode
degrees
e
encode
exp
expm1
hex
hypot
factorial
find_in_set
floor
format_number
format_string
instr
length
levenshtein
locate
log
log2
log10
log1p
lpad
ltrim
pi
pmod
pow
power
radians
repeat
reverse
round
rpad
rtrim
shiftleft
shiftright
shiftrightunsigned
signum
sin
sinh
soundex
sqrt
substr
substring
substring_index
tan
tanh
translate
trim
unbase64
unhex

*Files*
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala

*Before*
{code}
scala> sql("desc function extended `sin`").collect().foreach(println)
[Function: sin]
[Class: org.apache.spark.sql.catalyst.expressions.Sin]
[Usage: To be added.]
[Extended Usage:
To be added.]
{code}

*After*
{code}
scala>  sql("desc function extended `sin`").collect().foreach(println);
[Function: sin]
[Class: org.apache.spark.sql.catalyst.expressions.Sin]
[Usage: sin(x) - Returns the sine of x.]
[Extended Usage:
> SELECT sin(0);
 0.0]
{code}

        Summary: All functions should show usages by command `DESC FUNCTION`  (was: Add ExpressionDescription annotation for SQL expressions)

> All functions should show usages by command `DESC FUNCTION`
> -----------------------------------------------------------
>
>                 Key: SPARK-14415
>                 URL: https://issues.apache.org/jira/browse/SPARK-14415
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Dongjoon Hyun
>
> Currently, many functions do now show usages like the followings.
> {code}
> scala> sql("desc function extended `sin`").collect().foreach(println)
> [Function: sin]
> [Class: org.apache.spark.sql.catalyst.expressions.Sin]
> [Usage: To be added.]
> [Extended Usage:
> To be added.]
> {code}
> This PR adds descriptions for functions and adds a testcase prevent adding function without usage.
> {code}
> scala>  sql("desc function extended `sin`").collect().foreach(println);
> [Function: sin]
> [Class: org.apache.spark.sql.catalyst.expressions.Sin]
> [Usage: sin(x) - Returns the sine of x.]
> [Extended Usage:
> > SELECT sin(0);
>  0.0]
> {code}
> The only exceptions are `cube`, `grouping`, `grouping_id`, `rollup`, `window`.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org