[ 
https://issues.apache.org/jira/browse/CALCITE-5359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

alaneuler updated CALCITE-5359:
-------------------------------
    Description: 
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}

  was:
Implementations of RelOptRuleCall is created each time, and the reading and 
writing of global variable nextId is not thread safe.

Definitino of nextId:
{code:java}
private static int nextId = 0; {code}


> 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