You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Sergey Nuyanzin (Jira)" <ji...@apache.org> on 2022/06/03 09:22:00 UTC
[jira] [Created] (FLINK-27891) Add ARRAY_APPEND and ARRAY_PREPEND supported in SQL & Table API
Sergey Nuyanzin created FLINK-27891:
---------------------------------------
Summary: Add ARRAY_APPEND and ARRAY_PREPEND supported in SQL & Table API
Key: FLINK-27891
URL: https://issues.apache.org/jira/browse/FLINK-27891
Project: Flink
Issue Type: Sub-task
Components: Table SQL / API
Reporter: Sergey Nuyanzin
{{ARRAY_APPEND}} - adds element to the end of the array and returns the resulting array
{{ARRAY_PREPEND}} - adds element to the beginning of the array and returns the resulting array
Syntax:
{code:sql}
ARRAY_APPEND( <array> , <new_element> );
ARRAY_PREPEND( <new_element> , <array> );
{code}
Arguments:
array: An ARRAY to to add a new element.
new_element: A new element.
Returns:
An array. If array is NULL, the result is NULL.
Examples:
{code:sql}
SELECT array_append(array[1, 2, 3], 4);
-- array[1, 2, 3, 4]
select array_append(cast(null as int array), 2);
-- null
SELECT array_prepend(array[1, 2, 3], 4);
-- array[4, 1, 2, 3]
SELECT array_prepend(array[1, 2, 3], null);
-- array[null, 1, 2, 3]
{code}
See more:
{{ARRAY_APPEND}}
Snowflake https://docs.snowflake.com/en/sql-reference/functions/array_append.html
PostgreSQL https://www.postgresql.org/docs/14/functions-array.html#ARRAY-FUNCTIONS-TABLE
{{ARRAY_PREPEND}}
Snowflake https://docs.snowflake.com/en/sql-reference/functions/array_prepend.html
PostgreSQL https://www.postgresql.org/docs/14/functions-array.html#ARRAY-FUNCTIONS-TABLE
--
This message was sent by Atlassian Jira
(v8.20.7#820007)