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

ASF GitHub Bot updated FLINK-40672:
-----------------------------------
    Labels: pull-request-available  (was: )

> Incorrect nullability for CAST from VARIANT
> -------------------------------------------
>
>                 Key: FLINK-40672
>                 URL: https://issues.apache.org/jira/browse/FLINK-40672
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>            Reporter: dylanhz
>            Priority: Major
>              Labels: pull-request-available
>
> h3. Description
> A non-nullable VARIANT can contain a variant null. Casting it to a 
> non-VARIANT type returns SQL NULL, but Flink incorrectly infers a NOT NULL 
> result.
> For example:
> {code:sql}
> SELECT CAST(PARSE_JSON('null') AS INT);
> {code}
> This can cause runtime NOT NULL violations or incorrect optimization of {{IS 
> NULL}} and {{COALESCE}}.
> Upstream Calcite already correctly makes casts from VARIANT to non-VARIANT 
> types nullable. Flink's copied {{SqlCastFunction}} does not preserve this 
> behavior.
> h3. Expected behavior
> Align with Calcite and consistently infer nullable results for casts from 
> VARIANT to non-VARIANT types in both SQL and Table API.



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

Reply via email to