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

Hongze Zhang commented on CALCITE-3065:
---------------------------------------

{quote}And leave my scenario aside, shouldn't "literal.getValueAs" process both 
"int" and "Integer"? At least in Java, int and Integer are not so different in 
most case.
{quote}
[~Aron.tao] - Integer is nullable, where int is not. And nullability makes 
sense in database internal. The operation of transformation between primitive 
and boxed types should be always reasonable in Calcite.

And the method {{Class#cast(Object obj)}} behaves quite differently with normal 
casting. Personally I don't suggest to call this method on primitive values for 
any reason.

If you really want to make some improvements I think it is usual to somehow add 
a bunch of methods like "getInt()", "getLong()", etc. But I am not sure if such 
methods suit your use case.

> RexLiteral#getValueAs should consider primitive type
> ----------------------------------------------------
>
>                 Key: CALCITE-3065
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3065
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jiatao Tao
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: image-2019-05-13-12-04-36-365.png, 
> image-2019-05-17-08-23-52-735.png
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> !image-2019-05-13-12-04-36-365.png!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to