You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by za...@apache.org on 2021/09/21 10:29:33 UTC

[calcite] branch master updated: Remove obsolete/misleading comments in RelOptUtil#classifyFilters

This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
     new b03ca2f  Remove obsolete/misleading comments in RelOptUtil#classifyFilters
b03ca2f is described below

commit b03ca2fb8fea0b45483697c5796e96898a70646f
Author: Stamatis Zampetakis <za...@gmail.com>
AuthorDate: Tue Sep 21 12:22:50 2021 +0200

    Remove obsolete/misleading comments in RelOptUtil#classifyFilters
    
    The claim that filters are not pushed in the NULL generating side is not
    true (at least not anymore).
    
    Consider the following query:
    
    SELECT *
    FROM emp e
    LEFT JOIN dept d
      ON d.deptno > 20
    
    In this case the filter in the ON clause can be pushed in the right
    which is the NULL generating side. This is already done by the
    FilterJoinRule generating a plan similar to the query below.
    
    SELECT *
    FROM emp e
    LEFT JOIN (SELECT * FROM dept d WHERE d.deptno > 20) ON true
---
 core/src/main/java/org/apache/calcite/plan/RelOptUtil.java | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java b/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
index 545943b..39e55c4 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
@@ -2835,9 +2835,6 @@ public abstract class RelOptUtil {
       // REVIEW - are there any expressions that need special handling
       // and therefore cannot be pushed?
 
-      // filters can be pushed to the left child if the left child
-      // does not generate NULLs and the only columns referenced in
-      // the filter originate from the left child
       if (pushLeft && leftBitmap.contains(inputBits)) {
         // ignore filters that always evaluate to true
         if (!filter.isAlwaysTrue()) {
@@ -2858,18 +2855,10 @@ public abstract class RelOptUtil {
           leftFilters.add(shiftedFilter);
         }
         filtersToRemove.add(filter);
-
-        // filters can be pushed to the right child if the right child
-        // does not generate NULLs and the only columns referenced in
-        // the filter originate from the right child
       } else if (pushRight && rightBitmap.contains(inputBits)) {
         if (!filter.isAlwaysTrue()) {
           // adjust the field references in the filter to reflect
-          // that fields in the right now shift over to the left;
-          // since we never push filters to a NULL generating
-          // child, the types of the source should match the dest
-          // so we don't need to explicitly pass the destination
-          // fields to RexInputConverter
+          // that fields in the right now shift over to the left
           final RexNode shiftedFilter =
               shiftFilter(
                   nSysFields + nFieldsLeft,