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

Sergey Nuyanzin edited comment on FLINK-31166 at 3/9/23 10:32 AM:
------------------------------------------------------------------

[~jackylau] can you please update jira description with some example e.g. from 
the PR.
Having screenshots in description does not help much since it is impossible to 
copy&paste and run on Flink.

if i understand correctly from the PR:
{{ARRAY_CONTAINS}} works ok for the case when both haystack elements and needle 
are not nullable e.g.
{code:sql}
SELECT array_contains(ARRAY[0, 1], 0);{code}
it works ok when both haystack elements and needle are nullable e.g.
{code:sql}
SELECT array_contains(ARRAY[0, 1, NULL], CAST(NULL AS INT));{code}
it works ok when haystack elements are nullable and needle is not nullable e.g.
{code:sql}
SELECT array_contains(ARRAY[0, 1, NULL], 1);{code}
and it does NOT work when haystack elements are not nullable and needle is 
nullable e.g.
{code:sql}
SELECT array_contains(ARRAY[0, 1], CAST(NULL AS INT));{code}
I'm asking since for me 
in fact it was impossible to get to this from jira description reading and I 
still want to double check if I understand it correctly


was (Author: sergey nuyanzin):
[~jackylau] can you please update jira description with some example e.g. from 
the PR.
Having screenshots in description does not help much since it is impossible to 
copy&paste and run on Flink.

if i understand correctly from the PR:
{{ARRAY_CONTAINS}} works ok for the case when both haystack elements and needle 
are not nullable e.g. {code:sql}SELECT array_contains(ARRAY[0, 1], 0);{code}
it works ok when both haystack elements and needle are nullable e.g. 
{code:sql}SELECT array_contains(ARRAY[0, 1, NULL], CAST(NULL AS INT));{code}
it works ok when haystack elements are null and needle is not nullable e.g. 
{code:sql}SELECT array_contains(ARRAY[0, 1, NULL], 1);{code}

and it does NOT work when haystack elements are not nullable and needle is 
nullable e.g. {code:sql}SELECT array_contains(ARRAY[0, 1], CAST(NULL AS 
INT));{code}

I'm asking since for me 
in fact it was impossible to get to this from jira description reading and I 
still want to double check if I understand it correctly

> array_contains element type error
> ---------------------------------
>
>                 Key: FLINK-31166
>                 URL: https://issues.apache.org/jira/browse/FLINK-31166
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.18.0
>            Reporter: jackylau
>            Assignee: jackylau
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.18.0
>
>         Attachments: image-2023-02-21-18-37-45-202.png, 
> image-2023-02-21-18-41-19-385.png, image-2023-02-22-09-56-59-257.png
>
>
> !image-2023-02-22-09-56-59-257.png!
>  
> !image-2023-02-21-18-41-19-385.png!



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

Reply via email to