[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-06-02 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 6/3/19 2:52 AM:
-

Hi

[~julianhyde] truly thanks for your explanation.

Seems the name "getJavaClass" is a little confusing, it only does a little 
thing, not a universal API.

And in my opinion, an API that can get class from "RelDataType" is useful, so 
that I can easily get the true value from RexLiteral though getValueAs.

 

And seems that the value that "RexLiteral.getValueAs" returns are all nullable, 
it may diff from its ori type.


was (Author: aron.tao):
Hi

[~julianhyde] truly thanks for your explanation.

Seems the name "getJavaClass" is a little confusing, it only does a little 
thing, not a universal API.

 

And seems that the value that "RexLiteral.getValueAs" returns are all 
nullable(although we can get this from SqlType).

> 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, image-2019-06-02-08-15-35-460.png, 
> image-2019-06-02-08-43-51-646.png
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> !image-2019-05-13-12-04-36-365.png!



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


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-06-02 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 6/2/19 8:23 AM:
-

Hi [~julianhyde]

I can buy in your thoughts about null scenario.

But the code below, is all Calcite' API, and `tp.getJavaClass(literal.getType)` 
returns int not Integer(`type.isNullable` return false.).

```
 val tp = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT)
 literal.getValueAs(tp.getJavaClass(literal.getType))

```


 !image-2019-06-02-08-15-35-460.png!

 

My point is `JavaTypeFactoryImpl#getJavaClass` may return primitive type(means 
type is not nullable), shouldn't we consider primitive type in `getValueAs`?

 

Or am I use the API in a wrong way?

Hope for your opinion, thanks


was (Author: aron.tao):
Hi [~julianhyde]

I can buy in your thoughts about null scenario.

But the code below, is all Calcite' API, and `tp.getJavaClass(literal.getType)` 
returns int not Integer(`type.isNullable` return false.).
 val tp = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT)
 
literal.getValueAs(tp.getJavaClass(literal.getType).asInstanceOf[java.lang.Class[_]])
 !image-2019-06-02-08-15-35-460.png!

 

My point is `JavaTypeFactoryImpl#getJavaClass` may return primitive type(means 
type is not nullable), shouldn't we consider primitive type in `getValueAs`?

 

Or am I use the API in a wrong way?

Hope for your opinion, thanks

> 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, image-2019-06-02-08-15-35-460.png
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> !image-2019-05-13-12-04-36-365.png!



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


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-06-02 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 6/2/19 8:20 AM:
-

Hi [~julianhyde]

I can buy in your thoughts about null scenario.

But the code below, is all Calcite' API, and `tp.getJavaClass(literal.getType)` 
returns int not Integer(`type.isNullable` return false.).
 val tp = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT)
 
literal.getValueAs(tp.getJavaClass(literal.getType).asInstanceOf[java.lang.Class[_]])
 !image-2019-06-02-08-15-35-460.png!

 

My point is `JavaTypeFactoryImpl#getJavaClass` may return primitive type(means 
type is not nullable), shouldn't we consider primitive type in `getValueAs`?

 

Or am I use the API in a wrong way?

Hope for your opinion, thanks


was (Author: aron.tao):
Hi [~julianhyde]

I can buy in your thoughts about null scenario.

But the code below, is all Calcite' API, and `tp.getJavaClass(literal.getType)` 
returns int not Integer(`type.isNullable` return false.).
val tp = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT)
literal.getValueAs(tp.getJavaClass(literal.getType).asInstanceOf[java.lang.Class[_]])
!image-2019-06-02-08-15-35-460.png!

 

My point is `JavaTypeFactoryImpl#getJavaClass` may return primitive type(means 
type is not nullable), shouldn't we consider primitive type in `getValueAs`?

> 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, image-2019-06-02-08-15-35-460.png
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> !image-2019-05-13-12-04-36-365.png!



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


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 5/18/19 2:17 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 getValueAs(Class 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 getValueAs(Class 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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 getValueAs(Class 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 getValueAs(Class 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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 getValueAs(Class 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 getValueAs(Class 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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 getValueAs(Class 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 getValueAs(Class 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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 5/18/19 2:14 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.

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.

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

Or [~julianhyde], can you give some comments? I think you understand my 
question at first. Very thanks if you give me some feedbacks.

> 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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 5/18/19 2:14 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:
public  T getValueAs(Class 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.

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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 5/18/19 2:12 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.

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

Or [~julianhyde], can you give some comments? I think you understand my 
question at first. Very thanks if you give me some feedbacks.


was (Author: aron.tao):
[~julianhyde]

[~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 true type. An int value shouldn't be int but decimal, 
literal.getValueAs just return int?
 # 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.

So in summary, I can not buy in your thoughts.

> 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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 5/17/19 8:35 AM:
--

[~danny0405]

[~julianhyde]

!image-2019-05-17-08-23-52-735.png!

The reason I do that is to reduce "cast". And do hope we can community more 
efficient.

 

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.

 

 

Thanks.


was (Author: aron.tao):
[~danny0405]

[~julianhyde]

!image-2019-05-17-08-23-52-735.png!

The reason I do that is to reduce "cast". And do hope we can community more 
efficient.

 

And leave my scenario aside, shouldn't "literal.getValueAs" process both "int" 
and "Integer" cases? At least in Java, int and Integer are not so different in 
most case.

 

Thanks.

> 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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 5/17/19 8:34 AM:
--

[~danny0405]

[~julianhyde]

!image-2019-05-17-08-23-52-735.png!

The reason I do that is to reduce "cast". And do hope we can community more 
efficient.

 

And leave my scenario aside, shouldn't "literal.getValueAs" process both "int" 
and "Integer" cases? At least in Java, int and Integer are not so different in 
most case.

 

Thanks.


was (Author: aron.tao):
[~danny0405]

[~julianhyde]

!image-2019-05-17-08-23-52-735.png!

The reason I do that is to reduce "cast". And do hope we can community more 
efficient.

 

Thanks.

> 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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 5/17/19 8:26 AM:
--

[~danny0405]

[~julianhyde]

!image-2019-05-17-08-23-52-735.png!

The reason I do that is to reduce "cast". And do hope we can community more 
efficient.

 

Thanks.


was (Author: aron.tao):
[~danny0405]

!image-2019-05-17-08-23-52-735.png!

The reason I do that is to reduce "cast". And do hope we can community more 
efficient.

 

Thanks.

> 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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-17 Thread Jiatao Tao (JIRA)


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

Jiatao Tao edited comment on CALCITE-3065 at 5/17/19 6:04 AM:
--

Hi [~danny0405]

you mean literal.getType? *SqlTypeName typeName* is Integer, from the first 
coommet, I didn't argue that.

 

But the value of RexLiteral is decimal, so I do 
this:*literal.getValueAs(Otherwise why exists this method)*.

 

code from previous comment:
 val tp = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT)
 
literal.getValueAs(tp.getJavaClass(literal.getType).asInstanceOf[java.lang.Class[_]])
  

*literal.getType ->* INTEGER

 

*tp.getJavaClass*(*INTEGER*) -> int

 

literal.getValueAs does not process `int` scenario.

 

I didn't get your point, hope to hear your voice.

 

Thanks.

 


was (Author: aron.tao):
Hi [~danny0405]

you mean literal.getType? *SqlTypeName typeName* is Integer, from the first 
coommet, I didn't argue that.

 

But the value of RexLiteral is decimal, so I do this:*literal.getValueAs*.

 

code from previous comment:
val tp = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT)
literal.getValueAs(tp.getJavaClass(literal.getType).asInstanceOf[java.lang.Class[_]])
 

*literal.getType ->* INTEGER

 

*tp.getJavaClass*(*INTEGER*) -> int

 

literal.getValueAs does not process `int` scenario.

 

I didn't get your point, hope to hear your voice.

 

Thanks.

 

> 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
>
>  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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-15 Thread Jiatao Tao (JIRA)


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

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

Hi [~danny0405]

Thanks, it answers my doubts. But I got this literal in RexVisitor, I think it 
is after validating?

 

Hi [~julianhyde]

By the way, I still think we can do "Primitive.box(clazz)" inside 
*SqlLiteral#**getValueAs,* 
 isn't this more reasonable?  **  We expected all clazz to be boxed, use 
"Primitive.box" to insure this.
{code:java}
public  T getValueAs(Class clazz) {
  clazz = Primitive.box(clazz);
  ...
}{code}
 

Hope to hear your opinion, really appreciate.


was (Author: aron.tao):
[~danny0405]

Thanks, it answers my doubts. But I got this literal in RexVisitor, I think it 
is after validating?

 

[~julianhyde]

By the way, I still think we can do "Primitive.box(clazz)" inside 
*SqlLiteral#**getValueAs,* 
isn't this more reasonable?  **  We expected all clazz to be boxed, use 
"Primitive.box" to insure this.

Hope to hear your opinion, really appreciate.

> 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
>
>  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)


[jira] [Comment Edited] (CALCITE-3065) RexLiteral#getValueAs should consider primitive type

2019-05-13 Thread Danny Chan (JIRA)


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

Danny Chan edited comment on CALCITE-3065 at 5/13/19 12:30 PM:
---

Please give us more details about why this issue is fired ? Not just a picture. 
The only benefit i can think of is primitive type do not need boxing for 
computation, but does the literal has this problem ?

BTW, you should at least give a test case, or even a performance test.


was (Author: danny0405):
Please give us more details about why this issue is fired ? Not just a picture. 
The only benefit i can think of is primitive type do not need to boxing for 
computation, but does the literal has this problem ?

BTW, you should at least give a test case, or even a performance test.

> 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
>
>  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)