[BP-1.17] [FLINK-26948][table] Add-ARRAY_SORT-function. #23158
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Implement the array_sort function to extract a subset of elements from an array.
Returns the array in sorted order. Sorts the input array in ascending or descending order according to the natural ordering of the array elements. NULL elements are placed at the beginning of the returned array in ascending order or at the end of the returned array in descending order. If the array itself is null, the function will return null. The optional ascendingOrder argument defaults to true if not specified.
Brief change log
ARRAY_SORT for Table API and SQL
Syntax:
ARRAY_SORT(array, [ascendingOrder])Arguments:
array: The array we want to sort.
ascendingOrder: this is an option, default and true stand for ascending order, false stand for descending order.
Returns:
if the array is null or ascendingOrder is null return null. if array is empty return empty.
Examples:
see also:
spark: https://spark.apache.org/docs/latest/api/sql/index.html#array_sort
databrick:https://docs.databricks.com/sql/language-manual/functions/array_sort.html
Verifying this change
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (yes / no)Documentation