[ 
https://issues.apache.org/jira/browse/TAJO-1350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14366814#comment-14366814
 ] 

ASF GitHub Bot commented on TAJO-1350:
--------------------------------------

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?


> Refactor FilterPushDownRule::visitJoin() into well-defined, small methods
> -------------------------------------------------------------------------
>
>                 Key: TAJO-1350
>                 URL: https://issues.apache.org/jira/browse/TAJO-1350
>             Project: Tajo
>          Issue Type: Improvement
>          Components: planner/optimizer
>            Reporter: Hyunsik Choi
>            Assignee: Jihoon Son
>             Fix For: 0.11.0
>
>         Attachments: TAJO-1350.patch
>
>
> FilterPushDownRule::visitJoin() is too long and complicated. It handles 
> various cases in a single method. We need to refactor this method into 
> several small and well-defined methods.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to