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

Alessandro Solimando commented on CALCITE-5359:
-----------------------------------------------

AFAIK Calcite is not meant to be used in a multi-threaded fashion, so the 
limitation is probably known/intended. I guess there are many other places were 
concurrency would be problematic, if we want to tackle this issue, this case 
could fit under an umbrella Jira.

> nextId of RelOptRuleCall is not thread safe
> -------------------------------------------
>
>                 Key: CALCITE-5359
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5359
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.32.0
>            Reporter: alaneuler
>            Priority: Trivial
>
> Implementations of RelOptRuleCall is created each time, and the reading and 
> writing of global variable nextId is not thread safe.
> Definition of nextId:
> {code:java}
> private static int nextId = 0; {code}
> Usage of it:
> {code:java}
> protected RelOptRuleCall(
>     RelOptPlanner planner,
>     RelOptRuleOperand operand,
>     RelNode[] rels,
>     Map<RelNode, List<RelNode>> nodeInputs,
>     @Nullable List<RelNode> parents) {
>   this.id = nextId++;
>   this.planner = planner;
>   this.operand0 = operand;
>   this.nodeInputs = nodeInputs;
>   this.rule = operand.getRule();
>   this.rels = rels;
>   this.parents = parents;
>   assert rels.length == rule.operands.size();
> } {code}



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

Reply via email to