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/02/24 02:42:32 UTC

[19/25] git commit: Found the order for checking used variables was off. Moved check to after nested plans.

Found the order for checking used variables was off. Moved check to after nested plans.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/ed696a53
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/ed696a53
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/ed696a53

Branch: refs/heads/master
Commit: ed696a53ef52aa1bea10322ad18536afb1401579
Parents: d88a64e
Author: Preston Carman <pr...@apache.org>
Authored: Mon Feb 17 16:47:22 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Mon Feb 17 16:47:22 2014 -0800

----------------------------------------------------------------------
 .../rewriter/rules/AbstractUsedVariablesProcessingRule.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/ed696a53/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
index c567909..04c6f1e 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
@@ -63,10 +63,9 @@ public abstract class AbstractUsedVariablesProcessingRule implements IAlgebraicR
     protected boolean rewritePreOnePass(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
             throws AlgebricksException {
         boolean modified = processOperator(opRef, context);
-
         AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
-        VariableUtilities.getUsedVariables(op, usedVariables);
 
+        // Descend into nested plans merging unnest along the way.
         if (op.hasNestedPlans()) {
             AbstractOperatorWithNestedPlans opwnp = (AbstractOperatorWithNestedPlans) op;
             for (ILogicalPlan rootPlans : opwnp.getNestedPlans()) {
@@ -78,6 +77,9 @@ public abstract class AbstractUsedVariablesProcessingRule implements IAlgebraicR
             }
         }
 
+        // Only add variables after operator is used.
+        VariableUtilities.getUsedVariables(op, usedVariables);
+
         // Descend into children merging unnest along the way.
         if (op.hasInputs()) {
             for (Mutable<ILogicalOperator> inputOpRef : op.getInputs()) {