Return-Path: X-Original-To: apmail-asterixdb-commits-archive@minotaur.apache.org Delivered-To: apmail-asterixdb-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5A71A17BE9 for ; Fri, 24 Apr 2015 18:47:02 +0000 (UTC) Received: (qmail 26302 invoked by uid 500); 24 Apr 2015 18:47:02 -0000 Delivered-To: apmail-asterixdb-commits-archive@asterixdb.apache.org Received: (qmail 26269 invoked by uid 500); 24 Apr 2015 18:47:02 -0000 Mailing-List: contact commits-help@asterixdb.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.incubator.apache.org Delivered-To: mailing list commits@asterixdb.incubator.apache.org Received: (qmail 26260 invoked by uid 99); 24 Apr 2015 18:47:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Apr 2015 18:47:02 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of root@apache.org designates 54.191.145.13 as permitted sender) Received: from [54.191.145.13] (HELO mx1-us-west.apache.org) (54.191.145.13) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Apr 2015 18:46:56 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 4755A26013 for ; Fri, 24 Apr 2015 18:45:30 +0000 (UTC) Received: (qmail 19092 invoked by uid 99); 24 Apr 2015 18:45:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Apr 2015 18:45:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2AD56E091A; Fri, 24 Apr 2015 18:45:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: imaxon@apache.org To: commits@asterixdb.incubator.apache.org Date: Fri, 24 Apr 2015 18:46:32 -0000 Message-Id: <0cbd5fd4e2e24537ab5cd432fb0c2b17@git.apache.org> In-Reply-To: <0a743a5c99b842bf8de294f7df7a3d2b@git.apache.org> References: <0a743a5c99b842bf8de294f7df7a3d2b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [65/85] [abbrv] incubator-asterixdb-hyracks git commit: Fix issue 562. X-Virus-Checked: Checked by ClamAV on apache.org Fix issue 562. Change-Id: I2ce52bbed0ef98f965816f296303c7a21e2b148c Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/202 Tested-by: Jenkins Reviewed-by: Pouria Pirzadeh Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/commit/e1413cc9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/tree/e1413cc9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/diff/e1413cc9 Branch: refs/heads/master Commit: e1413cc9aa3d824f07637d5b3604e6fb524f04b6 Parents: 7527bbb Author: buyingyi Authored: Thu Jan 15 10:30:42 2015 -0800 Committer: Ian Maxon Committed: Fri Jan 16 09:28:15 2015 -0800 ---------------------------------------------------------------------- .../AbstractIntroduceGroupByCombinerRule.java | 6 ++--- .../rules/RemoveRedundantVariablesRule.java | 23 ++++++-------------- 2 files changed, 10 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e1413cc9/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java ---------------------------------------------------------------------- diff --git a/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java b/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java index 93f181f..b60c80d 100644 --- a/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java +++ b/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/AbstractIntroduceGroupByCombinerRule.java @@ -77,9 +77,9 @@ public abstract class AbstractIntroduceGroupByCombinerRule extends AbstractIntro // usedDecorVars should always contain only one variable. p.second.getValue().getUsedVariables(usedDecorVars); if (!newGbyLiveVars.contains(usedDecorVars.get(0))) { - LogicalVariable newDecorVar = context.newVar(); - newGbyOp.addDecorExpression(newDecorVar, p.second.getValue()); - p.second.setValue(new VariableReferenceExpression(newDecorVar)); + // 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()); } } newGbyOp.setExecutionMode(ExecutionMode.LOCAL); http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e1413cc9/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/RemoveRedundantVariablesRule.java ---------------------------------------------------------------------- diff --git a/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/RemoveRedundantVariablesRule.java b/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/RemoveRedundantVariablesRule.java index c34a52f..8b1aeb4 100644 --- a/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/RemoveRedundantVariablesRule.java +++ b/algebricks/algebricks-rewriter/src/main/java/edu/uci/ics/hyracks/algebricks/rewriter/rules/RemoveRedundantVariablesRule.java @@ -68,19 +68,12 @@ public class RemoveRedundantVariablesRule implements IAlgebraicRewriteRule { private final VariableSubstitutionVisitor substVisitor = new VariableSubstitutionVisitor(); private final Map> equivalentVarsMap = new HashMap>(); - protected boolean hasRun = false; - - @Override - public boolean rewritePost(Mutable opRef, IOptimizationContext context) { - return false; - } - @Override - public boolean rewritePre(Mutable opRef, IOptimizationContext context) throws AlgebricksException { + public boolean rewritePost(Mutable opRef, IOptimizationContext context) + throws AlgebricksException { if (context.checkIfInDontApplySet(this, opRef.getValue())) { return false; } - equivalentVarsMap.clear(); boolean modified = removeRedundantVariables(opRef, context); if (modified) { context.computeAndSetTypeEnvironmentForOperator(opRef.getValue()); @@ -88,6 +81,11 @@ public class RemoveRedundantVariablesRule implements IAlgebraicRewriteRule { return modified; } + @Override + public boolean rewritePre(Mutable opRef, IOptimizationContext context) throws AlgebricksException { + return false; + } + private void updateEquivalenceClassMap(LogicalVariable lhs, LogicalVariable rhs) { List equivalentVars = equivalentVarsMap.get(rhs); if (equivalentVars == null) { @@ -106,13 +104,6 @@ public class RemoveRedundantVariablesRule implements IAlgebraicRewriteRule { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); boolean modified = false; - // Recurse into children. - for (Mutable inputOpRef : op.getInputs()) { - if (removeRedundantVariables(inputOpRef, context)) { - modified = true; - } - } - // Update equivalence class map. if (op.getOperatorTag() == LogicalOperatorTag.ASSIGN) { AssignOperator assignOp = (AssignOperator) op;