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_r353628674
 
 

 ##########
 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
 
 Review comment:
   Because without this check, the case from ```sql/sub-query.iq``` : 
   ```sql
   select sal from "scott".emp e
     where 123 IN (
       select cast(null as int)
       from "scott".dept d where e.deptno=d.deptno);
   ```
   Will have final plan : 
   ```
   EnumerableCalc(expr#0..3=[{inputs}], SAL=[$t1])
      EnumerableCorrelate(correlation=[$cor0], joinType=[inner], 
requiredColumns=[{2}])
        EnumerableCalc(expr#0..7=[{inputs}], EMPNO=[$t0], SAL=[$t5], 
DEPTNO=[$t7])
          EnumerableTableScan(table=[[scott, EMP]])
        EnumerableValues(tuples=[[]])
   ```
   Though expected one is: 
   ```
   EnumerableValues(tuples=[[]])
   ```

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