ihuzenko 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_r353655131
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/rel/rules/FilterProjectTransposeRule.java
 ##########
 @@ -181,6 +183,14 @@ public void onMatch(RelOptRuleCall call) {
                 .project(project.getProjects(), 
project.getRowType().getFieldNames())
                 .build();
 
+    // if new filter is always false and none of it's inputs use
+    // correlation variables - simplify new project to empty values
+    if (newCondition.isAlwaysFalse() && newFilterRel.getInputs().stream()
+        .map(RelOptUtil::getVariablesUsed)
+        .allMatch(Collection::isEmpty)) {
+      newProjRel = relBuilder.push(newProjRel).empty().build();
 
 Review comment:
   Hi @zabetak , thanks for your quick reply. Leaving the Filter with false 
condition causes test failures for some adapters, like MongoDB, because such 
filter can't be implemented properly. 

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