Github user hyunsik commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/384#discussion_r26644864
  
    --- Diff: 
tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
 ---
    @@ -355,20 +230,144 @@ public LogicalNode visitJoin(FilterPushDownContext 
context, LogicalPlan plan, Lo
           if (joinNode.getJoinType() == JoinType.CROSS) {
             joinNode.setJoinType(JoinType.INNER);
           }
    -      context.pushingDownFilters.removeAll(matched);
         }
     
    -    
context.pushingDownFilters.addAll(outerJoinFilterEvalsExcludePredication);
    -    context.pushingDownFilters.addAll(thetaJoinFilter);
    +    context.pushingDownFilters.removeAll(matched);
         return joinNode;
       }
     
    +  private static Set<EvalNode> extractNonPushableJoinQuals(final 
LogicalPlan plan,
    +                                                           final 
LogicalPlan.QueryBlock block,
    +                                                           final JoinNode 
joinNode,
    +                                                           final 
Set<EvalNode> onPredicates,
    +                                                           final 
Set<EvalNode> wherePredicates)
    +      throws PlanningException {
    +    Set<EvalNode> nonPushableQuals = TUtil.newHashSet();
    +    // TODO: non-equi theta join quals must not be pushed until TAJO-742 
is resolved.
    +    nonPushableQuals.addAll(extractNonEquiThetaJoinQuals(wherePredicates, 
block, joinNode));
    +
    +    // for outer joins
    +    if (PlannerUtil.isOuterJoin(joinNode.getJoinType())) {
    +      nonPushableQuals.addAll(extractNonPushableOuterJoinQuals(plan, 
onPredicates, wherePredicates, joinNode));
    +    }
    +    return nonPushableQuals;
    +  }
    +
    +  /**
    +   * For outer joins, pushable predicates can be decided based on their 
locations in the SQL and types of referencing relations.
    +   *
    +   * <h3>Table types</h3>
    +   * <ul>
    +   *   <li>Preserved Row table : The table in an Outer Join that must 
return all rows.
    +   *   For left outer joins this is the Left table, for right outer joins 
it is the Right table.
    +   *   For full outer joins both tables are Preserved Row tables.</li>
    +   *   <li>Null Supplying table : This is the table that has nulls filled 
in for its columns in unmatched rows.
    +   *   In the non-full outer join case, this is the other table in the 
Join.
    --- End diff --
    
    Could you check this comment?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to