[ https://issues.apache.org/jira/browse/FLINK-31166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
jackylau updated FLINK-31166: ----------------------------- Summary: array_contains does NOT work when haystack elements are not nullable and needle is nullable (was: array_contains element type error) > array_contains does NOT work when haystack elements are not nullable and > needle is nullable > ------------------------------------------------------------------------------------------- > > 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 > > > {{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} > > !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)