Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 29.4k
[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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
5f70b1d77abafa8cd6d80261457229d0262710c68e1d44ec378b1fc7e2062afe9672db9baa847fff85f6246277510892fb45e7f991d69e409b24e78ed1c83915351868efee7ea111d2aa8ddcc299b5658a29472e73ccda0d927bff91d2ab5784186001eecfe1979d92d56ac668a773d4f71e39ecaa71c85163a87f8d11aada40f85feafdc22656c6215c02ca035baefc55ecb6ad7b71d3965d00498d69c400cee52b437feFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
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. | ||
MemberAuthor 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>SELECTcount(array(1)), count(struct(1)), count(map(1,1));
111 | ||
| """) | ||
| // 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. | ||
MemberAuthor 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. | ||
MemberAuthor 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));
111 | ||
| 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. | ||
MemberAuthor 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. | ||
| """) | ||
MemberAuthor 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. SELECTmax(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. | ||
| """) | ||
MemberAuthor 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>SELECTmin(array(1)), min(struct(1));
[1] {"col1":1} | ||
| case class Min(child: Expression) extends DeclarativeAggregate { | ||
| override def children: Seq[Expression] = child :: Nil | ||
Uh oh!
There was an error while loading. Please reload this page.
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.