You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Vladimir Sitnikov (JIRA)" <ji...@apache.org> on 2018/08/07 11:22:00 UTC
[jira] [Created] (CALCITE-2452) RexSimplify: avoid multiple similar
optimization passes over the same nodes
Vladimir Sitnikov created CALCITE-2452:
------------------------------------------
Summary: RexSimplify: avoid multiple similar optimization passes over the same nodes
Key: CALCITE-2452
URL: https://issues.apache.org/jira/browse/CALCITE-2452
Project: Calcite
Issue Type: Sub-task
Reporter: Vladimir Sitnikov
Assignee: Julian Hyde
simplifyAndTerms(List<RexNode> terms) has two loops and it calls simplify on each expression twice.
simplifyAnd(RexCall e) calls simplifyList (that walks all the tree down), then simplifyAnd2ForUnknownAsFalse calls simplify_ again.
It looks like just one pass should be sufficient for most of the cases, and the logic should probably be adjusted as follows:
{code:java}
simplify(RexNode node){
// e.g. simplify the node with assumption that all the arguments were simplified, etc, avoid complicated checks
node = simplifyTrivialCases(node);
// this walks over the tree, simplifies operands first then simplifies the call itself
node = simplifyArgumentsThenSimplifyNode(node);
return node;
}
Method naming should clearly indicate that the method is heavy, so it would not accidentally be used.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)