Botong Huang created CALCITE-3981:
-------------------------------------
Summary: Volcano.register should not return stale/merged subset
Key: CALCITE-3981
URL: https://issues.apache.org/jira/browse/CALCITE-3981
Project: Calcite
Issue Type: Bug
Reporter: Botong Huang
When a subset is registered, registerImpl() and registerSubset() currently
simply returns the subset itself. The problem is that subset can become stale
when relSets get merged (for example in registerSubset() "merge(set,
subset.set)"). As a result, a stale/merged subset might be returned from
registerImpl, and the newly registering subtree might get registered
recursively on top of the stale subset.
With CALCITE-3755, subsets can now be directly matched by rules. This opens
another source of stale subset leak: (1) An active subset gets matched, the
RuleMatch gets queued in RuleQueue. (2) The subset becomes stale due to relSet
merge. (3) The rule match in (1) is popped from queue and fired. (4) In OnMatch
the rule gets the stale subset, builds new rels on top of it and regsiter the
new rels. In this case, the entire new rel subtree will be registered on top of
the stale subset as is.
Rather than returning the subset as it, register should always use canonize()
to find the equivalent active subset and return it instead.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)