yaooqinn commented on code in PR #47547: URL: https://github.com/apache/spark/pull/47547#discussion_r1699980200
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala: ########## @@ -1025,33 +1024,89 @@ case class MapSort(base: Expression) } /** - * Common base class for [[SortArray]] and [[ArraySort]]. + * Sorts the input array in ascending / descending order according to the natural ordering of + * the array elements and returns it. */ -trait ArraySortLike extends ExpectsInputTypes { - protected def arrayExpression: Expression +// scalastyle:off line.size.limit +@ExpressionDescription( + usage = """ + _FUNC_(array[, ascendingOrder]) - Sorts the input array in ascending or descending order + according to the natural ordering of the array elements. NaN is greater than any non-NaN + elements for double/float type. Null elements will be placed at the beginning of the returned + array in ascending order or at the end of the returned array in descending order. + """, + examples = """ + Examples: + > SELECT _FUNC_(array('b', 'd', null, 'c', 'a'), true); + [null,"a","b","c","d"] Review Comment: ```suggestion > SELECT _FUNC_(array('b', 'd', null, 'c', 'a'), true); [null,"a","b","c","d"] > SELECT _FUNC_(array('b', 'd', null, 'c', 'a'), false); ["d","c","b","a",null] ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org