List of usage examples for org.apache.commons.lang3.mutable Mutable getValue
T getValue();
From source file:edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.java
private static void computeSchemaBottomUpForPlan(ILogicalPlan p) throws AlgebricksException { for (Mutable<ILogicalOperator> r : p.getRoots()) { computeSchemaBottomUpForOp((AbstractLogicalOperator) r.getValue()); }/* w w w.ja va 2s . com*/ }
From source file:edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer.java
private static void computeSchemaBottomUpForOp(AbstractLogicalOperator op) throws AlgebricksException { for (Mutable<ILogicalOperator> i : op.getInputs()) { computeSchemaBottomUpForOp((AbstractLogicalOperator) i.getValue()); }//from w ww . ja v a 2s . co m if (op.hasNestedPlans()) { AbstractOperatorWithNestedPlans a = (AbstractOperatorWithNestedPlans) op; for (ILogicalPlan p : a.getNestedPlans()) { computeSchemaBottomUpForPlan(p); } } op.recomputeSchema(); }
From source file:edu.uci.ics.asterix.optimizer.base.AnalysisUtil.java
public static int numberOfVarsInExpr(ILogicalExpression e) { switch (((AbstractLogicalExpression) e).getExpressionTag()) { case CONSTANT: { return 0; }// w w w . j ava2s. c o m case FUNCTION_CALL: { AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) e; int s = 0; for (Mutable<ILogicalExpression> arg : f.getArguments()) { s += numberOfVarsInExpr(arg.getValue()); } return s; } case VARIABLE: { return 1; } default: { assert false; throw new IllegalArgumentException(); } } }
From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.PushSelectDownRule.java
private static boolean propagateSelectionRec(Mutable<ILogicalOperator> sigmaRef, Mutable<ILogicalOperator> opRef2) throws AlgebricksException { AbstractLogicalOperator op2 = (AbstractLogicalOperator) opRef2.getValue(); if (op2.getInputs().size() != 1 || op2.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) { return false; }//from w w w . j a v a 2 s .c om SelectOperator sigma = (SelectOperator) sigmaRef.getValue(); LinkedList<LogicalVariable> usedInSigma = new LinkedList<LogicalVariable>(); sigma.getCondition().getValue().getUsedVariables(usedInSigma); LinkedList<LogicalVariable> produced2 = new LinkedList<LogicalVariable>(); VariableUtilities.getProducedVariables(op2, produced2); if (OperatorPropertiesUtil.disjoint(produced2, usedInSigma)) { // just swap opRef2.setValue(sigma); sigmaRef.setValue(op2); List<Mutable<ILogicalOperator>> sigmaInpList = sigma.getInputs(); sigmaInpList.clear(); sigmaInpList.addAll(op2.getInputs()); List<Mutable<ILogicalOperator>> op2InpList = op2.getInputs(); op2InpList.clear(); op2InpList.add(opRef2); propagateSelectionRec(opRef2, sigma.getInputs().get(0)); return true; } return false; }
From source file:edu.uci.ics.asterix.optimizer.rules.DisjunctivePredicateToJoinRule.java
private static SelectOperator asSelectOperator(Mutable<ILogicalOperator> op) { return asSelectOperator(op.getValue()); }
From source file:edu.uci.ics.asterix.optimizer.base.AnalysisUtil.java
public final static ILogicalOperator firstChildOfType(AbstractLogicalOperator op, LogicalOperatorTag opType) { List<Mutable<ILogicalOperator>> ins = op.getInputs(); if (ins == null || ins.isEmpty()) { return null; }/*from ww w .java 2 s . co m*/ Mutable<ILogicalOperator> opRef2 = ins.get(0); AbstractLogicalOperator op2 = (AbstractLogicalOperator) opRef2.getValue(); if (op2.getOperatorTag() == opType) { return op2; } else { return null; } }
From source file:edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.PlanPlotter.java
public static void printLogicalPlan(ILogicalPlan plan) throws AlgebricksException { int indent = 5; StringBuilder out = new StringBuilder(); int randomInt = 10000 + randomGenerator.nextInt(100); appendln(out, "digraph G {"); for (Mutable<ILogicalOperator> root : plan.getRoots()) { printVisualizationGraph((AbstractLogicalOperator) root.getValue(), indent, out, "", randomInt); }/*w w w . j a v a 2 s . co m*/ appendln(out, "\n}\n}"); try { File file = File.createTempFile("logicalPlan", ".txt"); FileUtils.writeStringToFile(file, out.toString()); file.deleteOnExit(); } catch (IOException e) { e.printStackTrace(); } }
From source file:edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.PlanPlotter.java
public static void printOptimizedLogicalPlan(ILogicalPlan plan) throws AlgebricksException { int indent = 5; StringBuilder out = new StringBuilder(); int randomInt = 10000 + randomGenerator.nextInt(100); appendln(out, "digraph G {"); for (Mutable<ILogicalOperator> root : plan.getRoots()) { printVisualizationGraph((AbstractLogicalOperator) root.getValue(), indent, out, "", randomInt); }//w w w .ja v a 2 s . c o m appendln(out, "\n}\n}"); try { File file = File.createTempFile("logicalOptimizedPlan", ".txt"); FileUtils.writeStringToFile(file, out.toString()); file.deleteOnExit(); } catch (IOException e) { e.printStackTrace(); } }
From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.ComplexJoinInferenceRule.java
private static boolean subplanHasFreeVariables(SubplanOperator s) throws AlgebricksException { for (ILogicalPlan p : s.getNestedPlans()) { for (Mutable<ILogicalOperator> r : p.getRoots()) { if (OperatorPropertiesUtil.hasFreeVariablesInSelfOrDesc((AbstractLogicalOperator) r.getValue())) { return true; }/*from w w w .jav a 2s. co m*/ } } return false; }
From source file:edu.uci.ics.asterix.optimizer.rules.DisjunctivePredicateToJoinRule.java
private static AbstractFunctionCallExpression asFunctionCallExpression(Mutable<ILogicalExpression> ex, FunctionIdentifier fi) {// w ww . j a v a 2 s. c om return asFunctionCallExpression(ex.getValue(), fi); }