asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [50/51] [partial] incubator-asterixdb git commit: ASTERIXDB-1226: implement SQL++ core group-by semantics and syntatic sugars.
Date Mon, 28 Mar 2016 20:19:17 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
index 8627b97..a5fa9a6 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
@@ -222,6 +222,7 @@ public final class RuleCollections {
         fieldLoads.add(new ConstantFoldingRule());
         fieldLoads.add(new RemoveRedundantSelectRule());
         fieldLoads.add(new FeedScanCollectionToUnnest());
+        fieldLoads.add(new NestedSubplanToJoinRule());
         fieldLoads.add(new InlineSubplanInputForNestedTupleSourceRule());
         return fieldLoads;
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java
index 92439c6..2346b03 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java
@@ -21,14 +21,13 @@ package org.apache.asterix.optimizer.rules;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
@@ -63,7 +62,8 @@ public class PushAggregateIntoGroupbyRule implements IAlgebraicRewriteRule {
     }
 
     @Override
-    public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+    public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
+            throws AlgebricksException {
         Map<LogicalVariable, Integer> gbyAggVars = new HashMap<LogicalVariable, Integer>();
         Map<LogicalVariable, Integer> gbyAggVarToPlanIndex = new HashMap<LogicalVariable, Integer>();
         Map<LogicalVariable, GroupByOperator> gbyWithAgg = new HashMap<LogicalVariable, GroupByOperator>();
@@ -113,9 +113,7 @@ public class PushAggregateIntoGroupbyRule implements IAlgebraicRewriteRule {
                 change = true;
             }
         }
-        // Need to use a list instead of a hash-set, because a var. may appear
-        // several times in the same op.
-        List<LogicalVariable> used = new LinkedList<LogicalVariable>();
+        Set<LogicalVariable> used = new HashSet<>();
         VariableUtilities.getUsedVariables(op1, used);
         switch (op1.getOperatorTag()) {
             case ASSIGN:
@@ -132,8 +130,8 @@ public class PushAggregateIntoGroupbyRule implements IAlgebraicRewriteRule {
                     if (op1.getOperatorTag() == LogicalOperatorTag.ASSIGN) {
                         AssignOperator assign = (AssignOperator) op1;
                         for (Mutable<ILogicalExpression> exprRef : assign.getExpressions()) {
-                            Pair<Boolean, ILogicalExpression> p = extractAggFunctionsFromExpression(exprRef,
-                                    gbyWithAgg, aggregateExprToVarExpr, context);
+                            Pair<Boolean, ILogicalExpression> p = extractAggFunctionsFromExpression(exprRef, gbyWithAgg,
+                                    aggregateExprToVarExpr, context);
                             if (p.first) {
                                 change = true;
                                 exprRef.setValue(p.second);
@@ -173,7 +171,6 @@ public class PushAggregateIntoGroupbyRule implements IAlgebraicRewriteRule {
                         } else {
                             gbyListifyVarsCount.put(v, m + 1);
                         }
-                        break;
                     }
                 }
                 break;
@@ -247,7 +244,7 @@ public class PushAggregateIntoGroupbyRule implements IAlgebraicRewriteRule {
     private Pair<Boolean, ILogicalExpression> extractAggFunctionsFromExpression(Mutable<ILogicalExpression> exprRef,
             Map<LogicalVariable, GroupByOperator> gbyWithAgg,
             Map<ILogicalExpression, ILogicalExpression> aggregateExprToVarExpr, IOptimizationContext context)
-            throws AlgebricksException {
+                    throws AlgebricksException {
         ILogicalExpression expr = exprRef.getValue();
         switch (expr.getExpressionTag()) {
             case FUNCTION_CALL: {
@@ -299,7 +296,7 @@ public class PushAggregateIntoGroupbyRule implements IAlgebraicRewriteRule {
 
     private void rewriteGroupByAggregate(LogicalVariable oldAggVar, GroupByOperator gbyOp,
             AggregateFunctionCallExpression aggFun, LogicalVariable newAggVar, IOptimizationContext context)
-            throws AlgebricksException {
+                    throws AlgebricksException {
         for (int j = 0; j < gbyOp.getNestedPlans().size(); j++) {
             AggregateOperator aggOp = (AggregateOperator) gbyOp.getNestedPlans().get(j).getRoots().get(0).getValue();
             int n = aggOp.getVariables().size();
@@ -308,9 +305,8 @@ public class PushAggregateIntoGroupbyRule implements IAlgebraicRewriteRule {
                 if (v.equals(oldAggVar)) {
                     AbstractFunctionCallExpression oldAggExpr = (AbstractFunctionCallExpression) aggOp.getExpressions()
                             .get(i).getValue();
-                    AggregateFunctionCallExpression newAggFun = AsterixBuiltinFunctions
-                            .makeAggregateFunctionExpression(aggFun.getFunctionIdentifier(),
-                                    new ArrayList<Mutable<ILogicalExpression>>());
+                    AggregateFunctionCallExpression newAggFun = AsterixBuiltinFunctions.makeAggregateFunctionExpression(
+                            aggFun.getFunctionIdentifier(), new ArrayList<Mutable<ILogicalExpression>>());
                     for (Mutable<ILogicalExpression> arg : oldAggExpr.getArguments()) {
                         ILogicalExpression cloned = ((AbstractLogicalExpression) arg.getValue()).cloneExpression();
                         newAggFun.getArguments().add(new MutableObject<ILogicalExpression>(cloned));
@@ -402,8 +398,11 @@ public class PushAggregateIntoGroupbyRule implements IAlgebraicRewriteRule {
                 Mutable<ILogicalOperator> gbyAggRef = gbyOp.getNestedPlans().get(i).getRoots().get(0);
                 AggregateOperator gbyAgg = (AggregateOperator) gbyAggRef.getValue();
                 Mutable<ILogicalOperator> gbyAggChildRef = gbyAgg.getInputs().get(0);
-                OperatorManipulationUtil.substituteVarRec(aggInSubplanOp, unnestVar,
-                        findListifiedVariable(gbyAgg, varFromGroupAgg), true, context);
+                LogicalVariable listifyVar = findListifiedVariable(gbyAgg, varFromGroupAgg);
+                if (listifyVar == null) {
+                    continue;
+                }
+                OperatorManipulationUtil.substituteVarRec(aggInSubplanOp, unnestVar, listifyVar, true, context);
                 gbyAgg.getVariables().addAll(aggInSubplanOp.getVariables());
                 gbyAgg.getExpressions().addAll(aggInSubplanOp.getExpressions());
                 for (LogicalVariable v : aggInSubplanOp.getVariables()) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java
index 07f3ca3..4dc7bf4 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java
@@ -475,7 +475,7 @@ public class BTreeAccessMethod implements IAccessMethod {
             AssignOperator assignConstantSearchKeys = new AssignOperator(assignKeyVarList, assignKeyExprList);
             // Input to this assign is the EmptyTupleSource (which the dataSourceScan also must have had as input).
             assignConstantSearchKeys.getInputs().add(new MutableObject<ILogicalOperator>(
-                    OperatorManipulationUtil.deepCopyWithExcutionMode(dataSourceOp.getInputs().get(0).getValue())));
+                    OperatorManipulationUtil.deepCopy(dataSourceOp.getInputs().get(0).getValue())));
             assignConstantSearchKeys.setExecutionMode(dataSourceOp.getExecutionMode());
             inputOp = assignConstantSearchKeys;
         } else {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
index 25bcbca..06776ed 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
@@ -142,7 +142,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
 
     public boolean analyzeGetItemFuncExpr(AbstractFunctionCallExpression funcExpr,
             List<AbstractLogicalOperator> assignsAndUnnests, AccessMethodAnalysisContext analysisCtx)
-            throws AlgebricksException {
+                    throws AlgebricksException {
         if (funcExpr.getFunctionIdentifier() != AsterixBuiltinFunctions.GET_ITEM) {
             return false;
         }
@@ -396,7 +396,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
             inputOp = new AssignOperator(keyVarList, keyExprList);
             // Input to this assign is the EmptyTupleSource (which the dataSourceScan also must have had as input).
             inputOp.getInputs().add(new MutableObject<>(
-                    OperatorManipulationUtil.deepCopyWithExcutionMode(dataSourceScan.getInputs().get(0).getValue())));
+                    OperatorManipulationUtil.deepCopy(dataSourceScan.getInputs().get(0).getValue())));
             inputOp.setExecutionMode(dataSourceScan.getExecutionMode());
         } else {
             // We are optimizing a join. Add the input variable to the secondaryIndexFuncArgs.
@@ -836,7 +836,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
 
     private void addKeyVarsAndExprs(IOptimizableFuncExpr optFuncExpr, ArrayList<LogicalVariable> keyVarList,
             ArrayList<Mutable<ILogicalExpression>> keyExprList, IOptimizationContext context)
-            throws AlgebricksException {
+                    throws AlgebricksException {
         // For now we are assuming a single secondary index key.
         // Add a variable and its expr to the lists which will be passed into an assign op.
         LogicalVariable keyVar = context.newVar();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java
index a712542..eba2d33 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java
@@ -175,7 +175,7 @@ public class RTreeAccessMethod implements IAccessMethod {
     private ILogicalOperator createSecondaryToPrimaryPlan(OptimizableOperatorSubTree indexSubTree,
             OptimizableOperatorSubTree probeSubTree, Index chosenIndex, AccessMethodAnalysisContext analysisCtx,
             boolean retainInput, boolean retainNull, boolean requiresBroadcast, IOptimizationContext context)
-            throws AlgebricksException {
+                    throws AlgebricksException {
 
         IOptimizableFuncExpr optFuncExpr = AccessMethodUtils.chooseFirstOptFuncExpr(chosenIndex, analysisCtx);
         Dataset dataset = indexSubTree.dataset;
@@ -233,7 +233,7 @@ public class RTreeAccessMethod implements IAccessMethod {
             // We are optimizing a selection query.
             // Input to this assign is the EmptyTupleSource (which the dataSourceScan also must have had as input).
             assignSearchKeys.getInputs().add(new MutableObject<ILogicalOperator>(
-                    OperatorManipulationUtil.deepCopyWithExcutionMode(dataSourceOp.getInputs().get(0).getValue())));
+                    OperatorManipulationUtil.deepCopy(dataSourceOp.getInputs().get(0).getValue())));
             assignSearchKeys.setExecutionMode(dataSourceOp.getExecutionMode());
         } else {
             // We are optimizing a join, place the assign op top of the probe subtree.

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlExpressionToPlanTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlExpressionToPlanTranslator.java
index 48c9a7f..b5c9018 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlExpressionToPlanTranslator.java
@@ -77,7 +77,7 @@ class AqlExpressionToPlanTranslator extends LangExpressionToPlanTranslator imple
             throws AsterixException {
         LogicalVariable v = context.newVar(fc.getVarExpr());
         Expression inExpr = fc.getInExpr();
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(inExpr, tupSource);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(inExpr, tupSource);
         ILogicalOperator returnedOp;
 
         if (fc.getPosVarExpr() == null) {
@@ -152,7 +152,7 @@ class AqlExpressionToPlanTranslator extends LangExpressionToPlanTranslator imple
         List<Mutable<ILogicalExpression>> exprList = new ArrayList<Mutable<ILogicalExpression>>();
         Mutable<ILogicalOperator> input = null;
         for (Expression expr : dc.getDistinctByExpr()) {
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(expr, tupSource);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = langExprToAlgExpression(expr, tupSource);
             exprList.add(new MutableObject<ILogicalExpression>(p.first));
             input = p.second;
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
index 10f70f1..49e9399 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
@@ -61,8 +61,10 @@ import org.apache.asterix.lang.common.expression.RecordConstructor;
 import org.apache.asterix.lang.common.expression.UnaryExpr;
 import org.apache.asterix.lang.common.expression.UnaryExpr.Sign;
 import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.literal.StringLiteral;
 import org.apache.asterix.lang.common.statement.FunctionDecl;
 import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.lang.common.struct.OperatorType;
 import org.apache.asterix.lang.common.struct.QuantifiedPair;
 import org.apache.asterix.lang.common.util.FunctionUtil;
@@ -556,7 +558,7 @@ class LangExpressionToPlanTranslator
             }
             default: {
                 v = context.newVar(lc.getVarExpr());
-                Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(lc.getBindingExpr(),
+                Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(lc.getBindingExpr(),
                         tupSource);
                 returnedOp = new AssignOperator(v, new MutableObject<ILogicalExpression>(eo.first));
                 returnedOp.getInputs().add(eo.second);
@@ -569,7 +571,7 @@ class LangExpressionToPlanTranslator
     @Override
     public Pair<ILogicalOperator, LogicalVariable> visit(FieldAccessor fa, Mutable<ILogicalOperator> tupSource)
             throws AsterixException {
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(fa.getExpr(), tupSource);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = langExprToAlgExpression(fa.getExpr(), tupSource);
         LogicalVariable v = context.newVar();
         AbstractFunctionCallExpression fldAccess = new ScalarFunctionCallExpression(
                 FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME));
@@ -585,7 +587,7 @@ class LangExpressionToPlanTranslator
     @Override
     public Pair<ILogicalOperator, LogicalVariable> visit(IndexAccessor ia, Mutable<ILogicalOperator> tupSource)
             throws AsterixException {
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(ia.getExpr(), tupSource);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = langExprToAlgExpression(ia.getExpr(), tupSource);
         LogicalVariable v = context.newVar();
         AbstractFunctionCallExpression f;
         if (ia.isAny()) {
@@ -593,7 +595,7 @@ class LangExpressionToPlanTranslator
                     FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.ANY_COLLECTION_MEMBER));
             f.getArguments().add(new MutableObject<ILogicalExpression>(p.first));
         } else {
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> indexPair = aqlExprToAlgExpression(ia.getIndexExpr(),
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> indexPair = langExprToAlgExpression(ia.getIndexExpr(),
                     tupSource);
             f = new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.GET_ITEM));
             f.getArguments().add(new MutableObject<ILogicalExpression>(p.first));
@@ -626,7 +628,7 @@ class LangExpressionToPlanTranslator
                     break;
                 }
                 default: {
-                    Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(expr, topOp);
+                    Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(expr, topOp);
                     AbstractLogicalOperator o1 = (AbstractLogicalOperator) eo.second.getValue();
                     args.add(new MutableObject<ILogicalExpression>(eo.first));
                     if (o1 != null && !(o1.getOperatorTag() == LogicalOperatorTag.ASSIGN && hasOnlyChild(o1, topOp))) {
@@ -733,7 +735,7 @@ class LangExpressionToPlanTranslator
             } else {
                 v = context.newVar();
             }
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(ve.getExpr(), topOp);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(ve.getExpr(), topOp);
             gOp.addGbyExpression(v, eo.first);
             topOp = eo.second;
         }
@@ -745,12 +747,31 @@ class LangExpressionToPlanTranslator
             } else {
                 v = context.newVar();
             }
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(ve.getExpr(), topOp);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(ve.getExpr(), topOp);
             gOp.addDecorExpression(v, eo.first);
             topOp = eo.second;
         }
-        gOp.getInputs().add(topOp);
 
+        if (gc.hasGroupVar()) {
+            List<Pair<Expression, Identifier>> groupFieldList = gc.getGroupFieldList();
+            List<Mutable<ILogicalExpression>> groupRecordConstructorArgList = new ArrayList<>();
+            for (Pair<Expression, Identifier> groupField : groupFieldList) {
+                ILogicalExpression groupFieldNameExpr = langExprToAlgExpression(
+                        new LiteralExpr(new StringLiteral(groupField.second.getValue())), topOp).first;
+                groupRecordConstructorArgList.add(new MutableObject<ILogicalExpression>(groupFieldNameExpr));
+                ILogicalExpression groupFieldExpr = langExprToAlgExpression(groupField.first, topOp).first;
+                groupRecordConstructorArgList.add(new MutableObject<ILogicalExpression>(groupFieldExpr));
+            }
+            LogicalVariable groupVar = context.newVar(gc.getGroupVar());
+            AssignOperator groupVarAssignOp = new AssignOperator(groupVar,
+                    new MutableObject<ILogicalExpression>(new ScalarFunctionCallExpression(
+                            FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.OPEN_RECORD_CONSTRUCTOR),
+                            groupRecordConstructorArgList)));
+            groupVarAssignOp.getInputs().add(topOp);
+            topOp = new MutableObject<ILogicalOperator>(groupVarAssignOp);
+        }
+
+        gOp.getInputs().add(topOp);
         for (VariableExpr var : gc.getWithVarList()) {
             LogicalVariable aggVar = context.newVar();
             LogicalVariable oldVar = context.getVar(var);
@@ -858,7 +879,7 @@ class LangExpressionToPlanTranslator
         ILogicalExpression currExpr = null;
         for (int i = 0; i <= nOps; i++) {
 
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(exprs.get(i), topOp);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = langExprToAlgExpression(exprs.get(i), topOp);
             topOp = p.second;
             ILogicalExpression e = p.first;
             // now look at the operator
@@ -934,7 +955,7 @@ class LangExpressionToPlanTranslator
         Iterator<OrderModifier> modifIter = oc.getModifierList().iterator();
         Mutable<ILogicalOperator> topOp = tupSource;
         for (Expression e : oc.getOrderbyList()) {
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(e, topOp);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = langExprToAlgExpression(e, topOp);
             OrderModifier m = modifIter.next();
             OrderOperator.IOrder comp = (m == OrderModifier.ASC) ? OrderOperator.ASC_ORDER : OrderOperator.DESC_ORDER;
             ord.getOrderExpressions().add(new Pair<IOrder, Mutable<ILogicalExpression>>(comp,
@@ -966,7 +987,7 @@ class LangExpressionToPlanTranslator
         Mutable<ILogicalOperator> lastOp = null;
 
         for (QuantifiedPair qt : qe.getQuantifiedList()) {
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo1 = aqlExprToAlgExpression(qt.getExpr(), topOp);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo1 = langExprToAlgExpression(qt.getExpr(), topOp);
             topOp = eo1.second;
             LogicalVariable uVar = context.newVar(qt.getVarExpr());
             ILogicalOperator u = new UnnestOperator(uVar,
@@ -986,7 +1007,7 @@ class LangExpressionToPlanTranslator
         firstOp.getInputs().add(topOp);
         topOp = lastOp;
 
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo2 = aqlExprToAlgExpression(qe.getSatisfiesExpr(), topOp);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo2 = langExprToAlgExpression(qe.getSatisfiesExpr(), topOp);
 
         AggregateFunctionCallExpression fAgg;
         SelectOperator s;
@@ -1026,10 +1047,10 @@ class LangExpressionToPlanTranslator
         AssignOperator a = new AssignOperator(v1, new MutableObject<ILogicalExpression>(f));
         Mutable<ILogicalOperator> topOp = tupSource;
         for (FieldBinding fb : rc.getFbList()) {
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo1 = aqlExprToAlgExpression(fb.getLeftExpr(), topOp);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo1 = langExprToAlgExpression(fb.getLeftExpr(), topOp);
             f.getArguments().add(new MutableObject<ILogicalExpression>(eo1.first));
             topOp = eo1.second;
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo2 = aqlExprToAlgExpression(fb.getRightExpr(), topOp);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo2 = langExprToAlgExpression(fb.getRightExpr(), topOp);
             f.getArguments().add(new MutableObject<ILogicalExpression>(eo2.first));
             topOp = eo2.second;
         }
@@ -1047,7 +1068,7 @@ class LangExpressionToPlanTranslator
         AssignOperator a = new AssignOperator(v1, new MutableObject<ILogicalExpression>(f));
         Mutable<ILogicalOperator> topOp = tupSource;
         for (Expression expr : lc.getExprList()) {
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(expr, topOp);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(expr, topOp);
             f.getArguments().add(new MutableObject<ILogicalExpression>(eo.first));
             topOp = eo.second;
         }
@@ -1059,7 +1080,7 @@ class LangExpressionToPlanTranslator
     public Pair<ILogicalOperator, LogicalVariable> visit(UnaryExpr u, Mutable<ILogicalOperator> tupSource)
             throws AsterixException {
         Expression expr = u.getExpr();
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(expr, tupSource);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(expr, tupSource);
         LogicalVariable v1 = context.newVar();
         AssignOperator a;
         if (u.getSign() == Sign.POSITIVE) {
@@ -1088,7 +1109,7 @@ class LangExpressionToPlanTranslator
     @Override
     public Pair<ILogicalOperator, LogicalVariable> visit(WhereClause w, Mutable<ILogicalOperator> tupSource)
             throws AsterixException {
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(w.getWhereExpr(), tupSource);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = langExprToAlgExpression(w.getWhereExpr(), tupSource);
         SelectOperator s = new SelectOperator(new MutableObject<ILogicalExpression>(p.first), false, null);
         s.getInputs().add(p.second);
         return new Pair<ILogicalOperator, LogicalVariable>(s, null);
@@ -1097,11 +1118,11 @@ class LangExpressionToPlanTranslator
     @Override
     public Pair<ILogicalOperator, LogicalVariable> visit(LimitClause lc, Mutable<ILogicalOperator> tupSource)
             throws AsterixException {
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p1 = aqlExprToAlgExpression(lc.getLimitExpr(), tupSource);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p1 = langExprToAlgExpression(lc.getLimitExpr(), tupSource);
         LimitOperator opLim;
         Expression offset = lc.getOffset();
         if (offset != null) {
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p2 = aqlExprToAlgExpression(offset, p1.second);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p2 = langExprToAlgExpression(offset, p1.second);
             opLim = new LimitOperator(p1.first, p2.first);
             opLim.getInputs().add(p2.second);
         } else {
@@ -1204,7 +1225,7 @@ class LangExpressionToPlanTranslator
         return inp.get(0) == childCandidate;
     }
 
-    protected Pair<ILogicalExpression, Mutable<ILogicalOperator>> aqlExprToAlgExpression(Expression expr,
+    protected Pair<ILogicalExpression, Mutable<ILogicalOperator>> langExprToAlgExpression(Expression expr,
             Mutable<ILogicalOperator> topOpRef) throws AsterixException {
         switch (expr.getKind()) {
             case VARIABLE_EXPRESSION: {
@@ -1283,7 +1304,7 @@ class LangExpressionToPlanTranslator
         AbstractFunctionCallExpression f = createFunctionCallExpressionForBuiltinOperator(opLogical);
 
         for (int i = 0; i <= nOps; i++) {
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(exprs.get(i), topOp);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = langExprToAlgExpression(exprs.get(i), topOp);
             topOp = p.second;
             // now look at the operator
             if (i < nOps) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
index b3d6bea..b3df571 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
@@ -112,7 +112,7 @@ class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTranslator imp
             return queryBody.accept(this, tupSource);
         } else {
             LogicalVariable var = context.newVar();
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(queryBody, tupSource);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(queryBody, tupSource);
             AssignOperator assignOp = new AssignOperator(var, new MutableObject<ILogicalExpression>(eo.first));
             assignOp.getInputs().add(eo.second);
             ProjectOperator projectOp = new ProjectOperator(var);
@@ -214,7 +214,7 @@ class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTranslator imp
             throws AsterixException {
         LogicalVariable fromVar = context.newVar(fromTerm.getLeftVariable());
         Expression fromExpr = fromTerm.getLeftExpression();
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(fromExpr, tupSource);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(fromExpr, tupSource);
         ILogicalOperator unnestOp;
         if (fromTerm.hasPositionalVariable()) {
             LogicalVariable pVar = context.newVar(fromTerm.getPositionalVariable());
@@ -259,7 +259,7 @@ class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTranslator imp
             Mutable<ILogicalOperator> joinOpRef = new MutableObject<ILogicalOperator>(joinOperator);
 
             // Add an additional filter operator.
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> conditionExprOpPair = aqlExprToAlgExpression(
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> conditionExprOpPair = langExprToAlgExpression(
                     joinClause.getConditionExpression(), joinOpRef);
             SelectOperator filter = new SelectOperator(new MutableObject<ILogicalExpression>(conditionExprOpPair.first),
                     false, null);
@@ -281,7 +281,7 @@ class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTranslator imp
             UnnestOperator rightUnnestOp = (UnnestOperator) rightBranch.first;
 
             // Adds an additional filter operator for the join condition.
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> conditionExprOpPair = aqlExprToAlgExpression(
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> conditionExprOpPair = langExprToAlgExpression(
                     joinClause.getConditionExpression(), new MutableObject<ILogicalOperator>(rightUnnestOp));
             SelectOperator filter = new SelectOperator(new MutableObject<ILogicalExpression>(conditionExprOpPair.first),
                     false, null);
@@ -405,7 +405,7 @@ class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTranslator imp
     @Override
     public Pair<ILogicalOperator, LogicalVariable> visit(HavingClause havingClause, Mutable<ILogicalOperator> tupSource)
             throws AsterixException {
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = langExprToAlgExpression(
                 havingClause.getFilterExpression(), tupSource);
         SelectOperator s = new SelectOperator(new MutableObject<ILogicalExpression>(p.first), false, null);
         s.getInputs().add(p.second);
@@ -417,7 +417,7 @@ class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTranslator imp
                     throws AsterixException {
         LogicalVariable rightVar = context.newVar(binaryCorrelate.getRightVariable());
         Expression rightExpr = binaryCorrelate.getRightExpression();
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(rightExpr, inputOpRef);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(rightExpr, inputOpRef);
         ILogicalOperator unnestOp;
         if (binaryCorrelate.hasPositionalVariable()) {
             LogicalVariable pVar = context.newVar(binaryCorrelate.getPositionalVariable());
@@ -448,7 +448,7 @@ class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTranslator imp
             }
             returnExpr = new RecordConstructor(fieldBindings);
         }
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(returnExpr, tupSrc);
+        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(returnExpr, tupSrc);
         LogicalVariable returnVar;
         ILogicalOperator returnOperator;
         if (returnExpr.getKind() == Kind.VARIABLE_EXPRESSION) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
index 07bea69..d6cf231 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
@@ -174,6 +174,7 @@ public class ParserTestExecutor extends TestExecutor {
                         + "org.apache.asterix.lang.common.rewrites.LangRewritingContext)",
                 declaredFunctions, topExpr, metadataProvider, context);
         PA.invokeMethod(rewriter, "inlineColumnAlias()");
+        PA.invokeMethod(rewriter, "rewriteGroupBys()");
         PA.invokeMethod(rewriter, "variableCheckAndRewrite(boolean)", Boolean.TRUE);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
index e1134d4..d40c37b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
@@ -31,7 +31,7 @@ RecordConstructor [
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -39,7 +39,7 @@ RecordConstructor [
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -53,7 +53,7 @@ RecordConstructor [
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -61,7 +61,7 @@ RecordConstructor [
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -71,23 +71,23 @@ RecordConstructor [
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=countA
           ]
           =
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -100,12 +100,12 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -115,7 +115,7 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
index 446767e..5c0d782 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
@@ -31,7 +31,7 @@ RecordConstructor [
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -39,7 +39,7 @@ RecordConstructor [
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -53,7 +53,7 @@ RecordConstructor [
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -61,7 +61,7 @@ RecordConstructor [
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -71,37 +71,37 @@ RecordConstructor [
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=countA
             ]
             =
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=countB
             ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -114,12 +114,12 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -129,7 +129,7 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_01.ast
index 4f09cdf..e569587 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_01.ast
@@ -13,12 +13,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp1 ]
+  Variable [ Name=$emp1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp2 ]
+  Variable [ Name=$emp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=fname
       ]
       >
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=fname
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=lname
       ]
       >
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=lname
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_02.ast
index f0d41fe..eaedfc8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_02.ast
@@ -13,12 +13,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp1 ]
+  Variable [ Name=$emp1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp2 ]
+  Variable [ Name=$emp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=fname
       ]
       <
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=fname
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=lname
       ]
       <
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=lname
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_03.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_03.ast
index 2c7afc9..b8e4be5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-join_03.ast
@@ -13,12 +13,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp1 ]
+  Variable [ Name=$emp1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp2 ]
+  Variable [ Name=$emp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=fname
       ]
       =
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=fname
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=lname
       ]
       =
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=lname
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.ast
index f7fadc3..23838af 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_01.ast
@@ -13,12 +13,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp1 ]
+  Variable [ Name=$emp1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp2 ]
+  Variable [ Name=$emp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=fname
       ]
       <
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=fname
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=lname
       ]
       >
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=lname
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.ast
index b93e19c..9b8a744 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_02.ast
@@ -13,12 +13,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp1 ]
+  Variable [ Name=$emp1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp2 ]
+  Variable [ Name=$emp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=fname
       ]
       >
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=fname
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=lname
       ]
       <
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=lname
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.ast
index ebce41c..9c19a99 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_03.ast
@@ -13,12 +13,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp1 ]
+  Variable [ Name=$emp1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp2 ]
+  Variable [ Name=$emp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=fname
       ]
       >
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=fname
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=lname
       ]
       =
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=lname
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.ast
index 9df93e5..0dba494 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_04.ast
@@ -13,12 +13,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp1 ]
+  Variable [ Name=$emp1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp2 ]
+  Variable [ Name=$emp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=fname
       ]
       <
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=fname
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=lname
       ]
       =
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=lname
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.ast
index 706408b..df5155d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_05.ast
@@ -13,12 +13,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp1 ]
+  Variable [ Name=$emp1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp2 ]
+  Variable [ Name=$emp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=fname
       ]
       =
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=fname
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=lname
       ]
       >
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=lname
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.ast
index 37e4c37..3cd7b3b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-composite-key-prefix-join_06.ast
@@ -13,12 +13,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp1 ]
+  Variable [ Name=$emp1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Names]
   ]
   AS
-  Variable [ Name=emp2 ]
+  Variable [ Name=$emp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=fname
       ]
       =
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=fname
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp1 ]
+        Variable [ Name=$emp1 ]
         Field=lname
       ]
       <
       FieldAccessor [
-        Variable [ Name=emp2 ]
+        Variable [ Name=$emp2 ]
         Field=lname
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-multipred.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-multipred.ast
index 0c18407..d100ca6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-multipred.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-multipred.ast
@@ -38,12 +38,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [customer]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
   (
     LiteralExpr [STRING] [order]
     :
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
   )
 ]
 ]
@@ -51,48 +51,48 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=cid
       ]
       =
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=cid
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=name
       ]
       <
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=orderstatus
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=age
       ]
       <
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=cid
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_01.ast
index 99f152e..77ccb17 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_01.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-equi-join-neg_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key1
     ]
     =
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key2
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_02.ast
index 0ebc8c2..c4a3066 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join-neg_02.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-equi-join-neg_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key2
     ]
     =
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key1
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_01.ast
index f4223ca..363e2d1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_01.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-equi-join_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key1
     ]
     =
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key2
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_02.ast
index 71107ee..e6df727 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_02.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-equi-join_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key2
     ]
     =
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key1
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_03.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_03.ast
index 0f22337..b5cd3df 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_03.ast
@@ -38,12 +38,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [customer]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
   (
     LiteralExpr [STRING] [order]
     :
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
   )
 ]
 ]
@@ -51,23 +51,23 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     =
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=cid
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_04.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_04.ast
index b604d5b..a286fa1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_04.ast
@@ -38,12 +38,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [customer]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
   (
     LiteralExpr [STRING] [order]
     :
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
   )
 ]
 ]
@@ -51,23 +51,23 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=cid
     ]
     =
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_05.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_05.ast
index f8d0856..a816f41 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-equi-join_05.ast
@@ -27,12 +27,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [customer1]
     :
-    Variable [ Name=c1 ]
+    Variable [ Name=$c1 ]
   )
   (
     LiteralExpr [STRING] [customer2]
     :
-    Variable [ Name=c2 ]
+    Variable [ Name=$c2 ]
   )
 ]
 ]
@@ -40,23 +40,23 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c1 ]
+  Variable [ Name=$c1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c2 ]
+  Variable [ Name=$c2 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c1 ]
+      Variable [ Name=$c1 ]
       Field=cid
     ]
     =
     FieldAccessor [
-      Variable [ Name=c2 ]
+      Variable [ Name=$c2 ]
       Field=cid
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_01.ast
index d58dd45..cdea847 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_01.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-ge-join_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key1
     ]
     >=
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key2
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_02.ast
index eb7c8a8..1bab83f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-ge-join_02.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-ge-join_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key2
     ]
     <=
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key1
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_01.ast
index 879a7b4..b05edcd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_01.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-gt-join_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key1
     ]
     >
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key2
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_02.ast
index 5ea0fe0..b5149ae 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-gt-join_02.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-gt-join_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key2
     ]
     <
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key1
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_01.ast
index b11fc1e..c978bae 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_01.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-le-join_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key1
     ]
     <=
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key2
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_02.ast
index adc0c32..3ca0c87 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-le-join_02.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-le-join_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key2
     ]
     >=
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key1
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_01.ast
index 0999788..e8fb351 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_01.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-lt-join_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key1
     ]
     <
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key2
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_02.ast
index a2e9b35..0caecd8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/primary-lt-join_02.ast
@@ -11,29 +11,29 @@ DatasetDecl DsTwo(TestType) partitioned by [[key1]]
 WriteOutputTo asterix_nc1:rttest/btree-index-join_primary-lt-join_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsOne]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test1.DsTwo]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=key2
     ]
     >
     FieldAccessor [
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
       Field=key1
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multiindex.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multiindex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multiindex.ast
index ca8900c..42f474a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multiindex.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multiindex.ast
@@ -41,7 +41,7 @@ RecordConstructor [
     LiteralExpr [STRING] [fbu-ID]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
   )
@@ -49,7 +49,7 @@ RecordConstructor [
     LiteralExpr [STRING] [fbm-auth-ID]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=author-id
     ]
   )
@@ -57,7 +57,7 @@ RecordConstructor [
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -65,7 +65,7 @@ RecordConstructor [
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
   )
@@ -75,31 +75,31 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=message ]
+  Variable [ Name=$message ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       =
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=author-id-copy
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       >=
@@ -108,7 +108,7 @@ Where
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       <=

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multipred.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multipred.ast
index 09b41cd..e816d36 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multipred.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join-multipred.ast
@@ -26,12 +26,12 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,48 +39,48 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
       =
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=authors
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=authors
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=misc
       ]
       >
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=misc
       ]
     ]



Mime
View raw message