[
https://issues.apache.org/jira/browse/TAJO-1350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14366826#comment-14366826
]
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_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.
> 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)