vlsi 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_r358182121
##########
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:
> prevents calcite from throwing out correlation join left side and table
scan is present in plan when it's absolutely unnecessary.
Should it be covered by a different rule?
In other words, "if correlation other side is always empty, then the
correlation result is empty".
----------------------------------------------------------------
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