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/24 10:21:00 UTC

[jira] [Comment Edited] (FLINK-31908) cast expr to type with not null should not change nullable of expr

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

jackylau edited comment on FLINK-31908 at 4/24/23 10:20 AM:
------------------------------------------------------------

hi [~jark] cast only make type take effective. and nullable should be use original expr's nullable.


was (Author: jackylau):
cast only make type take effective. and nullable should be use original expr's nullable.

> cast expr to type with not null  should not change nullable of expr
> -------------------------------------------------------------------
>
>                 Key: FLINK-31908
>                 URL: https://issues.apache.org/jira/browse/FLINK-31908
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / API
>    Affects Versions: 1.18.0
>            Reporter: jackylau
>            Priority: Major
>
> {code:java}
> Stream<TestSetSpec> getTestSetSpecs() {
>     return Stream.of(
>             TestSetSpec.forFunction(BuiltInFunctionDefinitions.CAST)
>                     .onFieldsWithData(new Integer[]{1, 2}, 3)
>                     .andDataTypes(DataTypes.ARRAY(INT()), INT())
>                     .testSqlResult(
>                             "CAST(f0 AS ARRAY<DOUBLE NOT NULL>)",
>                             new Double[]{1.0d, 2.0d},
>                             DataTypes.ARRAY(DOUBLE().notNull())));
> } {code}
> but the result type should DataTypes.ARRAY(DOUBLE())), the root cause is calcite bug



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