Details
-
Sub-task
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
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:
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.