Repository: asterixdb
Updated Branches:
  refs/heads/master e65a57ab2 -> 8b664f3d0


Fixed UsedVariableVisitor for the Splitoperator

 - The used variables of SplitOperator and ReplicateOperator
   now don't include the used variables from their output(s).

Change-Id: Iae861c1339cf00c5a53aa2b5b5b14113ec53484b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1273
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyin...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/8b664f3d
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/8b664f3d
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/8b664f3d

Branch: refs/heads/master
Commit: 8b664f3d018c7af1661d75ad017f7034a1f9ee95
Parents: e65a57a
Author: Taewoo Kim <wangs...@yahoo.com>
Authored: Wed Oct 12 20:31:52 2016 -0700
Committer: Taewoo Kim <wangs...@yahoo.com>
Committed: Wed Oct 12 22:24:37 2016 -0700

----------------------------------------------------------------------
 .../operators/logical/visitors/UsedVariableVisitor.java       | 7 +------
 .../rewriter/rules/RemoveUnusedAssignAndAggregateRule.java    | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8b664f3d/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/UsedVariableVisitor.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/UsedVariableVisitor.java
 
b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/UsedVariableVisitor.java
index cfe2a37..3daa00f 100644
--- 
a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/UsedVariableVisitor.java
+++ 
b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/UsedVariableVisitor.java
@@ -428,17 +428,12 @@ public class UsedVariableVisitor implements 
ILogicalOperatorVisitor<Void, Void>
 
     @Override
     public Void visitReplicateOperator(ReplicateOperator op, Void arg) throws 
AlgebricksException {
-        for (Mutable<ILogicalOperator> outputOp : op.getOutputs()) {
-            VariableUtilities.getUsedVariables(outputOp.getValue(), 
usedVariables);
-        }
         return null;
     }
 
     @Override
     public Void visitSplitOperator(SplitOperator op, Void arg) throws 
AlgebricksException {
-        for (Mutable<ILogicalOperator> outputOp : op.getOutputs()) {
-            VariableUtilities.getUsedVariables(outputOp.getValue(), 
usedVariables);
-        }
+        op.getBranchingExpression().getValue().getUsedVariables(usedVariables);
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8b664f3d/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/RemoveUnusedAssignAndAggregateRule.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/RemoveUnusedAssignAndAggregateRule.java
 
b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/RemoveUnusedAssignAndAggregateRule.java
index 55831f0..5bf4e68 100644
--- 
a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/RemoveUnusedAssignAndAggregateRule.java
+++ 
b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/RemoveUnusedAssignAndAggregateRule.java
@@ -383,7 +383,7 @@ public class RemoveUnusedAssignAndAggregateRule implements 
IAlgebraicRewriteRule
             // We may have visited this operator before if there are multiple
             // paths in the plan.
             if (accumulatedUsedVarFromRootMap.containsKey(opRef)) {
-                
accumulatedUsedVarFromRootMap.get(opRef).addAll(usedVarsSetInThisOp);
+                
accumulatedUsedVarFromRootMap.get(opRef).addAll(accumulatedUsedVarFromRootSet);
             } else {
                 accumulatedUsedVarFromRootMap.put(opRef, new 
HashSet<LogicalVariable>(accumulatedUsedVarFromRootSet));
             }

Reply via email to