You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Botong Huang (Jira)" <ji...@apache.org> on 2020/06/03 21:09:00 UTC

[jira] [Commented] (CALCITE-3981) Volcano.register should not return stale/merged subset

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

Botong Huang commented on CALCITE-3981:
---------------------------------------

Thanks [~julianhyde] and [~hyuan] for the review!

> 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
>            Priority: Major
>             Fix For: 1.24.0
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> 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 ensureRegistered() and 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 (see AbstractRelNode.onRegister()). This is a leak because once a relSet/subset is merged into others and becomes stale, it should not be used to connect new relNodes. 
> 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 registering subset itself, register should always use canonize() to find and return the equivalent active subset instead.



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