You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2014/01/17 07:42:46 UTC
svn commit: r1559026 -
/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
Author: prestonc
Date: Fri Jan 17 06:42:46 2014
New Revision: 1559026
URL: http://svn.apache.org/r1559026
Log:
Added support for searching nested plans in used variable processing.
Modified:
incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java?rev=1559026&r1=1559025&r2=1559026&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java Fri Jan 17 06:42:46 2014
@@ -23,15 +23,17 @@ import org.apache.commons.lang3.mutable.
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalPlan;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractOperatorWithNestedPlans;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities;
import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
/**
* The AbstractUsedVariablesProcessingRule provides a frame work to track used
- * variables to assist in some rewrite rules that must track used variables in
+ * variables to assist in some rewrite rules that must track used variables in
* the above plan.
*
* @author prestonc
@@ -65,10 +67,23 @@ public abstract class AbstractUsedVariab
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
VariableUtilities.getUsedVariables(op, usedVariables);
+ if (op.hasNestedPlans()) {
+ AbstractOperatorWithNestedPlans opwnp = (AbstractOperatorWithNestedPlans) op;
+ for (ILogicalPlan rootPlans : opwnp.getNestedPlans()) {
+ for (Mutable<ILogicalOperator> inputOpRef : rootPlans.getRoots()) {
+ if (rewritePreOnePass(inputOpRef, context)) {
+ modified = true;
+ }
+ }
+ }
+ }
+
// Descend into children merging unnest along the way.
- for (Mutable<ILogicalOperator> inputOpRef : op.getInputs()) {
- if (rewritePreOnePass(inputOpRef, context)) {
- modified = true;
+ if (op.hasInputs()) {
+ for (Mutable<ILogicalOperator> inputOpRef : op.getInputs()) {
+ if (rewritePreOnePass(inputOpRef, context)) {
+ modified = true;
+ }
}
}