Xikui Wang has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2858

Change subject: [NO-ISSUE][COMP] Miscellaneous Fixes in Compiler
......................................................................

[NO-ISSUE][COMP] Miscellaneous Fixes in Compiler

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
1. AlgebricksAbsolutePartitionConstraint location was not sorted.
2. AggregateOperator was not using the right type env.
3. AbstractIntroduceGroupByCombinerRule should not include vars that are
added already.

Change-Id: Ibfc9459d0ccfc257e2c1b15f32d2697dcfbfcf42
---
M 
hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
M 
hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AggregateOperator.java
M 
hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java
3 files changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/58/2858/1

diff --git 
a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
 
b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
index b6443c4..1bb217a 100644
--- 
a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
+++ 
b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
@@ -28,7 +28,7 @@
 
     public AlgebricksAbsolutePartitionConstraint(String[] locations) {
         this.locations = locations.clone();
-        Arrays.sort(locations);
+        Arrays.sort(this.locations);
     }
 
     @Override
diff --git 
a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AggregateOperator.java
 
b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AggregateOperator.java
index b4a59a8..689f84e 100644
--- 
a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AggregateOperator.java
+++ 
b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AggregateOperator.java
@@ -100,7 +100,7 @@
     public IVariableTypeEnvironment 
computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
         IVariableTypeEnvironment env =
                 new 
NonPropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), 
ctx.getMetadataProvider());
-        IVariableTypeEnvironment env2 = 
ctx.getOutputTypeEnvironment(inputs.get(0).getValue());
+        IVariableTypeEnvironment env2 = this.computeInputTypeEnvironment(ctx);
         int n = variables.size();
         for (int i = 0; i < n; i++) {
             Object t = 
ctx.getExpressionTypeComputer().getType(expressions.get(i).getValue(), 
ctx.getMetadataProvider(),
diff --git 
a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java
 
b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java
index dc48d96..b33cc77 100644
--- 
a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java
+++ 
b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java
@@ -88,6 +88,7 @@
                 // Let the left-hand side of gbyOp's decoration expressions 
populated through the combiner group-by without
                 // any intermediate assignment.
                 newGbyOp.addDecorExpression(null, p.second.getValue());
+                newGbyLiveVars.add(usedDecorVars.get(0));
             }
         }
         newGbyOp.setExecutionMode(ExecutionMode.LOCAL);
@@ -104,7 +105,7 @@
         OperatorPropertiesUtil.getFreeVariablesInSubplans(gbyOp, freeVars);
 
         for (LogicalVariable var : freeVars) {
-            if (!propagatedVars.contains(var)) {
+            if (!propagatedVars.contains(var) && 
!newGbyLiveVars.contains(var)) {
                 LogicalVariable newDecorVar = context.newVar();
                 VariableReferenceExpression varRef = new 
VariableReferenceExpression(var);
                 varRef.setSourceLocation(gbyOp.getSourceLocation());

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2858
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfc9459d0ccfc257e2c1b15f32d2697dcfbfcf42
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Xikui Wang <[email protected]>

Reply via email to