-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17963][SQL][Documentation] Add examples (extend) in each expression and improve documentation with arguments #15513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5f70b1d
77abafa
8cd6d80
2614572
29d0262
710c68e
1d44ec3
78b1fc7
e2062af
e9672db
9baa847
fff85f6
2462775
10892fb
45e7f99
1d69e40
9b24e78
ed1c839
1535186
8efee7e
a111d2a
a8ddcc2
99b5658
a29472e
73ccda0
d927bff
91d2ab5
7841860
01eecfe
1979d92
d56ac66
8a773d4
f71e39e
caa71c8
5163a87
f8d11aa
da40f85
feafdc2
2656c62
15c02ca
035baef
c55ecb6
ad7b71d
3965d00
498d69c
400cee5
2b437fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,9 +23,17 @@ import org.apache.spark.sql.types._ | |
|
|
||
| // scalastyle:off line.size.limit | ||
| @ExpressionDescription( | ||
| usage = """_FUNC_(*) - Returns the total number of retrieved rows, including rows containing NULL values. | ||
| _FUNC_(expr) - Returns the number of rows for which the supplied expression is non-NULL. | ||
| _FUNC_(DISTINCT expr[, expr...]) - Returns the number of rows for which the supplied expression(s) are unique and non-NULL.""") | ||
| usage = """ | ||
| _FUNC_(*) - Returns the total number of retrieved rows, including rows containing null. | ||
|
|
||
| _FUNC_(expr) - Returns the number of rows for which the supplied expression is non-null. | ||
|
|
||
| _FUNC_(DISTINCT expr[, expr...]) - Returns the number of rows for which the supplied expression(s) are unique and non-null. | ||
| """, | ||
| extended = """ | ||
| Arguments: | ||
| expr - an expression of any type that represents data to count. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spark-sql> SELECT count(array(1)), count(struct(1)), count(map(1,1));
1 1 1 |
||
| """) | ||
| // scalastyle:on line.size.limit | ||
| case class Count(children: Seq[Expression]) extends DeclarativeAggregate { | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,10 +29,16 @@ import org.apache.spark.sql.types._ | |
| * a single partition, and we use a single reducer to do the aggregation.). | ||
| */ | ||
| @ExpressionDescription( | ||
| usage = """_FUNC_(expr) - Returns the first value of `child` for a group of rows. | ||
| _FUNC_(expr,isIgnoreNull=false) - Returns the first value of `child` for a group of rows. | ||
| If isIgnoreNull is true, returns only non-null values. | ||
| """) | ||
| usage = """ | ||
| _FUNC_(expr[, isIgnoreNull]) - Returns the first value of `expr` for a group of rows. | ||
| If `isIgnoreNull` is true, returns only non-null values. | ||
| """, | ||
| extended = """ | ||
| Arguments: | ||
| expr - an expression of any type that represents data to collect the first. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spark-sql> SELECT first(array(1)), first(struct(1)), first(map(1,1));
[1] {"col1":1} {1:1} |
||
| isIgnoreNull - a boolean literal. If `isIgnoreNull` is true, returns only non-null | ||
| values. Default is false. | ||
| """) | ||
| case class First(child: Expression, ignoreNullsExpr: Expression) extends DeclarativeAggregate { | ||
|
|
||
| def this(child: Expression) = this(child, Literal.create(false, BooleanType)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,10 +47,16 @@ import org.apache.spark.sql.types._ | |
| */ | ||
| // scalastyle:on | ||
| @ExpressionDescription( | ||
| usage = """_FUNC_(expr) - Returns the estimated cardinality by HyperLogLog++. | ||
| _FUNC_(expr, relativeSD=0.05) - Returns the estimated cardinality by HyperLogLog++ | ||
| with relativeSD, the maximum estimation error allowed. | ||
| """) | ||
| usage = """ | ||
| _FUNC_(expr[, relativeSD]) - Returns the estimated cardinality by HyperLogLog++. | ||
| `relativeSD` defines the maximum estimation error allowed. | ||
| """, | ||
| extended = """ | ||
| Arguments: | ||
| expr - an expression of any type that represents data to count. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spark-sql> SELECT approx_count_distinct(array(1)), approx_count_distinct(struct(1)), approx_count_distinct(map(1,1));
1 1 1 |
||
| relativeSD - a double or decimal literal that defines the maximum estimation error allowed. | ||
| Default is 0.05. | ||
| """) | ||
| case class HyperLogLogPlusPlus( | ||
| child: Expression, | ||
| relativeSD: Double = 0.05, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,16 @@ import org.apache.spark.sql.types._ | |
| * a single partition, and we use a single reducer to do the aggregation.). | ||
| */ | ||
| @ExpressionDescription( | ||
| usage = "_FUNC_(expr,isIgnoreNull) - Returns the last value of `child` for a group of rows.") | ||
| usage = """ | ||
| _FUNC_(expr[, isIgnoreNull]) - Returns the last value of `expr` for a group of rows. | ||
| If `isIgnoreNull` is true, returns only non-null values. | ||
| """, | ||
| extended = """ | ||
| Arguments: | ||
| expr - an expression of any type that represents data to collect the last. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spark-sql> SELECT last(array(1)), last(struct(1)), last(map(1,1));
[1] {"col1":1} {1:1} |
||
| isIgnoreNull - a boolean literal. If `isIgnoreNull` is true, returns only non-null | ||
| values. Default is false. | ||
| """) | ||
| case class Last(child: Expression, ignoreNullsExpr: Expression) extends DeclarativeAggregate { | ||
|
|
||
| def this(child: Expression) = this(child, Literal.create(false, BooleanType)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,11 @@ import org.apache.spark.sql.catalyst.util.TypeUtils | |
| import org.apache.spark.sql.types._ | ||
|
|
||
| @ExpressionDescription( | ||
| usage = "_FUNC_(expr) - Returns the maximum value of expr.") | ||
| usage = "_FUNC_(expr) - Returns the maximum value of `expr`.", | ||
| extended = """ | ||
| Arguments: | ||
| expr - an expression of any type except map. | ||
| """) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SELECT max(array(1)), max(struct(1));
[1] {"col1":1} |
||
| case class Max(child: Expression) extends DeclarativeAggregate { | ||
|
|
||
| override def children: Seq[Expression] = child :: Nil | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,11 @@ import org.apache.spark.sql.catalyst.util.TypeUtils | |
| import org.apache.spark.sql.types._ | ||
|
|
||
| @ExpressionDescription( | ||
| usage = "_FUNC_(expr) - Returns the minimum value of expr.") | ||
| usage = "_FUNC_(expr) - Returns the minimum value of `expr`.", | ||
| extended = """ | ||
| Arguments: | ||
| expr - an expression of any type except map. | ||
| """) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spark-sql> SELECT min(array(1)), min(struct(1));
[1] {"col1":1} |
||
| case class Min(child: Expression) extends DeclarativeAggregate { | ||
|
|
||
| override def children: Seq[Expression] = child :: Nil | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.