ueshin commented on a change in pull request #25728: [SPARK-29020][SQL] 
Improving array_sort behaviour
URL: https://github.com/apache/spark/pull/25728#discussion_r322484187
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
 ##########
 @@ -902,33 +902,45 @@ case class SortArray(base: Expression, ascendingOrder: 
Expression)
 
 
 /**
- * Sorts the input array in ascending order according to the natural ordering 
of
+ * Sorts the input array in ascending / descending order according to the 
natural ordering of
  * the array elements and returns it.
  */
-// scalastyle:off line.size.limit
+// scalastyle:on line.size.limit
 @ExpressionDescription(
   usage = """
     _FUNC_(array) - Sorts the input array in ascending order. The elements of 
the input array must
-      be orderable. Null elements will be placed at the end of the returned 
array.
+      be orderable. 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'));
-       ["a","b","c","d",null]
+       [null,"a","b","c","d"]
 
 Review comment:
   I don't think we can change the behavior either without adding a legacy 
config and a migration guide.
   
   Btw, if we unify the behaviors, then we don't need to keep the two 
implementations?
   We might want to deprecate one of the two.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to