@Override public ILogicalOperator visitLeftOuterJoinOperator(LeftOuterJoinOperator op, ILogicalOperator arg) throws AlgebricksException { LeftOuterJoinOperator opCopy = new LeftOuterJoinOperator(exprDeepCopyVisitor.deepCopyExpressionReference(op.getCondition()), deepCopyOperatorReference(op.getInputs().get(0), arg), deepCopyOperatorReference(op.getInputs().get(1), arg)); copyAnnotations(op, opCopy); copySourceLocation(op, opCopy); opCopy.setExecutionMode(op.getExecutionMode()); return opCopy; }
@Override public ILogicalOperator visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Void arg) throws AlgebricksException { return new LeftOuterJoinOperator(deepCopyExpressionRef(op.getCondition()), op.getInputs().get(0), op.getInputs().get(1)); }
order2.getInputs().add(new MutableObject<>(replicateOperator)); LeftOuterJoinOperator secondJoin = new LeftOuterJoinOperator(new MutableObject<>(ConstantExpression.TRUE)); secondJoin.setExecutionMode(PARTITIONED); secondJoin.getInputs().add(new MutableObject<>(order1)); secondJoin.getInputs().add(new MutableObject<>(order2));
LeftOuterJoinOperator loj = new LeftOuterJoinOperator(join.getCondition()); loj.setSourceLocation(join.getSourceLocation()); loj.getInputs().add(leftRef); loj.getInputs().add(rightRef); opRef.setValue(loj); context.computeAndSetTypeEnvironmentForOperator(loj); Mutable<ILogicalOperator> leftRef = join.getInputs().get(0); Mutable<ILogicalOperator> ntsRef = getNtsAtEndOfPipeline(leftRef); if (ntsRef == null) {
private boolean checkListifyAndConditionVar(LeftOuterJoinOperator lojOperator, LogicalVariable listifyVar, LogicalVariable conditionTestVar) throws AlgebricksException { ILogicalOperator rightJoinInputOp = lojOperator.getInputs().get(1).getValue(); Set<LogicalVariable> rightProducedVars = new HashSet<>(); VariableUtilities.getLiveVariables(rightJoinInputOp, rightProducedVars); if (!rightProducedVars.contains(conditionTestVar) || !rightProducedVars.contains(listifyVar)) { return false; } return true; }
@Override public Void visitLeftOuterJoinOperator(LeftOuterJoinOperator op, IOptimizationContext ctx) throws AlgebricksException { Map<LogicalVariable, EquivalenceClass> equivalenceClasses = new HashMap<LogicalVariable, EquivalenceClass>(); List<FunctionalDependency> functionalDependencies = new ArrayList<FunctionalDependency>(); ctx.putEquivalenceClassMap(op, equivalenceClasses); ctx.putFDList(op, functionalDependencies); ILogicalOperator opLeft = op.getInputs().get(0).getValue(); ILogicalOperator opRight = op.getInputs().get(1).getValue(); functionalDependencies.addAll(getOrComputeFDs(opLeft, ctx)); functionalDependencies.addAll(getOrComputeFDs(opRight, ctx)); equivalenceClasses.putAll(getOrComputeEqClasses(opLeft, ctx)); equivalenceClasses.putAll(getOrComputeEqClasses(opRight, ctx)); Collection<LogicalVariable> leftSideVars; if (opLeft.getSchema() == null) { leftSideVars = new LinkedList<LogicalVariable>(); VariableUtilities.getLiveVariables(opLeft, leftSideVars); // actually, not all produced vars. are visible (due to projection) // so using cached schema is better and faster } else { leftSideVars = opLeft.getSchema(); } ILogicalExpression expr = op.getCondition().getValue(); expr.getConstraintsForOuterJoin(functionalDependencies, leftSideVars); return null; }
new LeftOuterJoinOperator(new MutableObject<>(joinExpr), inputOpRef, rightInputOpRef); leftOuterJoinOp.setSourceLocation(sourceLoc); OperatorManipulationUtil.computeTypeEnvironmentBottomUp(rightInputOp, context); context.computeAndSetTypeEnvironmentForOperator(leftOuterJoinOp);
@Override public String visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Boolean showDetails) throws AlgebricksException { stringBuilder.setLength(0); stringBuilder.append("left outer join (").append(op.getCondition().getValue().toString()).append(")"); appendSchema(op, showDetails); appendAnnotations(op, showDetails); appendPhysicalOperatorInfo(op, showDetails); return stringBuilder.toString(); }
returnOp = new LeftOuterJoinOperator(op.getCondition()); returnOp.setSourceLocation(op.getSourceLocation()); returnOp.getInputs().addAll(op.getInputs());
exchangeOperator2.getInputs().add(new MutableObject<>(groupByOperator)); LeftOuterJoinOperator secondJoin = new LeftOuterJoinOperator(new MutableObject<>(ConstantExpression.TRUE)); secondJoin.setExecutionMode(PARTITIONED); secondJoin.getInputs().add(new MutableObject<>(exchangeOperator1)); secondJoin.getInputs().add(new MutableObject<>(exchangeOperator2));
@Override public ILogicalOperator visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Void arg) throws AlgebricksException { hasJoinAncestor = true; // Only rewrites the left child. ILogicalOperator newChild = op.getInputs().get(0).getValue().accept(this, null); op.getInputs().get(0).setValue(newChild); return op; }
@Override public Boolean visitLeftOuterJoinOperator(LeftOuterJoinOperator op, ILogicalOperator arg) throws AlgebricksException { AbstractLogicalOperator aop = (AbstractLogicalOperator) arg; if (aop.getOperatorTag() != LogicalOperatorTag.LEFTOUTERJOIN) { return Boolean.FALSE; } LeftOuterJoinOperator joinOpArg = (LeftOuterJoinOperator) copyAndSubstituteVar(op, arg); boolean isomorphic = op.getCondition().getValue().equals(joinOpArg.getCondition().getValue()); return isomorphic; }
break; case LEFT_OUTER: join = new LeftOuterJoinOperator(new MutableObject<ILogicalExpression>(whereCond.first)); break; default:
@Override public Boolean visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Void arg) throws AlgebricksException { // Check whether the left branch is a qualified branch. boolean isLeftBranchQualified = op.getInputs().get(0).getValue().accept(this, null); return !rejectPending && isLeftBranchQualified; }
@Override public Void visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Void arg) { op.getCondition().getValue().getUsedVariables(usedVariables); return null; }
@Override public Void visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Void arg) throws AlgebricksException { sweepExpression(op.getCondition().getValue()); return null; }
@Override public Void visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Pair<LogicalVariable, LogicalVariable> pair) throws AlgebricksException { op.getCondition().getValue().substituteVar(pair.first, pair.second); substVarTypes(op, pair); return null; }
private void setConditionForLeftOuterJoin(LeftOuterJoinOperator topJoin, Mutable<ILogicalExpression> expRef) { // Combine the conditions of top join of aqlplus plan and the original join AbstractFunctionCallExpression andFunc = new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(AlgebricksBuiltinFunctions.AND)); List<Mutable<ILogicalExpression>> conjs = new ArrayList<>(); if (topJoin.getCondition().getValue().splitIntoConjuncts(conjs)) { andFunc.getArguments().addAll(conjs); } else { andFunc.getArguments().add(new MutableObject<>(topJoin.getCondition().getValue())); } List<Mutable<ILogicalExpression>> conjs2 = new ArrayList<>(); if (expRef.getValue().splitIntoConjuncts(conjs2)) { andFunc.getArguments().addAll(conjs2); } else { andFunc.getArguments().add(expRef); } topJoin.getCondition().setValue(andFunc); }
@Override public Void visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("\"operator\": \"left-outer-join\",\n"); addIndent(indent).append("\"condition\": \"" + op.getCondition().getValue().accept(exprVisitor, indent) + "\""); return null; }
@Override public Void visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("left outer join (").append(op.getCondition().getValue().accept(exprVisitor, indent)) .append(")"); return null; }