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

    https://github.com/apache/tajo/pull/384#discussion_r26645305
  
    --- 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.
    +   *   For full outer joins both tables are also Null Supplying 
tables.</li>
    +   * </ul>
    +   *
    +   * <h3>Predicate types</h3>
    +   * <ul>
    +   *   <li>During Join predicate : A predicate that is in the JOIN ON 
clause.</li>
    +   *   <li>After Join predicate : A predicate that is in the WHERE 
clause.</li>
    +   * </ul>
    +   *
    +   * <h3>Predicate Pushdown Rules</h3>
    +   * <ol>
    +   *   <li>During Join predicates cannot be pushed past Preserved Row 
tables.</li>
    +   *   <li>After Join predicates cannot be pushed past Null Supplying 
tables.</li>
    +   * </ol>
    +   */
    +  private static Set<EvalNode> extractNonPushableOuterJoinQuals(final 
LogicalPlan plan,
    +                                                                final 
Set<EvalNode> onPredicates,
    +                                                                final 
Set<EvalNode> wherePredicates,
    +                                                                final 
JoinNode joinNode) throws PlanningException {
    +    Set<String> nullSupplyingTableNameSet = TUtil.newHashSet();
    --- End diff --
    
    This method seems to be changed to be even more intuitive.


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