public static void getSubplanLocalLiveVariables(ILogicalOperator op, Collection<LogicalVariable> liveVariables) throws AlgebricksException { VariableUtilities.getLiveVariables(op, liveVariables); Set<LogicalVariable> locallyProducedVars = new HashSet<>(); VariableUtilities.getProducedVariablesInDescendantsAndSelf(op, locallyProducedVars); liveVariables.retainAll(locallyProducedVars); }
@Override public Void visitSubplanOperator(SubplanOperator op, Void arg) throws AlgebricksException { Set<LogicalVariable> producedVars = new HashSet<>(); Set<LogicalVariable> liveVars = new HashSet<>(); for (ILogicalPlan p : op.getNestedPlans()) { for (Mutable<ILogicalOperator> r : p.getRoots()) { VariableUtilities.getProducedVariablesInDescendantsAndSelf(r.getValue(), producedVars); VariableUtilities.getSubplanLocalLiveVariables(r.getValue(), liveVars); } } producedVars.retainAll(liveVars); producedVariables.addAll(producedVars); return null; }
public static void getProducedVariablesInDescendantsAndSelf(ILogicalOperator op, Collection<LogicalVariable> vars) throws AlgebricksException { // DFS traversal VariableUtilities.getProducedVariables(op, vars); for (Mutable<ILogicalOperator> c : op.getInputs()) { getProducedVariablesInDescendantsAndSelf(c.getValue(), vars); } }
aggOp.getExpressions().remove(pos); List<LogicalVariable> producedVarsAtAgg = new ArrayList<>(); VariableUtilities.getProducedVariablesInDescendantsAndSelf(aggOp, producedVarsAtAgg); if (producedVarsAtAgg.isEmpty()) { removeList.add(new Pair<>(nspOp, nspAggVarToPlanIndex.get(aggVar)));
ILogicalOperator topOp = r.getValue(); Set<LogicalVariable> producedVars = new ListSet<LogicalVariable>(); VariableUtilities.getProducedVariablesInDescendantsAndSelf(topOp, producedVars); if (producedVars.size() == 0) { rootsToBeRemoved.add(r);
VariableUtilities.getProducedVariablesInDescendantsAndSelf(op3, subplanProducedAndDown); used.removeAll(subplanProducedAndDown); } else {
VariableUtilities.getProducedVariablesInDescendantsAndSelf(subplanInput, producedVars);