@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; }
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 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 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 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; }
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) {