[jira] [Comment Edited] (CALCITE-3932) Make data type cache thread local, non-evictable

2020-04-23 Thread Julian Hyde (Jira)


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

Julian Hyde edited comment on CALCITE-3932 at 4/24/20, 12:39 AM:
-

I agree, won't-fix is the right remedy here.

I wonder whether we should reconsider (as a different Jira case) our interning 
of types. Change from MUST intern to SHOULD intern, and always compare types 
using {{equals}}.

We clearly want to do *some* interning, especially within a query, so that 
there aren't hundreds of copies of the same record type all over the place. But 
if people don't intern, or intern in different query-specific caches, then the 
logic will still work.

If {{equals}} is written using the standard template
{code:java}
return this == o
  || o instanceof TheType && field1 == o.field1 && field2 == o.field2 {code}
(that is, avoiding deep comparison if possible) then the performance will be 
pretty much the same.


was (Author: julianhyde):
I agree, won't-fix is the right remedy here.

I wonder whether we should reconsider (as a different Jira case) our interning 
of types. Change from MUST intern to SHOULD intern, and always compare types 
using {{equals}}.

We clearly want to do *some* interning, especially within a query, so that 
there aren't hundreds of copies of the same record type all over the place. But 
if people don't intern, or intern in different query-specific caches, then the 
logic will still work.

If {{equals}} is written using the standard template
{code:java}
return this == o
  || o instanceof TheType && field1 == o.field1 and field2 == o.field2 {code}
(that is, avoiding deep comparison if possible) then the performance will be 
pretty much the same.

> Make data type cache thread local, non-evictable
> 
>
> Key: CALCITE-3932
> URL: https://issues.apache.org/jira/browse/CALCITE-3932
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Haisheng Yuan
>Priority: Major
> Fix For: 1.23.0
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Data type can be evicted out of cache, which is global, thread-safe. 
> It seems not necessary to cache them globally, because most of them are 
> RelRecordType, which is query dependent, not sharable between different 
> queries.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Comment Edited] (CALCITE-3932) Make data type cache thread local, non-evictable

2020-04-22 Thread Haisheng Yuan (Jira)


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

Haisheng Yuan edited comment on CALCITE-3932 at 4/23/20, 2:14 AM:
--

Thanks for your advice. [~Junzheng Zheng] I opened a 
[PR|[https://github.com/apache/calcite/pull/1939]].

[~julianhyde] [~danny0405] [~vladimirsitnikov] Can you take a look?


was (Author: hyuan):
Thanks for your advice. [~Junzheng Zheng] I opened a PR.

[~julianhyde] [~danny0405] [~vladimirsitnikov] Can you take a look?

> Make data type cache thread local, non-evictable
> 
>
> Key: CALCITE-3932
> URL: https://issues.apache.org/jira/browse/CALCITE-3932
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Haisheng Yuan
>Priority: Major
> Fix For: 1.23.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Data type can be evicted out of cache, which is global, thread-safe. 
> It seems not necessary to cache them globally, because most of them are 
> RelRecordType, which is query dependent, not sharable between different 
> queries.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)