[
https://issues.apache.org/jira/browse/FLINK-31902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17715691#comment-17715691
]
jackylau commented on FLINK-31902:
----------------------------------
the standard grammar it here from iso 2016
{code:java}
// code placeholder
<cast specification> ::=
CAST <left paren> <cast operand> AS <cast target> <right paren>
<cast operand> ::=
<value expression>
| <implicitly typed value specification>
<cast target> ::=
<domain name>
| <data type>
<data type> ::=
<predefined type>
| <row type>
| <path-resolved user-defined type name>
| <reference type>
| <collection type>
<collection type> ::=
<array type>
| <multiset type>
<array type> ::=
<data type> ARRAY
[ <left bracket or trigraph> <maximum cardinality> <right bracket or trigraph>
] {code}
> 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)