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/04/03 04:07:00 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17707755#comment-17707755 ] 

jackylau commented on FLINK-31602:
----------------------------------

Merged to master as [a1e4ba2a0ac39a667b9c3169f254253bd98330b8|https://github.com/apache/flink/commit/a1e4ba2a0ac39a667b9c3169f254253bd98330b8]
[|https://issues.apache.org/jira/secure/AddComment!default.jspa?id=13524990]

> 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
>              Labels: pull-request-available
>             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_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)