@Override public LogicalNode visitJoin(CompilationContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode node, Stack<LogicalNode> stack) throws TajoException { super.visitJoin(context, plan, block, node, stack); compileProjectableNode(context, node.getInSchema(), node); if (node.hasJoinQual()) { compileIfAbsent(context, node.getInSchema(), node.getJoinQual()); } return node; }
@Override public LogicalNode visitJoin(CompilationContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode node, Stack<LogicalNode> stack) throws TajoException { super.visitJoin(context, plan, block, node, stack); compileProjectableNode(context, node.getInSchema(), node); if (node.hasJoinQual()) { compileIfAbsent(context, node.getInSchema(), node.getJoinQual()); } return node; }
public static boolean checkIfBeEvaluatedAtJoin(QueryBlock block, EvalNode evalNode, JoinNode node, boolean isTopMostJoin) { Set<Column> columnRefs = EvalTreeUtil.findUniqueColumns(evalNode); if (EvalTreeUtil.findDistinctAggFunction(evalNode).size() > 0) { return false; } if (EvalTreeUtil.findEvalsByType(evalNode, EvalType.WINDOW_FUNCTION).size() > 0) { return false; } if (columnRefs.size() > 0 && !node.getInSchema().containsAll(columnRefs)) { 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; } } } return true; }
public static boolean checkIfBeEvaluatedAtJoin(QueryBlock block, EvalNode evalNode, JoinNode node, boolean isTopMostJoin) { Set<Column> columnRefs = EvalTreeUtil.findUniqueColumns(evalNode); if (EvalTreeUtil.findDistinctAggFunction(evalNode).size() > 0) { return false; } if (EvalTreeUtil.findEvalsByType(evalNode, EvalType.WINDOW_FUNCTION).size() > 0) { return false; } if (columnRefs.size() > 0 && !node.getInSchema().containsAll(columnRefs)) { 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; } } } return true; }
@Override public PlanString getPlanString() { PlanString planStr = new PlanString(this).appendTitle("(").appendTitle(joinSpec.getType().name()).appendTitle(")"); if (hasJoinQual()) { planStr.addExplan("Join Cond: " + joinSpec.getSingletonPredicate().toString()); } if (hasTargets()) { planStr.addExplan("target list: ").appendExplain(StringUtils.join(targets, ", ")); } planStr.addDetail("out schema: " + getOutSchema()); planStr.addDetail("in schema: " + getInSchema()); return planStr; }
@Override public LogicalNode visitJoin(ProcessorContext ctx, Stack<Expr> stack, Join expr) throws TajoException { super.visitJoin(ctx, stack, expr); JoinNode node = getNodeFromExpr(ctx.planContext.getPlan(), expr); LogicalNode leftChild = getNonRelationListExpr(ctx.planContext.getPlan(), expr.getLeft()); LogicalNode rightChild = getNonRelationListExpr(ctx.planContext.getPlan(), expr.getRight()); node.setInSchema(SchemaUtil.merge(leftChild.getOutSchema(), rightChild.getOutSchema())); node.setOutSchema(node.getInSchema()); return node; }
@Override public LogicalNode visitJoin(ProcessorContext ctx, Stack<Expr> stack, Join expr) throws TajoException { super.visitJoin(ctx, stack, expr); JoinNode node = getNodeFromExpr(ctx.planContext.getPlan(), expr); LogicalNode leftChild = getNonRelationListExpr(ctx.planContext.getPlan(), expr.getLeft()); LogicalNode rightChild = getNonRelationListExpr(ctx.planContext.getPlan(), expr.getRight()); node.setInSchema(SchemaUtil.merge(leftChild.getOutSchema(), rightChild.getOutSchema())); node.setOutSchema(node.getInSchema()); return node; }
@Override public PlanString getPlanString() { PlanString planStr = new PlanString(this).appendTitle("(").appendTitle(joinSpec.getType().name()).appendTitle(")"); if (hasJoinQual()) { planStr.addExplan("Join Cond: " + joinSpec.getSingletonPredicate().toString()); } if (hasTargets()) { planStr.addExplan("target list: "); boolean first = true; for (Target target : targets) { if (!first) { planStr.appendExplain(", "); } planStr.appendExplain(target.toString()); first = false; } } planStr.addDetail("out schema: " + getOutSchema()); planStr.addDetail("in schema: " + getInSchema()); return planStr; }