HyukjinKwon commented on a change in pull request #25728: [SPARK-29020][SQL]
Improving array_sort behaviour
URL: https://github.com/apache/spark/pull/25728#discussion_r322511487
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
##########
@@ -3328,13 +3328,25 @@ object functions {
}
/**
- * 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.
+ * Sorts the input array for the given column in ascending order,
+ * according to the natural ordering of the array elements.
+ * Null elements will be placed at the beginning of the returned array.
*
* @group collection_funcs
* @since 2.4.0
*/
- def array_sort(e: Column): Column = withExpr { ArraySort(e.expr) }
+ def array_sort(e: Column): Column = array_sort(e, asc = true)
+
+ /**
+ * Sorts the input array for the given column in ascending or descending
order,
+ * according to the natural ordering of the array elements.
+ * 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.
+ *
+ * @group collection_funcs
+ * @since 2.4.0
Review comment:
2.4.0 -> 3.0.0
----------------------------------------------------------------
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]