vxquery-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject svn commit: r1535558 - in /incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules: EliminateSubplanForSinglePathsRule.java EliminateUnnestAggregateSequencesRule.java
Date Thu, 24 Oct 2013 21:30:47 GMT
Author: prestonc
Date: Thu Oct 24 21:30:47 2013
New Revision: 1535558

URL: http://svn.apache.org/r1535558
Log:
Updated comments and the plan now uses a new variable id for variables created by the rewrite
rule.

Modified:
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSinglePathsRule.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSequencesRule.java

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSinglePathsRule.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSinglePathsRule.java?rev=1535558&r1=1535557&r2=1535558&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSinglePathsRule.java
(original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSinglePathsRule.java
Thu Oct 24 21:30:47 2013
@@ -57,6 +57,9 @@ public class EliminateSubplanForSinglePa
     @Override
     public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext
context)
             throws AlgebricksException {
+        // TODO Fix EliminateSubplanForSinglePathsRule to check for variables used after
the subplan.
+        // TODO Add back to the rewrite rule list once fixed.
+        
         // Do not process empty or nested tuple source.
         AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
         if (op.getOperatorTag() == LogicalOperatorTag.EMPTYTUPLESOURCE
@@ -67,6 +70,10 @@ public class EliminateSubplanForSinglePa
         // Set cardinality in the context. Must update each time the rule is run.
         VXQueryOptimizationContext vxqueryContext = (VXQueryOptimizationContext) context;
         Cardinality cardinalityVariable = CardinalityRuleToolbox.getProducerCardinality(opRef.getValue(),
vxqueryContext);
+        
+        // Track variables created
+        
+        // Track variables used
 
         if (op.getOperatorTag() == LogicalOperatorTag.SUBPLAN && cardinalityVariable
== Cardinality.ONE) {
             SubplanOperator subplan = (SubplanOperator) op;

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSequencesRule.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSequencesRule.java?rev=1535558&r1=1535557&r2=1535558&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSequencesRule.java
(original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSequencesRule.java
Thu Oct 24 21:30:47 2013
@@ -25,7 +25,9 @@ import edu.uci.ics.hyracks.algebricks.co
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
@@ -93,10 +95,12 @@ public class EliminateUnnestAggregateSeq
 
         // Replace search string with assign.
         Mutable<ILogicalExpression> assignExpression = functionCall2.getArguments().get(0);
-        AssignOperator aOp = new AssignOperator(unnest.getVariable(), assignExpression);
+        LogicalVariable assignVariable = context.newVar();
+        AssignOperator aOp = new AssignOperator(assignVariable, assignExpression);
         for (Mutable<ILogicalOperator> input : aggregate.getInputs()) {
             aOp.getInputs().add(input);
         }
+        functionCall.getArguments().get(0).setValue(new VariableReferenceExpression(assignVariable));
         unnest.getInputs().get(0).setValue(aOp);
 
         return true;



Mime
View raw message