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

Julian Hyde edited comment on CALCITE-7742 at 9/1/26 10:41 PM:
---------------------------------------------------------------

One solution would be to make the cache non-static. I suspect performance would 
suck because every {{RelDataTypeFactory}} would start with an empty cache. But 
it's worth a try, if only to establish a performance baseline.

Another solution would be for {{RelDataTypeFactory}} instances to share a cache 
if and only if they have the same configuration. As [~diveyam02] suggests, 
{{RelDataTypeSystem}} is probably that configuration. So, the caches could be 
stored in a static (meta) cache, keyed by {{RelDataTypeSystem}}. You'd need to 
implement {{equals}} and {{hashCode}} for {{RelDataTypeSystem}}.

I suspect that {{KEY2TYPE_CACHE}} has the same problem.


was (Author: julianhyde):
One solution would be to make the cache non-static. I suspect performance would 
suck because every {{RelDataTypeFactory}} would start with an empty cache. But 
it's worth a try, if only to establish a performance baseline.

Another solution would be for {{RelDataTypeFactory}} instances to share a cache 
if and only if they have the same configuration. As [~diveyam02] suggests, 
{{RelDataTypeSystem}} is probably that configuration. So, the caches could be 
stored in a static (meta) cache, keyed by {{RelDataTypeSystem}}.

I suspect that {{KEY2TYPE_CACHE}} has the same problem.

> Test framework has non-determinstic tests
> -----------------------------------------
>
>                 Key: CALCITE-7742
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7742
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.42.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> Some tests intermittently fail in CI, here's an example output:
> {code:java}
> FAILURE   0.1sec, 
> org.apache.calcite.rel.rel2sql.RelToSqlConverterRoundTripTest > 
> testCastToChar()
>     java.lang.AssertionError:
>     Expected: is "SELECT CAST(`product_id` AS CHAR)\nFROM 
> `foodmart`.`product`"
>          but: was "SELECT CAST(`product_id` AS CHAR(1))\nFROM 
> `foodmart`.`product`" {code}
> Seemingly this is because there is some shared state between concurrent 
> tests, e.g., perhaps a custom type system installed?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to