You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "jackylau (Jira)" <ji...@apache.org> on 2023/03/24 05:42:00 UTC

[jira] [Updated] (FLINK-31602) Add ARRAY_POSITION supported in SQL & Table API

     [ https://issues.apache.org/jira/browse/FLINK-31602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jackylau updated FLINK-31602:
-----------------------------
    Description: 
array_position(array, element) - Returns the (1-based) index of the first element of the array as long.

Syntax:
array_position(array, element)

Arguments:
array: An ARRAY to be handled.

Returns:

Returns the position of the first occurrence of element in the given array as long.

Returns 0 if the given value could not be found in the array.

Returns null if either of the arguments are null
{code:sql}
> SELECT array_position(array(3, 2, 1), 1);
 3 {code}
See also
spark [https://spark.apache.org/docs/latest/api/sql/index.html#array_remove|https://spark.apache.org/docs/latest/api/sql/index.html#array_position]

postgresql [https://www.postgresql.org/docs/12/functions-array.html#ARRAY-FUNCTIONS-TABLE]

> Add ARRAY_POSITION supported in SQL & Table API
> -----------------------------------------------
>
>                 Key: FLINK-31602
>                 URL: https://issues.apache.org/jira/browse/FLINK-31602
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>    Affects Versions: 1.18.0
>            Reporter: jackylau
>            Priority: Major
>             Fix For: 1.18.0
>
>
> array_position(array, element) - Returns the (1-based) index of the first element of the array as long.
> Syntax:
> array_position(array, element)
> Arguments:
> array: An ARRAY to be handled.
> Returns:
> Returns the position of the first occurrence of element in the given array as long.
> Returns 0 if the given value could not be found in the array.
> Returns null if either of the arguments are null
> {code:sql}
> > SELECT array_position(array(3, 2, 1), 1);
>  3 {code}
> See also
> spark [https://spark.apache.org/docs/latest/api/sql/index.html#array_remove|https://spark.apache.org/docs/latest/api/sql/index.html#array_position]
> postgresql [https://www.postgresql.org/docs/12/functions-array.html#ARRAY-FUNCTIONS-TABLE]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)