rubenada 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_r352602730
 
 

 ##########
 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:
   This change doesn't seem right. 
   Maybe you should try to use FilterProjectTransposeRule with 
`copyFilter=false` ? Or maybe we should review this piece of code and, in case 
of an "always false condition" create an empty Values instead of a Filter (as 
RelBuilder#filter does).

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to