You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "dalongliu (Jira)" <ji...@apache.org> on 2022/03/31 07:47:00 UTC
[jira] [Created] (FLINK-26948) Add SORT_ARRAY supported in SQL & Table API
dalongliu created FLINK-26948:
---------------------------------
Summary: Add SORT_ARRAY supported in SQL & Table API
Key: FLINK-26948
URL: https://issues.apache.org/jira/browse/FLINK-26948
Project: Flink
Issue Type: Sub-task
Components: Table SQL / API
Reporter: dalongliu
Fix For: 1.16.0
Returns the array in {{expr}} in sorted order.
Syntax:
{code:java}
sort_array(expr [, ascendingOrder] ) {code}
Arguments:
* {{{}expr{}}}: An ARRAY expression of sortable elements.
* {{{}ascendingOrder{}}}: An optional BOOLEAN expression defaulting to {{{}true{}}}.
Returns:
The result type matches {{{}expr{}}}.
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.
Examples:
{code:java}
> SELECT sort_array(array('b', 'd', NULL, 'c', 'a'), true);
[NULL,a,b,c,d] {code}
See more:
* [Spark|https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#date-and-timestamp-functions]
* [Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+udf]
--
This message was sent by Atlassian Jira
(v8.20.1#820001)