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

Danny Chan commented on CALCITE-3217:
-------------------------------------

Thanks [~wojustme], this is a expected behavior, because we do not know the 
data type of the null literal, you can try:
{code:sql}
select cast(null as int) from T1;
{code}

BTW, this is somehow related to the implicit type coercion CALCITE-2302, we can 
infer the data type for null literal if it is used as a operand which has a 
type-info registered.

> Should  Calcite support "select null"?
> --------------------------------------
>
>                 Key: CALCITE-3217
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3217
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Xurenhe
>            Priority: Minor
>         Attachments: Jietu20190728-221651.jpg
>
>
>  
> Should Calcite need to support "select null", such as:
> {code:java}
> select null;{code}
> In the version of "1.20.0", it throws exception in 
> `org.apache.calcite.sql.validate.SqlValidatorImpl#inferUnknownTypes`. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to