liuyongvs opened a new pull request, #3232:
URL: https://github.com/apache/calcite/pull/3232
the cast standard grammar it here from iso 2016
// 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> ]
not null/ null are constraint, can not be in cast, only can be in ddl
// this simple type and collection type will throw exception in calcite now
expr("cast(x as integer ^not^ null)")
.fails("(?s).*Encountered \"not\" at .*");
expr("cast(x as integer ^not^ null array)")
.fails("(?s).*Encountered \"not\" at .*");
expr("cast(x as integer array ^not^ null)")
.fails("(?s).*Encountered \"not\" at .*");
// but the followings are not
expr("cast(x as row(f0 int ^not^ null))")
.fails("(?s).*Encountered \"not\" at .*");
expr("cast(x as row(f0 varchar ^null^))")
.fails("(?s).*Encountered \"null\" at .*");
expr("cast(x as row(f0 int ^not^ null, f1 varchar ^null^))")
.fails("(?s).*Encountered \"not\" at .*");
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]