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 2013/08/23 00:48:11 UTC

svn commit: r1516651 - /incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSinglePathsRule.java

Author: prestonc
Date: Thu Aug 22 22:48:11 2013
New Revision: 1516651

URL: http://svn.apache.org/r1516651
Log:
Updated the comments and fixed the order of execution. In addition DataSourceScan operator creates a cardinality of MANY.

Modified:
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSinglePathsRule.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=1516651&r1=1516650&r2=1516651&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 Aug 22 22:48:11 2013
@@ -32,12 +32,12 @@ import edu.uci.ics.hyracks.algebricks.co
 
 public class EliminateSubplanForSinglePathsRule implements IAlgebraicRewriteRule {
     /**
-     * Find where an unnest is followed by a subplan with the root operator of aggregate.
-     * Search pattern: unnest -> subplan -> (aggregate ... )
-     * Replacement pattern: assign -> ...
+     * Find where an subplan that only receives on tuple for input.
+     * Search pattern: subplan ( plan__nested )
+     * Replacement pattern: plan__nested
      */
     @Override
-    public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+    public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
         // Do not process empty or nested tuple source.
         AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
         if (op.getOperatorTag() == LogicalOperatorTag.EMPTYTUPLESOURCE
@@ -121,13 +121,13 @@ public class EliminateSubplanForSinglePa
                         .getNestedPlans().get(0).getRoots().get(0).getValue();
                 cardinalityVariable = vxqueryContext.getCardinalityOperatorMap(lastOperator);
                 break;
+            case DATASOURCESCAN:
             case UNNEST:
                 cardinalityVariable = Cardinality.MANY;
                 break;
 
             // The following operators do not change the variable.
             case ASSIGN:
-            case DATASOURCESCAN:
             case EMPTYTUPLESOURCE:
             case EXCHANGE:
             case LIMIT:
@@ -163,7 +163,7 @@ public class EliminateSubplanForSinglePa
     }
 
     @Override
-    public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) {
+    public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) {
         return false;
     }
 }