[ https://issues.apache.org/jira/browse/CALCITE-3917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17081803#comment-17081803 ]
Haisheng Yuan commented on CALCITE-3917: ---------------------------------------- That is why many optimizers use walking through the initial plan tree to preprocess and simplify the plan, instead of using planner like HepPlanner/VolcanoPlanner. > Revive pruned node when a rule generates RelNode that is already pruned > ----------------------------------------------------------------------- > > Key: CALCITE-3917 > URL: https://issues.apache.org/jira/browse/CALCITE-3917 > Project: Calcite > Issue Type: Improvement > Components: core > Reporter: Haisheng Yuan > Priority: Major > > Manually pruning nodes in rule can be dangerous. e.g.: > Logical transformation rule X matches RelNode A and generates RelNode B. Rule > X thinks B is always better than A, prunes A in the rule. But if B is already > in the MEMO, matched and pruned by another rule Y before X, and rule Y > generates A. At the end, we may see CannotPlanException, because there is no > available RelNode in the RelSet. > In this case, we'd better revive the node that is already pruned out by > planner, even this can bring additional rule apply and overhead, but better > than failure to plan. -- This message was sent by Atlassian Jira (v8.3.4#803005)