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

 ##########
 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 could try to leave nulls always at the end of the array, that won't change 
the behaviour.
   I was just unifying behaviours between sort_array and array_sort. 
   Let me know if you have any suggestion

----------------------------------------------------------------
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