You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Timo Walther (Jira)" <ji...@apache.org> on 2022/05/02 07:18:00 UTC

[jira] [Commented] (FLINK-26947) Add ARRAY_CONTAINS supported in SQL & Table API

    [ https://issues.apache.org/jira/browse/FLINK-26947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530627#comment-17530627 ] 

Timo Walther commented on FLINK-26947:
--------------------------------------

[~lsy] I just noticed that your JIRA issue description slightly differs from the commit that I just merged. Can you double check "If value is NULL, the result is NULL."? The current implementation does a proper null check in the elements of the array. Is that not intended?

> Add ARRAY_CONTAINS supported in SQL & Table API
> -----------------------------------------------
>
>                 Key: FLINK-26947
>                 URL: https://issues.apache.org/jira/browse/FLINK-26947
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>            Reporter: dalongliu
>            Assignee: Timo Walther
>            Priority: Major
>             Fix For: 1.16.0
>
>
> Returns true if {{array}} contains {{{}value{}}}.
> Syntax:
> {code:java}
> array_contains(array, value) {code}
> Arguments:
>  * {{{}array{}}}: An ARRAY to be searched.
>  * {{{}value{}}}: An expression with a type sharing a least common type with the {{array}} elements.
> Returns:
> A BOOLEAN. If {{value}} is {{{}NULL{}}}, the result is {{{}NULL{}}}. If any element in {{array}} is {{{}NULL{}}}, the result is {{NULL}} if {{value}} is not matched to any other element.
> Examples:
> {code:java}
> > SELECT array_contains(array(1, 2, 3), 2);
>  true
> > SELECT array_contains(array(1, NULL, 3), 2);
>  NULL
> > SELECT array_conatins(array(1, 2, 3), NULL);
>  NULL {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.7#820007)