You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/11/30 03:08:44 UTC

[GitHub] [calcite] danny0405 commented on a change in pull request #1610: [CALCITE-3525] RexSimplify: eliminate redundant rex calls in OR

danny0405 commented on a change in pull request #1610: [CALCITE-3525] RexSimplify: eliminate redundant rex calls in OR
URL: https://github.com/apache/calcite/pull/1610#discussion_r352262329
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/rules/FilterProjectTransposeRule.java
 ##########
 @@ -202,8 +202,9 @@ private RexNode simplifyFilterCondition(RexNode condition, RelOptRuleCall call)
     // 1>null evaluates to unknown and WHERE unknown behaves exactly like WHERE false
     RexSimplify simplifier =
         new RexSimplify(xBuilder, RelOptPredicateList.EMPTY, executor);
-    return RexUtil.removeNullabilityCast(
+    RexNode simplified = RexUtil.removeNullabilityCast(
         xBuilder.getTypeFactory(), simplifier.simplifyUnknownAsFalse(condition));
+    return simplified.isAlwaysFalse() ? condition : simplified;
 
 Review comment:
   Why we returns the original condition if the simplified node is always false ? Shouldn't we just return the simplified one ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services