aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgatorsmile <gatorsmile@gmail.com>2016-04-19 10:33:40 -0700
committerReynold Xin <rxin@databricks.com>2016-04-19 10:33:40 -0700
commitd9620e769e41541347db863907bdbd057db50823 (patch)
tree5a2d30c967613d77165f34b308ec3a8feb17f412
parente89633605ea14547dcece35a7e12a9f0f78c5181 (diff)
downloadspark-d9620e769e41541347db863907bdbd057db50823.tar.gz
spark-d9620e769e41541347db863907bdbd057db50823.tar.bz2
spark-d9620e769e41541347db863907bdbd057db50823.zip
[SPARK-12457] Fixed the Wrong Description and Missing Example in Collection Functions
#### What changes were proposed in this pull request? https://github.com/apache/spark/pull/12185 contains the original PR I submitted in https://github.com/apache/spark/pull/10418 However, it misses one of the extended example, a wrong description and a few typos for collection functions. This PR is fix all these issues. #### How was this patch tested? The existing test cases already cover it. Author: gatorsmile <gatorsmile@gmail.com> Closes #12492 from gatorsmile/expressionUpdate.
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala9
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/commands.scala4
2 files changed, 7 insertions, 6 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
index 864288394e..c71cb73d65 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
@@ -27,7 +27,8 @@ import org.apache.spark.sql.types._
* Given an array or map, returns its size.
*/
@ExpressionDescription(
- usage = "_FUNC_(expr) - Returns the size of an array or a map.")
+ usage = "_FUNC_(expr) - Returns the size of an array or a map.",
+ extended = " > SELECT _FUNC_(array('b', 'd', 'c', 'a'));\n 4")
case class Size(child: Expression) extends UnaryExpression with ExpectsInputTypes {
override def dataType: DataType = IntegerType
override def inputTypes: Seq[AbstractDataType] = Seq(TypeCollection(ArrayType, MapType))
@@ -48,8 +49,8 @@ case class Size(child: Expression) extends UnaryExpression with ExpectsInputType
*/
// scalastyle:off line.size.limit
@ExpressionDescription(
- usage = "_FUNC_(array(obj1, obj2,...)) - Sorts the input array in ascending order according to the natural ordering of the array elements.",
- extended = " > SELECT _FUNC_(array('b', 'd', 'c', 'a'));\n 'a', 'b', 'c', 'd'")
+ usage = "_FUNC_(array(obj1, obj2, ...), ascendingOrder) - Sorts the input array in ascending order according to the natural ordering of the array elements.",
+ extended = " > SELECT _FUNC_(array('b', 'd', 'c', 'a'), true);\n 'a', 'b', 'c', 'd'")
// scalastyle:on line.size.limit
case class SortArray(base: Expression, ascendingOrder: Expression)
extends BinaryExpression with ExpectsInputTypes with CodegenFallback {
@@ -133,7 +134,7 @@ case class SortArray(base: Expression, ascendingOrder: Expression)
* Checks if the array (left) has the element (right)
*/
@ExpressionDescription(
- usage = "_FUNC_(array, value) - Returns TRUE if the array contains value.",
+ usage = "_FUNC_(array, value) - Returns TRUE if the array contains the value.",
extended = " > SELECT _FUNC_(array(1, 2, 3), 2);\n true")
case class ArrayContains(left: Expression, right: Expression)
extends BinaryExpression with ImplicitCastInputTypes {
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/commands.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/commands.scala
index 47b34d1fa2..fcffdbaaf0 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/commands.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/commands.scala
@@ -28,9 +28,9 @@ import org.apache.spark.sql.types.StringType
trait Command
/**
- * Returned for the "DESCRIBE [EXTENDED] FUNCTION functionName" command.
+ * Returned for the "DESCRIBE FUNCTION [EXTENDED] functionName" command.
* @param functionName The function to be described.
- * @param isExtended True if "DESCRIBE EXTENDED" is used. Otherwise, false.
+ * @param isExtended True if "DESCRIBE FUNCTION EXTENDED" is used. Otherwise, false.
*/
private[sql] case class DescribeFunction(
functionName: String,