asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ildar Absalyamov (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: ASTERIXDB-1229: - Fixed RemoveRedundantListifyRule to consid...
Date Tue, 15 Dec 2015 02:37:38 GMT
Ildar Absalyamov has uploaded a new change for review.

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

Change subject: ASTERIXDB-1229: - Fixed RemoveRedundantListifyRule to consider general expressions
......................................................................

ASTERIXDB-1229:
- Fixed RemoveRedundantListifyRule to consider general expressions

Change-Id: I5e7b6f5ca4ed51e91de371b9d0b4e4dabdd2f2df
---
M asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveRedundantListifyRule.java
1 file changed, 11 insertions(+), 7 deletions(-)


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

diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveRedundantListifyRule.java
b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveRedundantListifyRule.java
index b9c10f9..5d876bf 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveRedundantListifyRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveRedundantListifyRule.java
@@ -20,7 +20,6 @@
 
 import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
 import org.apache.asterix.lang.common.util.FunctionUtil;
@@ -241,16 +240,21 @@
         if (!unnest.getVariable().equals(aggInputVar)) {
             return false;
         }
-        List<LogicalVariable> unnestSource = new ArrayList<LogicalVariable>();
-        VariableUtilities.getUsedVariables(unnest, unnestSource);
-        if (unnestSource.size() > 1 || unnestSource.size() <= 0) {
+        ILogicalExpression unnestArg = unnest.getExpressionRef().getValue();
+        if (unnestArg.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
             return false;
         }
+        AbstractFunctionCallExpression scanFunc = (AbstractFunctionCallExpression) unnestArg;
+        if (scanFunc.getFunctionIdentifier() != AsterixBuiltinFunctions.SCAN_COLLECTION)
{
+            return false;
+        }
+        if (scanFunc.getArguments().size() != 1) {
+            return false;
+        }
+
         ArrayList<LogicalVariable> assgnVars = new ArrayList<LogicalVariable>(1);
         assgnVars.add(aggVar);
-        ArrayList<Mutable<ILogicalExpression>> assgnExprs = new ArrayList<Mutable<ILogicalExpression>>(1);
-        assgnExprs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(unnestSource.get(0))));
-        AssignOperator assign = new AssignOperator(assgnVars, assgnExprs);
+        AssignOperator assign = new AssignOperator(assgnVars, scanFunc.getArguments());
         assign.getInputs().add(unnest.getInputs().get(0));
         context.computeAndSetTypeEnvironmentForOperator(assign);
         opRef.setValue(assign);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e7b6f5ca4ed51e91de371b9d0b4e4dabdd2f2df
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Ildar Absalyamov <ildar.absalyamov@gmail.com>

Mime
View raw message