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

jackylau commented on FLINK-31902:
----------------------------------

hi [~jark]  thanks for your response, it is not sql standard. not null is 
constraint info in ddl, and should not be changed by cast in sql standard.

it will make strange like here https://issues.apache.org/jira/browse/FLINK-31908

> cast expr to type with not null should throw exception like calcite
> -------------------------------------------------------------------
>
>                 Key: FLINK-31902
>                 URL: https://issues.apache.org/jira/browse/FLINK-31902
>             Project: Flink
>          Issue Type: Improvement
>    Affects Versions: 1.18.0
>            Reporter: jackylau
>            Priority: Major
>
> {code:java}
> // calcite cast type  not null, will throw exception
> expr("cast(x as int ^not^ null)")
>         .fails("(?s).*Encountered \"not\" at .*");
> expr("cast(x as int ^not^ null array)")
>         .fails("(?s).*Encountered \"not\" at .*");
> expr("cast(x as int array ^not^ null)")
>         .fails("(?s).*Encountered \"not\" at .*"); 
> // while  the flink not
> expr("cast(x as array<int not null>)")
>         .ok("(?s).*Encountered \"not\" at .*");
> expr("cast(x as array<int> not null)")
>         .ok("(?s).*Encountered \"not\" at .*");{code}
> the reason is flink add extended type, which will supports not null
> {code:java}
> // code placeholder
> <#-- additional types are included here -->
> <#-- put custom data types in front of Calcite core data types -->
> <#list (parser.dataTypeParserMethods!default.parser.dataTypeParserMethods) as 
> method>
>         LOOKAHEAD(2)
>         typeNameSpec = ${method}
>     |
> </#list> {code}



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

Reply via email to