Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/384#discussion_r26092914
--- Diff: tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
---
@@ -1978,26 +1979,18 @@ public static boolean
checkIfBeEvaluatedAtJoin(QueryBlock block, EvalNode evalNo
return false;
}
- // When a 'case-when' is used with outer join, the case-when
expression must be evaluated
- // at the topmost join operator.
- // TODO - It's also valid that case-when is evalauted at the topmost
outer operator.
- // But, how can we know there is no further outer join operator
after this node?
- if (containsOuterJoin(block)) {
- if (!isTopMostJoin) {
- Collection<EvalNode> found =
EvalTreeUtil.findOuterJoinSensitiveEvals(evalNode);
- if (found.size() > 0) {
- return false;
- }
- }
+ /*
+ * For outer joins, only predicates which are specified at the on
clause can be evaluated during processing join.
+ * Other predicates from the where clause must be evaluated after the
join.
+ * The below code will be modified after improving join operators to
keep join filters by themselves (TAJO-1310).
+ */
+ if (PlannerUtil.isOuterJoin(node.getJoinType()) && !isOnPredicate) {
--- End diff --
Predicates must be checked at every join node rather than the topmost one.
Thus, I removed the topMostJoin flag.
The newly added line is for outer joins. As you know, in the case of the
outer joins, only the predicates from the on clauses can be the join
conditions. Other predicates from the where clauses are join filters.
Currently, we maintain join filters in separate selection nodes rather than
the join nodes themselves. So, I prevent the filters being pushed down to outer
join nodes. This will be improved when TAJO-1310 is resolved.
---
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.
---