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

Jiatao Tao edited comment on CALCITE-3065 at 5/18/19 2:16 AM:
--------------------------------------------------------------

 

[~danny0405]
 # For calcite, I just need to box "class" in SqlLiteral.getValue, and then I 
can get a reasonable value. If it is easy for Spark to support pruning with 
"cast", It will already be done. Besides, I think it is put the cart before the 
horse.
 # "solve the type consistency", in my opinion, "literal.getValueAs" has done 
that, it returns the value in its true type(In accordance with common sense).
 # Let's put Spark aside 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.

PS. code like this, if you think it is ok, I will provide tests or any other 
things you needed:

```

public <T> T getValueAs(Class<T> clazz) {
 clazz = Primitive.box(clazz);
 ...
 }

```

So in summary, I can not buy in your thoughts. Can you provide other reasons?

Or [~julianhyde], can you give some comments? It seems that you understand my 
problem at first. Very thanks if you give me some feedback.

 

Very appreciate for your work.


was (Author: aron.tao):
 

[~danny0405]
 # For calcite, I just need to box "class" in SqlLiteral.getValue, and then I 
can get a reasonable value. If it is easy for Spark to support pruning with 
"cast", It will already be done. Besides, I think it is put the cart before the 
horse.
 # "solve the type consistency", in my opinion, "literal.getValueAs" has done 
that, it returns the value in its true type(In accordance with common sense).
 # Let's put Spark aside 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.

PS. code like this, if you think it is ok, I will provide tests or any other 
things you needed:


public <T> T getValueAs(Class<T> clazz) \{
  clazz = Primitive.box(clazz);
  ...
}
 

So in summary, I can not buy in your thoughts. Can you provide other reasons?

Or [~julianhyde], can you give some comments? It seems that you understand my 
problem at first. Very thanks if you give me some feedback.

 

Very appreciate for your work.

> 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: 10m
>  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