ASTERIXDB-1226: implement SQL++ core group-by semantics and syntatic sugars.

-Implmented SQL++ core group-by semantics;
-Implemented SQL++ group-by syntatic sugars for standard SQL;
-Added test cases;
-Fixed column alias rewriter;
-Fixed the variable scoping for joins.

Change-Id: I6e5477d5bf80114cfff49c8ecb163849ee55eba6
Reviewed-on: https://asterix-gerrit.ics.uci.edu/752
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
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 @@
         fieldLoads.add(new ConstantFoldingRule());
         fieldLoads.add(new RemoveRedundantSelectRule());
         fieldLoads.add(new FeedScanCollectionToUnnest());
+        fieldLoads.add(new NestedSubplanToJoinRule());
         fieldLoads.add(new InlineSubplanInputForNestedTupleSourceRule());
         return fieldLoads;
     }
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 @@
 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 org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableObject;
+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.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 @@
     }
 
     @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 @@
                 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 @@
                     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 @@
                         } else {
                             gbyListifyVarsCount.put(v, m + 1);
                         }
-                        break;
                     }
                 }
                 break;
@@ -247,7 +244,7 @@
     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 @@
 
     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 @@
                 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 @@
                 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()) {
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 @@
             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 {
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 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 @@
             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 @@
 
     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();
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 @@
     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 @@
             // 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.
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 @@
             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 @@
         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;
         }
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.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 @@
             }
             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 @@
     @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 @@
     @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 @@
                     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 @@
                     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 @@
             } 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 @@
             } 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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
     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 @@
     @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 @@
     @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 @@
         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 @@
         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) {
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 @@
             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 @@
             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 @@
             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 @@
             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 @@
     @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 @@
                     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 @@
             }
             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) {
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 @@
                         + "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);
     }
 
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 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -39,7 +39,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -53,7 +53,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -61,7 +61,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -71,23 +71,23 @@
           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 @@
     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 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
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 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -39,7 +39,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -53,7 +53,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -61,7 +61,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -71,37 +71,37 @@
           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 @@
     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 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
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 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@
     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
       ]
     ]
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 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@
     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
       ]
     ]
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 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@
     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
       ]
     ]
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 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@
     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
       ]
     ]
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 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@
     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
       ]
     ]
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 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@
     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
       ]
     ]
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 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@
     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
       ]
     ]
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 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@
     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
       ]
     ]
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 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -26,36 +26,36 @@
     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
       ]
     ]
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 @@
   (
     LiteralExpr [STRING] [customer]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
   (
     LiteralExpr [STRING] [order]
     :
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
   )
 ]
 ]
@@ -51,48 +51,48 @@
     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
       ]
     ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
   (
     LiteralExpr [STRING] [customer]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
   (
     LiteralExpr [STRING] [order]
     :
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
   )
 ]
 ]
@@ -51,23 +51,23 @@
     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
     ]
   ]
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 @@
   (
     LiteralExpr [STRING] [customer]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
   (
     LiteralExpr [STRING] [order]
     :
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
   )
 ]
 ]
@@ -51,23 +51,23 @@
     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
     ]
   ]
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 @@
   (
     LiteralExpr [STRING] [customer1]
     :
-    Variable [ Name=c1 ]
+    Variable [ Name=$c1 ]
   )
   (
     LiteralExpr [STRING] [customer2]
     :
-    Variable [ Name=c2 ]
+    Variable [ Name=$c2 ]
   )
 ]
 ]
@@ -40,23 +40,23 @@
     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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
 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
     ]
   ]
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 @@
     LiteralExpr [STRING] [fbu-ID]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
   )
@@ -49,7 +49,7 @@
     LiteralExpr [STRING] [fbm-auth-ID]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=author-id
     ]
   )
@@ -57,7 +57,7 @@
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -65,7 +65,7 @@
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
   )
@@ -75,31 +75,31 @@
     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 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       <=
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 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,48 +39,48 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_01.ast
index 4ebabb1..76f6bd4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_01.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,23 +39,23 @@
     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 [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_02.ast
index 0335901..bbb77d8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_02.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,23 +39,23 @@
     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 [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_03.ast
index 6fe369a..3764ad9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index-join/secondary-equi-join_03.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -29,23 +29,23 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-01.ast
index 129cf33..5e65a25 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-01.ast
@@ -11,7 +11,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emergency ]
+  Variable [ Name=$emergency ]
   Field=message
 ]
 ]
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [CHPReports]
   ]
   AS
-  Variable [ Name=emergency ]
+  Variable [ Name=$emergency ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emergency ]
+        Variable [ Name=$emergency ]
         Field=timestamp
       ]
       >=
@@ -41,7 +41,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emergency ]
+        Variable [ Name=$emergency ]
         Field=title
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-02.ast
index 3197add..e8316a1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-02.ast
@@ -10,15 +10,15 @@
 DatasetDecl CHPReports(CHPReport) partitioned by [[timestamp]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emergency ]
+Variable [ Name=$emergency ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CHPReports]
   ]
   AS
-  Variable [ Name=emergency ]
+  Variable [ Name=$emergency ]
 ]
-LetVariable [ Name=time ]
+Let Variable [ Name=$time ]
   :=
   OperatorExpr [
     FunctionCall emergencyTest.current-datetime@0[
@@ -31,9 +31,9 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emergency ]
+      Variable [ Name=$emergency ]
       Field=timestamp
     ]
     >=
-    Variable [ Name=time ]
+    Variable [ Name=$time ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-03.ast
index 7b7241a..8ab6f65 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-03.ast
@@ -10,18 +10,18 @@
 DatasetDecl CHPReports(CHPReport) partitioned by [[timestamp]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emergency ]
+Variable [ Name=$emergency ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CHPReports]
   ]
   AS
-  Variable [ Name=emergency ]
+  Variable [ Name=$emergency ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emergency ]
+      Variable [ Name=$emergency ]
       Field=timestamp
     ]
     >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-04.ast
index 4abc056..a77d90d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-datetime-04.ast
@@ -10,18 +10,18 @@
 DatasetDecl CHPReports(CHPReport) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emergency ]
+Variable [ Name=$emergency ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CHPReports]
   ]
   AS
-  Variable [ Name=emergency ]
+  Variable [ Name=$emergency ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emergency ]
+      Variable [ Name=$emergency ]
       Field=timestamp
     ]
     >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-01.ast
index 4d9b31b..e1171fd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-01.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-02.ast
index d94a0d8..2d631e9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-02.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-03.ast
index cd87f66..26342a2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-03.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-04.ast
index 0bbd59a..99d927c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-04.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-05.ast
index 21314c3..454aa2a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-05.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     !=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-06.ast
index 68165cf..9728b71 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-06.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-07.ast
index 93a442d..1b173a6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-07.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-07.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=lname
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-08.ast
index 57333bf..d495bd5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-08.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-08.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-09.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-09.ast
index 4f62337..937614a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-09.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-09.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -30,7 +30,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-10.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-10.ast
index 34bc801..f5e7250 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-10.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-10.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-11.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-11.ast
index fa50dd8..51f9008 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-11.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-11.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-12.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-12.ast
index 684a1c4..5fad48f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-12.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-12.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-13.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-13.ast
index cd2d0b3..e244a3c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-13.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-13.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-14.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-14.ast
index 7a7ae8e..cad85cf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-14.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-14.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-15.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-15.ast
index adc650e..3e4ce8e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-15.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-15.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -48,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-16.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-16.ast
index cd75cd7..d5c4b08 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-16.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-16.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -48,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-17.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-17.ast
index 548fd23..0c5a2ef 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-17.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-17.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-18.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-18.ast
index 28a0386..1ebf9dc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-18.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-18.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       !=
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       !=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-19.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-19.ast
index cea4898..f5d165a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-19.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-19.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -48,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-20.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-20.ast
index 8a39ef3..643bd68 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-20.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-20.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -48,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-21.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-21.ast
index e80da82..6c95c8e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-21.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-21.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-22.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-22.ast
index be8ce2d..1b7f14c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-22.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-22.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-23.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-23.ast
index 2a214a9..1489177 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-23.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-23.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-24.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-24.ast
index 5de5103..bfd6ec7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-24.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-24.ast
@@ -9,18 +9,18 @@
 DatasetDecl testdst(TestType) partitioned by [[fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-25.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-25.ast
index 68ebbf9..250593b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-25.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-25.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-26.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-26.ast
index d4773cf..3e5f4ad 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-26.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-26.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-27.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-27.ast
index 166a1d6..1b557e1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-27.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-27.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -48,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-28.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-28.ast
index f7b1a53..9de9899 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-28.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-28.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -48,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-29.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-29.ast
index 9f0e41d..b545fe0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-29.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-29.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -48,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-30.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-30.ast
index 0911e9d..dcaad7a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-30.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-30.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -48,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-31.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-31.ast
index 1cd0947..cfa51cc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-31.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-31.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-32.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-32.ast
index 30f9339..0b650e5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-32.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-primary-32.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-33.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-33.ast
index a227595..e617f89 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-33.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-33.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-34.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-34.ast
index 9ecf631..1ad5684 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-34.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-34.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-35.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-35.ast
index e38e198..d123ecc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-35.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-35.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-36.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-36.ast
index 46262f4..0a26c3f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-36.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-36.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-37.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-37.ast
index 63cc4f4..a527ee8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-37.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-37.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     !=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-38.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-38.ast
index 3707d36..ccc261a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-38.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-38.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-39.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-39.ast
index 2b32bdd..e050940 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-39.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-39.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=lname
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-40.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-40.ast
index 7e60f3a..60f834a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-40.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-40.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-41.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-41.ast
index 25a367b..88b4bc7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-41.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-41.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -31,7 +31,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-42.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-42.ast
index 952b6b2..38ddc06 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-42.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-42.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-43.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-43.ast
index faddc6b..28ef712 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-43.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-43.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-44.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-44.ast
index 191620a..9e3d870 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-44.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-44.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-45.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-45.ast
index 3235b31..d7cca40 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-45.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-45.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-46.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-46.ast
index 782fc58..90a0220 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-46.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-46.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-47.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-47.ast
index 36a1479..ebd604a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-47.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-47.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -40,7 +40,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -49,7 +49,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-48.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-48.ast
index 499d3b8..1960561 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-48.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-48.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
@@ -40,7 +40,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -49,7 +49,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-49.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-49.ast
index dabbfbd..6add2f0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-49.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-49.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-50.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-50.ast
index 77ff2d3..f9e6dca 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-50.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-50.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       !=
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       !=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-51.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-51.ast
index 536bd41..4002159 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-51.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-51.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -40,7 +40,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -49,7 +49,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-52.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-52.ast
index 2bc44f4..f4c2592 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-52.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-52.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
@@ -40,7 +40,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -49,7 +49,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-53.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-53.ast
index 7c61b36..6d301c4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-53.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-53.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
@@ -40,7 +40,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -49,7 +49,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-54.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-54.ast
index ad0c531..2c5b71e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-54.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-54.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-55.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-55.ast
index c6da81c..a9597c2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-55.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-55.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-56.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-56.ast
index d4c4b38..206efab 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-56.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-56.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-57.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-57.ast
index 8b459b8..f1f64fc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-57.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-57.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-58.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-58.ast
index 93e6f82..40cb76e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-58.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-58.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-59.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-59.ast
index c9f2905..f2e1cfd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-59.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-59.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-60.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-60.ast
index c002770..eb2ef9d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-60.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-60.ast
@@ -10,18 +10,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-61.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-61.ast
index 82f5967..ef77d3d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-61.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-61.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -40,7 +40,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -49,7 +49,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-62.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-62.ast
index 6c787a7..88655f2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-62.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-62.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-63.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-63.ast
index bc515e5..d858883 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-63.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/btree-index/btree-secondary-63.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/collocated.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/collocated.ast
index 0c5b63a..3bdd7a4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/collocated.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/collocated.ast
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [user_name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -33,7 +33,7 @@
     LiteralExpr [STRING] [visitor_name]
     :
     FieldAccessor [
-      Variable [ Name=visitor ]
+      Variable [ Name=$visitor ]
       Field=name
     ]
   )
@@ -43,23 +43,23 @@
     LiteralExpr [STRING] [Users]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Visitors]
   ]
   AS
-  Variable [ Name=visitor ]
+  Variable [ Name=$visitor ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=uid
     ]
     =
     FieldAccessor [
-      Variable [ Name=visitor ]
+      Variable [ Name=$visitor ]
       Field=vid
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-complex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-complex.ast
index aeb9d72..3082677 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-complex.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-complex.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [Paper]
     :
-    Variable [ Name=paper_tokens ]
+    Variable [ Name=$paper_tokens ]
   )
   (
     LiteralExpr [STRING] [Query]
     :
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$query_tokens ]
   )
 ]
 ]
@@ -29,62 +29,62 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
   ]
-LetVariable [ Name=jacca ]
+Let Variable [ Name=$jacca ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.8]
   ]
-LetVariable [ Name=jaccb ]
+Let Variable [ Name=$jaccb ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.5]
   ]
-LetVariable [ Name=jaccc ]
+Let Variable [ Name=$jaccc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.3]
   ]
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=jacca ]
+      Variable [ Name=$jacca ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     IndexAccessor [
-      Variable [ Name=jaccb ]
+      Variable [ Name=$jaccb ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=authors
       ]
       =
       LiteralExpr [STRING] [testauth]
     ]
     and
-    Variable [ Name=jaccc ]
+    Variable [ Name=$jaccc ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-simple.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-simple.ast
index a1f58f9..3b3e1ec 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-simple.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/consolidate-selects-simple.ast
@@ -15,19 +15,19 @@
 WriteOutputTo asterix_nc1:rttest/consolidate-selects-simple.aql
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_name
       ]
       =
@@ -36,7 +36,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_address
       ]
       =
@@ -45,7 +45,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_nationkey
       ]
       =
@@ -54,7 +54,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_phone
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
index 8788c8d..b4dd527 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
@@ -16,13 +16,24 @@
   (
     LiteralExpr [STRING] [word]
     :
-    Variable [ Name=tok ]
+    Variable [ Name=$tok ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall twitter.count@1[
-      Variable [ Name=token ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=token
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -31,28 +42,34 @@
     LiteralExpr [STRING] [TwitterData]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [tokens]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall twitter.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=text
     ]
   ]
 Groupby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=tokens ]
-  Variable [ Name=t ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$tokens ]
+   AS tokens
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$t ]
+   AS t
+  )
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/cust_group_no_agg.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/cust_group_no_agg.ast
index edbb7b3..7157aa2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/cust_group_no_agg.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/cust_group_no_agg.ast
@@ -15,21 +15,25 @@
 WriteOutputTo asterix_nc1:/tmp/.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=name ]
+Variable [ Name=$name ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Groupby
-  Variable [ Name=name ]
+  Variable [ Name=$name ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=c_name
   ]
-  With
-  Variable [ Name=c ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$c ]
+   AS c
+  )
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
index 76345c9..e734a11 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
@@ -38,7 +38,7 @@
   (
     LiteralExpr [STRING] [cid]
     :
-    Variable [ Name=cid ]
+    Variable [ Name=$cid ]
   )
   (
     LiteralExpr [STRING] [cust]
@@ -51,13 +51,24 @@
     LiteralExpr [STRING] [cnt-orders]
     :
     FunctionCall custorder.count@1[
-      Variable [ Name=o ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=o
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
   (
     LiteralExpr [STRING] [orders]
     :
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
   )
 ]
 ]
@@ -65,34 +76,39 @@
     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
     ]
   ]
 Groupby
-  Variable [ Name=cid ]
+  Variable [ Name=$cid ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
-  With
-  Variable [ Name=c ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$o ]
+   AS o
+  Variable [ Name=$c ]
+   AS c
+  )
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast
index 6c38372..0ef35c0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast
@@ -27,18 +27,29 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [count_suppkey]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=g ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#3 ]
+          Field=g
+        ]
+        ]
+        FROM [          Variable [ Name=#2 ]
+          AS
+          Variable [ Name=#3 ]
+        ]
+      )
     ]
   )
 ]
@@ -49,17 +60,17 @@
       (
         LiteralExpr [STRING] [l_returnflag]
         :
-        Variable [ Name=l_returnflag ]
+        Variable [ Name=$l_returnflag ]
       )
       (
         LiteralExpr [STRING] [l_linestatus]
         :
-        Variable [ Name=l_linestatus ]
+        Variable [ Name=$l_linestatus ]
       )
       (
         LiteralExpr [STRING] [l_suppkey]
         :
-        Variable [ Name=l_suppkey ]
+        Variable [ Name=$l_suppkey ]
       )
     ]
     ]
@@ -67,62 +78,70 @@
         LiteralExpr [STRING] [LineItems_q1]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_shipdate
         ]
         <=
         LiteralExpr [STRING] [1998-09-02]
       ]
     Groupby
-      Variable [ Name=l_returnflag ]
+      Variable [ Name=$l_returnflag ]
       :=
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_returnflag
       ]
-      Variable [ Name=l_linestatus ]
+      Variable [ Name=$l_linestatus ]
       :=
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_linestatus
       ]
-      Variable [ Name=l_suppkey ]
+      Variable [ Name=$l_suppkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_suppkey
       ]
-      With
-      Variable [ Name=l ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$l ]
+       AS l
+      )
 
   )
   AS
-  Variable [ Name=g ]
+  Variable [ Name=$g ]
 ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=g ]
+    Variable [ Name=$g ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=g ]
+    Variable [ Name=$g ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=g ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$g ]
+   AS g
+  )
 
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/filter-nested.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/filter-nested.ast
index 3152f71..5971ca5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/filter-nested.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/filter-nested.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,13 +23,13 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast
index 9479898..8eaada8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
 ]
 ]
@@ -39,54 +39,54 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [tokensDBLP]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [tokensCSX]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=unrankedTokensDBLP ]
+Let Variable [ Name=$unrankedTokensDBLP ]
   :=
   FunctionCall fj-dblp-csx.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=unrankedTokensDBLP ]
+    FROM [      Variable [ Name=$unrankedTokensDBLP ]
       AS
-      Variable [ Name=token ]
+      Variable [ Name=$token ]
 ,
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
         ]
@@ -94,53 +94,53 @@
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
         ]
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=token ]
+        Variable [ Name=$token ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=idCSX ]
+Let Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-LetVariable [ Name=unrankedTokensCSX ]
+Let Variable [ Name=$unrankedTokensCSX ]
   :=
   FunctionCall fj-dblp-csx.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=title
     ]
   ]
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=unrankedTokensCSX ]
+    FROM [      Variable [ Name=$unrankedTokensCSX ]
       AS
-      Variable [ Name=token ]
+      Variable [ Name=$token ]
 ,
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
         ]
@@ -148,53 +148,66 @@
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
         ]
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=token ]
+        Variable [ Name=$token ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Where
   OperatorExpr [
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$prefixTokenDBLP ]
     =
-    Variable [ Name=prefixTokenCSX ]
+    Variable [ Name=$prefixTokenCSX ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
-  Variable [ Name=idDBLP ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idDBLP ]
+  Variable [ Name=$idCSX ]
   :=
-  Variable [ Name=idCSX ]
-  With
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=unrankedTokensCSX ]
-  Variable [ Name=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=unrankedTokensDBLP ]
-  Variable [ Name=idDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$idCSX ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$unrankedTokensCSX ]
+   AS unrankedTokensCSX
+  Variable [ Name=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$unrankedTokensDBLP ]
+   AS unrankedTokensDBLP
+  Variable [ Name=$idDBLP ]
+   AS idDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
index df1d620..665925e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
@@ -25,14 +25,14 @@
     LiteralExpr [STRING] [uid]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=uid
     ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokens ]
+    Variable [ Name=$tokens ]
   )
 ]
 ]
@@ -40,69 +40,85 @@
     LiteralExpr [STRING] [Users]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=lottery_numbers
       ]
       AS
-      Variable [ Name=lottery_number ]
+      Variable [ Name=$lottery_number ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=item ]
+        Variable [ Name=$item ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Users]
           ]
           AS
-          Variable [ Name=user ]
+          Variable [ Name=$user ]
 ,
           FieldAccessor [
-            Variable [ Name=user ]
+            Variable [ Name=$user ]
             Field=lottery_numbers
           ]
           AS
-          Variable [ Name=lottery_number ]
+          Variable [ Name=$lottery_number ]
         ]
         Groupby
-          Variable [ Name=item ]
+          Variable [ Name=$item ]
           :=
-          Variable [ Name=lottery_number ]
-          With
-          Variable [ Name=lottery_number ]
-          Variable [ Name=user ]
+          Variable [ Name=$lottery_number ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$lottery_number ]
+           AS lottery_number
+          Variable [ Name=$user ]
+           AS user
+          )
 
-        LetVariable [ Name=count ]
+        Let Variable [ Name=$count ]
           :=
           FunctionCall rares03.count@1[
-            Variable [ Name=user ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=user
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
         Orderby
-          Variable [ Name=count ]
+          Variable [ Name=$count ]
           DESC
 
       )
       AS
-      Variable [ Name=token ]
+      Variable [ Name=$token ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=lottery_number ]
+        Variable [ Name=$lottery_number ]
         =
-        Variable [ Name=token ]
+        Variable [ Name=$token ]
       ]
     Orderby
-      Variable [ Name=token ]
+      Variable [ Name=$token ]
       ASC
 
   )
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
index de7bc06..d5f7086 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
@@ -17,14 +17,14 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=id
     ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -32,83 +32,101 @@
     LiteralExpr [STRING] [DBLP_fuzzyjoin_078]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=unrankedTokensDBLP ]
+Let Variable [ Name=$unrankedTokensDBLP ]
   :=
   FunctionCall fuzzyjoin_078.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=unrankedTokensDBLP ]
+    FROM [      Variable [ Name=$unrankedTokensDBLP ]
       AS
-      Variable [ Name=token ]
+      Variable [ Name=$token ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP_fuzzyjoin_078]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin_078.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=unrankedTokensDBLP ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$unrankedTokensDBLP ]
+           AS unrankedTokensDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin_078.count@1[
-            Variable [ Name=paper ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=paper
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=token ]
+        Variable [ Name=$token ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/hashjoin-with-unnest.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/hashjoin-with-unnest.ast
index cb165d7..ce77f96 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/hashjoin-with-unnest.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/hashjoin-with-unnest.ast
@@ -14,12 +14,12 @@
   (
     LiteralExpr [STRING] [t1]
     :
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
   )
   (
     LiteralExpr [STRING] [t2]
     :
-    Variable [ Name=n ]
+    Variable [ Name=$n ]
   )
 ]
 ]
@@ -27,31 +27,31 @@
     LiteralExpr [STRING] [t1]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [t2]
   ]
   AS
-  Variable [ Name=n ]
+  Variable [ Name=$n ]
 ,
   FieldAccessor [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     Field=hobbies
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FieldAccessor [
-    Variable [ Name=n ]
+    Variable [ Name=$n ]
     Field=hobbies
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     =
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
index 5c7a44c..c1a4237 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
@@ -54,27 +54,27 @@
   (
     LiteralExpr [STRING] [c_name]
     :
-    Variable [ Name=c_name ]
+    Variable [ Name=$c_name ]
   )
   (
     LiteralExpr [STRING] [c_custkey]
     :
-    Variable [ Name=c_custkey ]
+    Variable [ Name=$c_custkey ]
   )
   (
     LiteralExpr [STRING] [o_orderkey]
     :
-    Variable [ Name=o_orderkey ]
+    Variable [ Name=$o_orderkey ]
   )
   (
     LiteralExpr [STRING] [o_orderdate]
     :
-    Variable [ Name=o_orderdate ]
+    Variable [ Name=$o_orderdate ]
   )
   (
     LiteralExpr [STRING] [o_totalprice]
     :
-    Variable [ Name=o_totalprice ]
+    Variable [ Name=$o_totalprice ]
   )
   (
     LiteralExpr [STRING] [sum_quantity]
@@ -83,13 +83,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
         ]
       )
     ]
@@ -100,13 +100,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   (
     SELECT ELEMENT [
@@ -114,7 +114,7 @@
       (
         LiteralExpr [STRING] [l_orderkey]
         :
-        Variable [ Name=l_orderkey ]
+        Variable [ Name=$l_orderkey ]
       )
       (
         LiteralExpr [STRING] [t_sum_quantity]
@@ -123,13 +123,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_quantity
             ]
             ]
-            FROM [              Variable [ Name=l ]
+            FROM [              Variable [ Name=$l ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -140,40 +140,46 @@
         LiteralExpr [STRING] [LineItems]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Groupby
-      Variable [ Name=l_orderkey ]
+      Variable [ Name=$l_orderkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
-      With
-      Variable [ Name=l ]
-      Variable [ Name=c ]
-      Variable [ Name=o ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$l ]
+       AS l
+      Variable [ Name=$o ]
+       AS o
+      Variable [ Name=$c ]
+       AS c
+      )
 
   )
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItems]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_custkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
     ]
@@ -181,19 +187,19 @@
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=l_orderkey
         ]
       ]
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=t_sum_quantity
         ]
         >
@@ -203,57 +209,64 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderkey
       ]
     ]
   ]
 Groupby
-  Variable [ Name=c_name ]
+  Variable [ Name=$c_name ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=c_name
   ]
-  Variable [ Name=c_custkey ]
+  Variable [ Name=$c_custkey ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=c_custkey
   ]
-  Variable [ Name=o_orderkey ]
+  Variable [ Name=$o_orderkey ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderdate
   ]
-  Variable [ Name=o_totalprice ]
+  Variable [ Name=$o_totalprice ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_totalprice
   ]
-  With
-  Variable [ Name=c ]
-  Variable [ Name=t ]
-  Variable [ Name=l ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  Variable [ Name=$t ]
+   AS t
+  Variable [ Name=$o ]
+   AS o
+  Variable [ Name=$c ]
+   AS c
+  )
 
 Orderby
-  Variable [ Name=o_totalprice ]
+  Variable [ Name=$o_totalprice ]
   DESC
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   ASC
 
 Limit
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/introhashpartitionmerge.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/introhashpartitionmerge.ast
index bc8eebf..c54a88a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/introhashpartitionmerge.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/introhashpartitionmerge.ast
@@ -10,7 +10,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=token2 ]
+  Variable [ Name=$token2 ]
   Field=rank
 ]
 ]
@@ -18,44 +18,44 @@
     LiteralExpr [STRING] [TOKENSRANKEDADM]
   ]
   AS
-  Variable [ Name=token1 ]
+  Variable [ Name=$token1 ]
 ,
   (
     SELECT ELEMENT [
-    Variable [ Name=tokenRanked ]
+    Variable [ Name=$tokenRanked ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [TOKENSRANKEDADM]
       ]
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
     ]
     Orderby
       FieldAccessor [
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
         Field=rank
       ]
       ASC
 
   )
   AS
-  Variable [ Name=token2 ]
+  Variable [ Name=$token2 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=token1 ]
+      Variable [ Name=$token1 ]
       Field=token
     ]
     =
     FieldAccessor [
-      Variable [ Name=token2 ]
+      Variable [ Name=$token2 ]
       Field=token
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=token2 ]
+    Variable [ Name=$token2 ]
     Field=rank
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains-panic.ast
index b30136e..8fb8650 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains-panic.ast
@@ -12,25 +12,25 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-contains-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Mu]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains.ast
index 4e27860..87e800c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-contains.ast
@@ -12,25 +12,25 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-contains.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.ast
index 4345e17..0923370 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check-panic.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -32,6 +32,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check.ast
index ce4a606..719e6dc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-check.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Amihay Motro]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-panic.ast
index 39e024d..69b25e7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance-panic.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Amihay Motro]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance.ast
index 3c6286f..563cd79 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-edit-distance.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Amihay Motro]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
index b4036df..2f7113f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
@@ -14,18 +14,18 @@
 Set simthreshold=1
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     ~=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
index 96a7c20..7293d9f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
@@ -15,19 +15,19 @@
 Set simthreshold=0.8f
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard-check.ast
index b6413da..043ca2d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard-check.ast
@@ -13,20 +13,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.similarity-jaccard-check@3[
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard.ast
index fa52fe6..b38a521 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ngram-jaccard.ast
@@ -13,20 +13,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.ast
index 64104cf..9a3be27 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check-panic.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-edit-distance-check-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=interests
       ]
       OrderedListConstructor [
@@ -52,7 +52,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check.ast
index 3de2c14..c287438 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-check.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-edit-distance-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=interests
       ]
       OrderedListConstructor [
@@ -52,7 +52,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-panic.ast
index 93be9fa..a89ea63 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance-panic.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-edit-distance-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=interests
       ]
       OrderedListConstructor [
@@ -52,7 +52,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance.ast
index 9e2dcae..2678e6f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-edit-distance.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-edit-distance.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=interests
       ]
       OrderedListConstructor [
@@ -52,7 +52,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
index a50ae16..60c51d5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
@@ -28,18 +28,18 @@
 Set simthreshold=1
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     ~=
@@ -51,7 +51,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.ast
index 906d2cb..06f21ab 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-fuzzyeq-jaccard.ast
@@ -28,18 +28,18 @@
 Set simthreshold=0.8f
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     ~=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard-check.ast
index a4a83d9..36d3a68 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard-check.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.similarity-jaccard-check@3[
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=interests
       ]
       OrderedListConstructor [
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard.ast
index 2afa3e9..62ee708 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/olist-jaccard.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=interests
       ]
       OrderedListConstructor [
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
index 7ea8d9e..c17bafa 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
@@ -28,18 +28,18 @@
 Set simthreshold=0.8f
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     ~=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard-check.ast
index d257b52..d676a98 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard-check.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ulist-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.similarity-jaccard-check@3[
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=interests
       ]
       UnorderedListConstructor [
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard.ast
index 1868664..6fe9da2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/ulist-jaccard.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ulist-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=interests
       ]
       UnorderedListConstructor [
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-contains.ast
index 06c7a39..20c0e4d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-contains.ast
@@ -12,25 +12,25 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-contains.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.ast
index 61455c6..89251b0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-fuzzyeq-jaccard.ast
@@ -14,19 +14,19 @@
 Set simthreshold=0.5f
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard-check.ast
index 87333d8..455c444 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard-check.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.similarity-jaccard-check@3[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard.ast
index aa497c6..157c61c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-basic/word-jaccard.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
index 5f0e3a2..70e1376 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
@@ -12,29 +12,29 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=eda ]
+Let Variable [ Name=$eda ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
     LiteralExpr [LONG] [3]
   ]
-LetVariable [ Name=edb ]
+Let Variable [ Name=$edb ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -43,12 +43,12 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=eda ]
+      Variable [ Name=$eda ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     IndexAccessor [
-      Variable [ Name=edb ]
+      Variable [ Name=$edb ]
       Index:       LiteralExpr [LONG] [0]
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
index 0c5e916..cf61129 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
@@ -12,29 +12,29 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=edb ]
+Let Variable [ Name=$edb ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
     LiteralExpr [LONG] [5]
   ]
-LetVariable [ Name=eda ]
+Let Variable [ Name=$eda ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -43,12 +43,12 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=edb ]
+      Variable [ Name=$edb ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     IndexAccessor [
-      Variable [ Name=eda ]
+      Variable [ Name=$eda ]
       Index:       LiteralExpr [LONG] [0]
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
index a063f1a..fbf5775 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -32,6 +32,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.ast
index 78c46ed..9e5a08e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-let.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -32,6 +32,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.ast
index 7b33e08..e3f9037 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-substring.ast
@@ -17,7 +17,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=id
     ]
   )
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   )
@@ -35,14 +35,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FunctionCall test.substring@3[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
         LiteralExpr [LONG] [0]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
index 6a85c28..25105bd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
@@ -17,7 +17,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=id
     ]
   )
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   )
@@ -35,21 +35,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=word ]
+  Variable [ Name=$word ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=word ]
+      Variable [ Name=$word ]
       LiteralExpr [STRING] [Multmedia]
       LiteralExpr [LONG] [1]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-let.ast
index a99dde2..9c8361a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-let.ast
@@ -13,20 +13,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -41,6 +41,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.ast
index 47c3ce0..d49d0d5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ngram-jaccard-check-multi-let.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [Paper]
     :
-    Variable [ Name=paper_tokens ]
+    Variable [ Name=$paper_tokens ]
   )
   (
     LiteralExpr [STRING] [Query]
     :
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$query_tokens ]
   )
 ]
 ]
@@ -30,34 +30,34 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.gram-tokens@3[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.gram-tokens@3[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.ast
index 7fe6ea7..9fc454b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let-panic.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_olist-edit-distance-check-let-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     OrderedListConstructor [
@@ -50,12 +50,12 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let.ast
index 6eb6af7..16e2f50 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-edit-distance-check-let.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_olist-edit-distance-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     OrderedListConstructor [
@@ -50,12 +50,12 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-jaccard-check-let.ast
index ac30577..3de86ee 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/olist-jaccard-check-let.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_olist-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     OrderedListConstructor [
@@ -50,6 +50,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ulist-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ulist-jaccard-check-let.ast
index 25ab6dc..a2edc63 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ulist-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/ulist-jaccard-check-let.ast
@@ -26,19 +26,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ulist-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     OrderedListConstructor [
@@ -50,6 +50,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-let.ast
index 34fc8e3..9aff0cd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-let.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_word-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -36,6 +36,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.ast
index df314a5..e67a0d1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-complex/word-jaccard-check-multi-let.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [Paper]
     :
-    Variable [ Name=paper_tokens ]
+    Variable [ Name=$paper_tokens ]
   )
   (
     LiteralExpr [STRING] [Query]
     :
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$query_tokens ]
   )
 ]
 ]
@@ -29,30 +29,30 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.8]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.ast
index 09aafb5..6c980e0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline.ast
@@ -17,7 +17,7 @@
     LiteralExpr [STRING] [aauthors]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
   )
@@ -25,14 +25,14 @@
     LiteralExpr [STRING] [bauthors]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -40,42 +40,42 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <
       LiteralExpr [LONG] [3]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.ast
index bd8c4fb..5c7413e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance.ast
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [aauthors]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
   )
@@ -35,7 +35,7 @@
     LiteralExpr [STRING] [bauthors]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   )
@@ -45,24 +45,24 @@
     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 [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
       ]
@@ -72,12 +72,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.ast
index a21ca7c..15c0279 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-edit-distance.ast
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [aauthors]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
   )
@@ -37,7 +37,7 @@
     LiteralExpr [STRING] [bauthors]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   )
@@ -47,36 +47,36 @@
     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=authors
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=authors
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.ast
index 2795303..f56490c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-fuzzyeq-jaccard.ast
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [atitle]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [btitle]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
@@ -48,20 +48,20 @@
     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 [
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -70,7 +70,7 @@
       ~=
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -80,12 +80,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.ast
index b322ac6..7cbe6f0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline.ast
@@ -18,7 +18,7 @@
     LiteralExpr [STRING] [atitle]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -26,14 +26,14 @@
     LiteralExpr [STRING] [btitle]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -41,20 +41,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -62,7 +62,7 @@
     ]
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -72,19 +72,19 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.ast
index 137761f..9c1b109 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard.ast
@@ -28,7 +28,7 @@
     LiteralExpr [STRING] [atitle]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -36,7 +36,7 @@
     LiteralExpr [STRING] [btitle]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
@@ -46,13 +46,13 @@
     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 [
@@ -60,7 +60,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -68,7 +68,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -81,12 +81,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.ast
index e7a7c9d..3c1c726 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline.ast
@@ -31,7 +31,7 @@
     LiteralExpr [STRING] [ainterests]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -39,14 +39,14 @@
     LiteralExpr [STRING] [binterests]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -54,42 +54,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [2]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.ast
index 61ed3c7..208cd79 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance.ast
@@ -32,7 +32,7 @@
     LiteralExpr [STRING] [ainterests]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -40,7 +40,7 @@
     LiteralExpr [STRING] [binterests]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
@@ -50,24 +50,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -77,12 +77,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.ast
index 9a82399..30ead54 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-edit-distance.ast
@@ -34,7 +34,7 @@
     LiteralExpr [STRING] [ainterests]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -42,7 +42,7 @@
     LiteralExpr [STRING] [binterests]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
@@ -52,36 +52,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.ast
index f8f5eac..a5b3450 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-fuzzyeq-jaccard.ast
@@ -34,7 +34,7 @@
     LiteralExpr [STRING] [ainterests]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -42,7 +42,7 @@
     LiteralExpr [STRING] [binterests]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
@@ -52,36 +52,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.ast
index e76ee24..a763a16 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline.ast
@@ -31,7 +31,7 @@
     LiteralExpr [STRING] [ainterests]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -39,14 +39,14 @@
     LiteralExpr [STRING] [binterests]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -54,42 +54,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.7]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.ast
index f7b05cb..f0bbad6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard.ast
@@ -32,7 +32,7 @@
     LiteralExpr [STRING] [ainterests]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -40,7 +40,7 @@
     LiteralExpr [STRING] [binterests]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
@@ -50,24 +50,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -77,12 +77,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.ast
index 4977dfb..06e3c7c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-fuzzyeq-jaccard.ast
@@ -34,7 +34,7 @@
     LiteralExpr [STRING] [ainterests]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -42,7 +42,7 @@
     LiteralExpr [STRING] [binterests]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
@@ -52,36 +52,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.ast
index 7fc3dc5..1a99495 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline.ast
@@ -31,7 +31,7 @@
     LiteralExpr [STRING] [ainterests]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -39,14 +39,14 @@
     LiteralExpr [STRING] [binterests]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -54,42 +54,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.7]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.ast
index a9c2886..fb817ac 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard.ast
@@ -32,7 +32,7 @@
     LiteralExpr [STRING] [ainterests]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -40,7 +40,7 @@
     LiteralExpr [STRING] [binterests]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
@@ -50,24 +50,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -77,12 +77,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.ast
index ce3e14e..7a13d8d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-fuzzyeq-jaccard.ast
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [atitle]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -37,7 +37,7 @@
     LiteralExpr [STRING] [btitle]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
@@ -47,27 +47,27 @@
     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 [
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
       ]
       ~=
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
       ]
@@ -75,12 +75,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.ast
index d22ac3d..fed02b3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline.ast
@@ -17,7 +17,7 @@
     LiteralExpr [STRING] [atitle]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -25,14 +25,14 @@
     LiteralExpr [STRING] [btitle]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -40,26 +40,26 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
     ]
@@ -67,19 +67,19 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard.ast
index fa53d37..76663a3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard.ast
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [atitle]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -35,7 +35,7 @@
     LiteralExpr [STRING] [btitle]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
@@ -45,13 +45,13 @@
     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 [
@@ -59,13 +59,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -76,12 +76,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/issue741.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/issue741.ast
index cd9db84..58fe1a7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/issue741.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/issue741.ast
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [tweet]
     :
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=tweetid
     ]
   )
@@ -39,7 +39,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=tweetid
       ]
       ]
@@ -47,17 +47,17 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.similarity-jaccard-check@3[
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=referred_topics
           ]
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=referred_topics
           ]
           LiteralExpr [FLOAT] [0.6]
@@ -65,18 +65,18 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
               Field=tweetid
             ]
           ]
@@ -89,13 +89,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=send_time
       ]
       >=
@@ -106,7 +106,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=send_time
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
index 2239da8..38719d4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
@@ -35,7 +35,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=tweetid
         ]
       )
@@ -43,7 +43,7 @@
         LiteralExpr [STRING] [topics]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=message-text
         ]
       )
@@ -59,7 +59,7 @@
           LiteralExpr [STRING] [id]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -67,7 +67,7 @@
           LiteralExpr [STRING] [topics]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
         )
@@ -77,17 +77,17 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.edit-distance-check@3[
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=message-text
           ]
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
           LiteralExpr [LONG] [7]
@@ -95,25 +95,25 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -126,12 +126,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     >
@@ -141,7 +141,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
index 97a05f0..d05763c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
@@ -35,7 +35,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=tweetid
         ]
       )
@@ -43,7 +43,7 @@
         LiteralExpr [STRING] [topics]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=referred-topics
         ]
       )
@@ -59,7 +59,7 @@
           LiteralExpr [STRING] [id]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -67,7 +67,7 @@
           LiteralExpr [STRING] [topics]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=referred-topics
           ]
         )
@@ -77,17 +77,17 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.similarity-jaccard-check@3[
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=referred-topics
           ]
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=referred-topics
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -95,25 +95,25 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -126,12 +126,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     >
@@ -141,7 +141,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-contains.ast
index e926a65..5f6aa56 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-contains.ast
@@ -17,7 +17,7 @@
     LiteralExpr [STRING] [title1]
     :
     FieldAccessor [
-      Variable [ Name=o1 ]
+      Variable [ Name=$o1 ]
       Field=title
     ]
   )
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [title2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=title
     ]
   )
@@ -35,47 +35,47 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=title
       ]
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_01.ast
index 75e5884..1be814b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_01.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,24 +39,24 @@
     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 [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -66,12 +66,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_02.ast
index ca555cb..91bc760 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_02.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,24 +39,24 @@
     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 [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -66,12 +66,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_03.ast
index 5cfff7e..0d49278 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_03.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -29,24 +29,24 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -56,12 +56,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_04.ast
index 763075c..ab5ad22 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-check_04.ast
@@ -16,18 +16,18 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
     IndexAccessor [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -37,23 +37,23 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
     LiteralExpr [LONG] [3]
@@ -61,18 +61,18 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-contains.ast
index 2a6008c..7db7b68 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-contains.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,24 +39,24 @@
     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 [
     IndexAccessor [
       FunctionCall test.edit-distance-contains@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -66,12 +66,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_01.ast
index bf5420a..248dcb8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_01.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,24 +39,24 @@
     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 [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
       ]
@@ -66,12 +66,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_02.ast
index 5c1a2b8..766ad24 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_02.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,24 +39,24 @@
     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 [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
       ]
@@ -66,12 +66,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_03.ast
index e38b611..199d2a3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_03.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -29,24 +29,24 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
       ]
@@ -56,12 +56,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_04.ast
index e55a51d..5de8bbb 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-edit-distance_04.ast
@@ -16,17 +16,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -34,42 +34,42 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <
       LiteralExpr [LONG] [3]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
index eefebfc..aedacd8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
@@ -28,12 +28,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -41,36 +41,36 @@
     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=authors
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=authors
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
index eefebfc..aedacd8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
@@ -28,12 +28,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -41,36 +41,36 @@
     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=authors
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=authors
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
index 98ace24..41eedf3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -31,36 +31,36 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     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=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
index 50476be..e15988c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
@@ -29,12 +29,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -42,20 +42,20 @@
     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 [
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -64,7 +64,7 @@
       ~=
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -74,12 +74,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
index dcc9ea2..5d1fa14 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
@@ -29,12 +29,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -42,20 +42,20 @@
     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 [
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -64,7 +64,7 @@
       ~=
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -74,12 +74,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
index 3aa306c..752e806 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
@@ -19,12 +19,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -32,20 +32,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -54,7 +54,7 @@
       ~=
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -64,12 +64,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_01.ast
index 0419cba..5ffc1cd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_01.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -40,13 +40,13 @@
     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 [
@@ -54,7 +54,7 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -62,7 +62,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -75,12 +75,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_02.ast
index 81134d4..58b0f70 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_02.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -40,13 +40,13 @@
     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 [
@@ -54,7 +54,7 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -62,7 +62,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -75,12 +75,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_03.ast
index ca88117..ebd3d2f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_03.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -30,13 +30,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -44,7 +44,7 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -52,7 +52,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -65,12 +65,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_04.ast
index c5d4ab7..7c7d647 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard-check_04.ast
@@ -17,18 +17,18 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -38,20 +38,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -59,7 +59,7 @@
     ]
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -70,18 +70,18 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_01.ast
index 9a6c8da..6ed6082 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_01.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -40,13 +40,13 @@
     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 [
@@ -54,7 +54,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -62,7 +62,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -75,12 +75,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_02.ast
index 0cdadfa..276327b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_02.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -40,13 +40,13 @@
     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 [
@@ -54,7 +54,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -62,7 +62,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -75,12 +75,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_03.ast
index 73ca98c..97e108a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_03.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -30,13 +30,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -44,7 +44,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -52,7 +52,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -65,12 +65,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_04.ast
index 13fdfd8..ac83bfe 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ngram-jaccard_04.ast
@@ -17,17 +17,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -35,20 +35,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -56,7 +56,7 @@
     ]
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -66,19 +66,19 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_01.ast
index 8275d97..2fc461b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_01.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
         LiteralExpr [LONG] [3]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_02.ast
index 48c514f..b7d770b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_02.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
         LiteralExpr [LONG] [3]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_03.ast
index 8d16bba..c66eff7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_03.ast
@@ -30,12 +30,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -43,24 +43,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
         LiteralExpr [LONG] [3]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_04.ast
index ccceb81..a549e5c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance-check_04.ast
@@ -30,18 +30,18 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
     IndexAccessor [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -51,23 +51,23 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
     LiteralExpr [LONG] [3]
@@ -75,18 +75,18 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_01.ast
index 339dc4e..411069f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_01.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_02.ast
index d15e1aa..7c532f6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_02.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_03.ast
index ce54a01..60fdbaa 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_03.ast
@@ -30,12 +30,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -43,24 +43,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_04.ast
index 4c9f004..8a5c866 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-edit-distance_04.ast
@@ -30,17 +30,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -48,42 +48,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [2]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
index 8d7a57c..76e6457 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
@@ -33,12 +33,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -46,36 +46,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.ast
index a5eca86..287fc22 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_02.ast
@@ -33,12 +33,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -46,36 +46,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.ast
index 6e80801..b59c140 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-edit-distance_03.ast
@@ -32,12 +32,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -45,36 +45,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
index 1e1e5af..3488a26 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
@@ -33,12 +33,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -46,36 +46,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.ast
index 5026525..47a518b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_02.ast
@@ -33,12 +33,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -46,36 +46,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.ast
index 651d7d9..78c5045 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-fuzzyeq-jaccard_03.ast
@@ -32,12 +32,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -45,36 +45,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_01.ast
index d7e4bf9..f6cb9ea 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_01.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.similarity-jaccard-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
         LiteralExpr [FLOAT] [0.7]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_02.ast
index 2fd1ac6..1c24316 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_02.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.similarity-jaccard-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
         LiteralExpr [FLOAT] [0.7]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_03.ast
index fc04482..b383e26 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_03.ast
@@ -30,12 +30,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -43,24 +43,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.similarity-jaccard-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
         LiteralExpr [FLOAT] [0.7]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_04.ast
index ce36064..d7a11e2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard-check_04.ast
@@ -30,18 +30,18 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -51,23 +51,23 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
     LiteralExpr [FLOAT] [0.7]
@@ -75,18 +75,18 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_01.ast
index 9b1b0fb..725f507 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_01.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_02.ast
index c0f0c1b..2f234f4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_02.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_03.ast
index 89f15e1..0364e99 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_03.ast
@@ -30,12 +30,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -43,24 +43,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_04.ast
index dbef739..75dd84f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/olist-jaccard_04.ast
@@ -30,17 +30,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -48,42 +48,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.7]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
index b3c1df7..94632b9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
@@ -33,12 +33,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -46,36 +46,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.ast
index 43c5bf6..8720d11 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_02.ast
@@ -33,12 +33,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -46,36 +46,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.ast
index 8fe7656..665765b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-fuzzyeq-jaccard_03.ast
@@ -32,12 +32,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -45,36 +45,36 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=interests
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=interests
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_01.ast
index f3dddca..6e64369 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_01.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.similarity-jaccard-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
         LiteralExpr [FLOAT] [0.7]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_02.ast
index 2a4193c..ee76dc1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_02.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.similarity-jaccard-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
         LiteralExpr [FLOAT] [0.7]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_03.ast
index dd120c8..6f527e4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_03.ast
@@ -30,12 +30,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -43,24 +43,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.similarity-jaccard-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
         LiteralExpr [FLOAT] [0.7]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_04.ast
index d588ee9..738c754 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard-check_04.ast
@@ -30,18 +30,18 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -51,23 +51,23 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
     LiteralExpr [FLOAT] [0.7]
@@ -75,18 +75,18 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_01.ast
index 6ff860c..bcc0f16 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_01.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_02.ast
index 6134f5b..d3d730b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_02.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -71,12 +71,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_03.ast
index 91f65f1..6b8c2d4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_03.ast
@@ -30,12 +30,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -43,24 +43,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_04.ast
index 84e780e..454bbfe 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/ulist-jaccard_04.ast
@@ -30,17 +30,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -48,42 +48,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.7]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.ast
index 58d4b8a..9d46dff 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_01.ast
@@ -28,12 +28,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -41,27 +41,27 @@
     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 [
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
       ]
       ~=
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
       ]
@@ -69,12 +69,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.ast
index 633c07b..6a51fda 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_02.ast
@@ -28,12 +28,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -41,27 +41,27 @@
     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 [
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
       ]
       ~=
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
       ]
@@ -69,12 +69,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.ast
index df1246d..8fa76a8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-fuzzyeq-jaccard_03.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -31,27 +31,27 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
       ]
       ~=
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
       ]
@@ -59,12 +59,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.ast
index 2347092..2b5b7bd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check-after-btree-access.ast
@@ -31,7 +31,7 @@
     LiteralExpr [STRING] [t1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -39,7 +39,7 @@
     LiteralExpr [STRING] [t2]
     :
     FieldAccessor [
-      Variable [ Name=t2 ]
+      Variable [ Name=$t2 ]
       Field=tweetid
     ]
   )
@@ -47,7 +47,7 @@
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -57,26 +57,26 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t2 ]
+  Variable [ Name=$t2 ]
 ]
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=message-text
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=message-text
       ]
     ]
@@ -85,13 +85,13 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=tweetid
       ]
       <
@@ -102,12 +102,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=tweetid
       ]
       !=
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=tweetid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_01.ast
index 33991ed..6b6620d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_01.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,13 +39,13 @@
     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 [
@@ -53,13 +53,13 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_02.ast
index 08269a9..15dafb9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_02.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,13 +39,13 @@
     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 [
@@ -53,13 +53,13 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_03.ast
index 62af4eb..c41a92a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_03.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -29,13 +29,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -43,13 +43,13 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -60,12 +60,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_04.ast
index 4c544a4..25adf38 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard-check_04.ast
@@ -16,18 +16,18 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -37,26 +37,26 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
     ]
@@ -65,18 +65,18 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_01.ast
index 1e45bf1..b21338c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_01.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,13 +39,13 @@
     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 [
@@ -53,13 +53,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_02.ast
index 27bad9a..eb556e9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_02.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,13 +39,13 @@
     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 [
@@ -53,13 +53,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -70,12 +70,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_03.ast
index a239f26..e57a872 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_03.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -29,13 +29,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -43,13 +43,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -60,12 +60,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_04.ast
index 38481e6..7887423 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inverted-index-join/word-jaccard_04.ast
@@ -16,17 +16,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -34,26 +34,26 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
     ]
@@ -61,19 +61,19 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_01.ast
index a66de1f..2588fc5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_01.ast
@@ -70,7 +70,7 @@
     LiteralExpr [STRING] [l_partkey]
     :
     FieldAccessor [
-      Variable [ Name=li ]
+      Variable [ Name=$li ]
       Field=l_partkey
     ]
   )
@@ -80,48 +80,48 @@
     LiteralExpr [STRING] [LineItems]
   ]
   AS
-  Variable [ Name=li ]
+  Variable [ Name=$li ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [PartSupp]
   ]
   AS
-  Variable [ Name=ps ]
+  Variable [ Name=$ps ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=li ]
+        Variable [ Name=$li ]
         Field=l_partkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
         Field=ps_partkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=li ]
+        Variable [ Name=$li ]
         Field=l_suppkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
         Field=ps_suppkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=li ]
+        Variable [ Name=$li ]
         Field=l_extendedprice
       ]
       =
       FieldAccessor [
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
         Field=ps_supplycost
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_02.ast
index d7f18cb..3982bb8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/join-super-key_02.ast
@@ -70,7 +70,7 @@
     LiteralExpr [STRING] [l_partkey]
     :
     FieldAccessor [
-      Variable [ Name=li ]
+      Variable [ Name=$li ]
       Field=l_partkey
     ]
   )
@@ -80,48 +80,48 @@
     LiteralExpr [STRING] [PartSupp]
   ]
   AS
-  Variable [ Name=ps ]
+  Variable [ Name=$ps ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItems]
   ]
   AS
-  Variable [ Name=li ]
+  Variable [ Name=$li ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=li ]
+        Variable [ Name=$li ]
         Field=l_partkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
         Field=ps_partkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=li ]
+        Variable [ Name=$li ]
         Field=l_suppkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
         Field=ps_suppkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=li ]
+        Variable [ Name=$li ]
         Field=l_extendedprice
       ]
       =
       FieldAccessor [
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
         Field=ps_supplycost
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/limit-issue353.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/limit-issue353.ast
index cd9cd68..e9f5897 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/limit-issue353.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/limit-issue353.ast
@@ -28,7 +28,7 @@
     LiteralExpr [STRING] [l_returnflag]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_returnflag
     ]
   )
@@ -36,7 +36,7 @@
     LiteralExpr [STRING] [l_linestatus]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_linestatus
     ]
   )
@@ -44,7 +44,7 @@
     LiteralExpr [STRING] [l_shipmode]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipmode
     ]
   )
@@ -54,7 +54,7 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Limit
   LiteralExpr [LONG] [2]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_01.ast
index 58d1f23..87eb3ae 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_01.ast
@@ -69,12 +69,12 @@
   (
     LiteralExpr [STRING] [li]
     :
-    Variable [ Name=li ]
+    Variable [ Name=$li ]
   )
   (
     LiteralExpr [STRING] [partsupp]
     :
-    Variable [ Name=partsupp ]
+    Variable [ Name=$partsupp ]
   )
 ]
 ]
@@ -82,54 +82,54 @@
     LiteralExpr [STRING] [LineItems]
   ]
   AS
-  Variable [ Name=li ]
+  Variable [ Name=$li ]
 ]
-LetVariable [ Name=partsupp ]
+Let Variable [ Name=$partsupp ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=ps ]
+    Variable [ Name=$ps ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [PartSupp]
       ]
       AS
-      Variable [ Name=ps ]
+      Variable [ Name=$ps ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=li ]
+            Variable [ Name=$li ]
             Field=l_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_partkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=li ]
+            Variable [ Name=$li ]
             Field=l_suppkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_suppkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=li ]
+            Variable [ Name=$li ]
             Field=l_extendedprice
           ]
           =
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_supplycost
           ]
         ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_02.ast
index 351abc9..79dbce4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/loj-super-key_02.ast
@@ -69,12 +69,12 @@
   (
     LiteralExpr [STRING] [partsupp]
     :
-    Variable [ Name=ps ]
+    Variable [ Name=$ps ]
   )
   (
     LiteralExpr [STRING] [li]
     :
-    Variable [ Name=items ]
+    Variable [ Name=$items ]
   )
 ]
 ]
@@ -82,54 +82,54 @@
     LiteralExpr [STRING] [PartSupp]
   ]
   AS
-  Variable [ Name=ps ]
+  Variable [ Name=$ps ]
 ]
-LetVariable [ Name=items ]
+Let Variable [ Name=$items ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=li ]
+    Variable [ Name=$li ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [LineItems]
       ]
       AS
-      Variable [ Name=li ]
+      Variable [ Name=$li ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=li ]
+            Variable [ Name=$li ]
             Field=l_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_partkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=li ]
+            Variable [ Name=$li ]
             Field=l_suppkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_suppkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=li ]
+            Variable [ Name=$li ]
             Field=l_extendedprice
           ]
           =
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_supplycost
           ]
         ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
index 1556199..802eb04 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
@@ -87,7 +87,7 @@
     LiteralExpr [STRING] [nation_key]
     :
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_nationkey
     ]
   )
@@ -95,7 +95,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_name
     ]
   )
@@ -108,12 +108,12 @@
         (
           LiteralExpr [STRING] [order_date]
           :
-          Variable [ Name=orderdate ]
+          Variable [ Name=$orderdate ]
         )
         (
           LiteralExpr [STRING] [sum_price]
           :
-          Variable [ Name=sum ]
+          Variable [ Name=$sum ]
         )
       ]
       ]
@@ -121,71 +121,78 @@
           LiteralExpr [STRING] [Orders]
         ]
         AS
-        Variable [ Name=orders ]
+        Variable [ Name=$orders ]
 ,
         FunctionCall Metadata.dataset@1[
           LiteralExpr [STRING] [Customer]
         ]
         AS
-        Variable [ Name=customer ]
+        Variable [ Name=$customer ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=orders ]
+              Variable [ Name=$orders ]
               Field=o_custkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=customer ]
+              Variable [ Name=$customer ]
               Field=c_custkey
             ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=customer ]
+              Variable [ Name=$customer ]
               Field=c_nationkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=nation ]
+              Variable [ Name=$nation ]
               Field=n_nationkey
             ]
           ]
         ]
       Groupby
-        Variable [ Name=orderdate ]
+        Variable [ Name=$orderdate ]
         :=
         FieldAccessor [
-          Variable [ Name=orders ]
+          Variable [ Name=$orders ]
           Field=o_orderdate
         ]
-        With
-        Variable [ Name=orders ]
-        Variable [ Name=customer ]
-        Variable [ Name=nation ]
-        Variable [ Name=sn ]
+        GROUP AS
+        Variable [ Name=#1 ]
+        (
+        Variable [ Name=$customer ]
+         AS customer
+        Variable [ Name=$orders ]
+         AS orders
+        Variable [ Name=$sn ]
+         AS sn
+        Variable [ Name=$nation ]
+         AS nation
+        )
 
-      LetVariable [ Name=sum ]
+      Let Variable [ Name=$sum ]
         :=
         FunctionCall tpch.sum@1[
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_totalprice
             ]
             ]
-            FROM [              Variable [ Name=orders ]
+            FROM [              Variable [ Name=$orders ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
             ]
           )
         ]
       Orderby
-        Variable [ Name=sum ]
+        Variable [ Name=$sum ]
         ASC
 
       Limit
@@ -198,23 +205,23 @@
     LiteralExpr [STRING] [Nation]
   ]
   AS
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [SelectedNation]
   ]
   AS
-  Variable [ Name=sn ]
+  Variable [ Name=$sn ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_nationkey
     ]
     =
     FieldAccessor [
-      Variable [ Name=sn ]
+      Variable [ Name=$sn ]
       Field=n_nationkey
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/disjunction-to-join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/disjunction-to-join.ast
index ed8e12c..7a52b2d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/disjunction-to-join.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/disjunction-to-join.ast
@@ -14,20 +14,20 @@
 DatasetDecl TestSet(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TestSet]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=nested
         ]
         Field=idx
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=nested
         ]
         Field=idx
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
index 4a42fee..e864bcb 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01.ast
@@ -37,7 +37,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -48,7 +48,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -65,7 +65,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -76,7 +76,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -88,13 +88,13 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=countA
@@ -102,7 +102,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -111,7 +111,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -126,13 +126,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -145,7 +145,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
index c64a4e4..7563428 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02.ast
@@ -37,7 +37,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -48,7 +48,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -65,7 +65,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -76,7 +76,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -88,14 +88,14 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=countA
@@ -103,7 +103,7 @@
             =
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=countB
@@ -113,7 +113,7 @@
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -121,7 +121,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -131,7 +131,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -146,13 +146,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -165,7 +165,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.ast
index bebe933..6c3ff58 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_01.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -52,7 +52,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -70,7 +70,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.ast
index ce0498b..1146266 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_02.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -52,7 +52,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -70,7 +70,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.ast
index 9a26805..4bd4682 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-join_03.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -52,7 +52,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -70,7 +70,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.ast
index 8406d8b..77da0f0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_01.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -52,7 +52,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -70,7 +70,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.ast
index 9820388..0ee1013 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_02.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -52,7 +52,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -70,7 +70,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.ast
index 3baf252..431c6e3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_03.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -52,7 +52,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -70,7 +70,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.ast
index cadb304..6bdf652 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_04.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -52,7 +52,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -70,7 +70,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.ast
index bae49a9..3e65bf3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_05.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -52,7 +52,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -70,7 +70,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.ast
index 9a268b9..3d74511 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-composite-key-prefix-join_06.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -52,7 +52,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -70,7 +70,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.ast
index 18e65bc..ddd5a5a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-multipred.ast
@@ -49,7 +49,7 @@
     LiteralExpr [STRING] [customer]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
   )
@@ -57,7 +57,7 @@
     LiteralExpr [STRING] [order]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
   )
@@ -67,20 +67,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=cid
@@ -88,7 +88,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=cid
@@ -98,7 +98,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=name
@@ -106,7 +106,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=orderstatus
@@ -116,7 +116,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=age
@@ -124,7 +124,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.ast
index cf7f80b..61025af 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join-neg_01.ast
@@ -16,25 +16,25 @@
 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 [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=nested
       ]
       Field=key1
@@ -42,7 +42,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
         Field=nested
       ]
       Field=key2
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_01.ast
index 0eed33b..6103921 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_01.ast
@@ -16,25 +16,25 @@
 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 [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=nested
       ]
       Field=key1
@@ -42,7 +42,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
         Field=nested
       ]
       Field=key2
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_02.ast
index 0933e63..08cf80e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_02.ast
@@ -16,25 +16,25 @@
 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 [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=nested
       ]
       Field=key2
@@ -42,7 +42,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
         Field=nested
       ]
       Field=key1
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_03.ast
index 431c3f4..1964148 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_03.ast
@@ -49,7 +49,7 @@
     LiteralExpr [STRING] [customer]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
   )
@@ -57,7 +57,7 @@
     LiteralExpr [STRING] [order]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
   )
@@ -67,19 +67,19 @@
     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 [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=cid
@@ -87,7 +87,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_04.ast
index 9b02223..6e7e1d4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_04.ast
@@ -49,7 +49,7 @@
     LiteralExpr [STRING] [customer]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
   )
@@ -57,7 +57,7 @@
     LiteralExpr [STRING] [order]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
   )
@@ -67,19 +67,19 @@
     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 [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=cid
@@ -87,7 +87,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_05.ast
index 5d61b7c..1ee2dd5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-equi-join_05.ast
@@ -33,7 +33,7 @@
     LiteralExpr [STRING] [customer1]
     :
     FieldAccessor [
-      Variable [ Name=c1 ]
+      Variable [ Name=$c1 ]
       Field=nested
     ]
   )
@@ -41,7 +41,7 @@
     LiteralExpr [STRING] [customer2]
     :
     FieldAccessor [
-      Variable [ Name=c2 ]
+      Variable [ Name=$c2 ]
       Field=nested
     ]
   )
@@ -51,19 +51,19 @@
     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 [
       FieldAccessor [
-        Variable [ Name=c1 ]
+        Variable [ Name=$c1 ]
         Field=nested
       ]
       Field=cid
@@ -71,7 +71,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c2 ]
+        Variable [ Name=$c2 ]
         Field=nested
       ]
       Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-ge-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-ge-join_01.ast
index f7a027b..0a02105 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-ge-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-ge-join_01.ast
@@ -16,25 +16,25 @@
 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 [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=nested
       ]
       Field=key1
@@ -42,7 +42,7 @@
     >=
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
         Field=nested
       ]
       Field=key2
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-gt-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-gt-join_01.ast
index 3ba1ca5..d3fdb0a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-gt-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-gt-join_01.ast
@@ -16,25 +16,25 @@
 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 [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=nested
       ]
       Field=key1
@@ -42,7 +42,7 @@
     >
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
         Field=nested
       ]
       Field=key2
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-le-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-le-join_01.ast
index ee81cad..0cd50a9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-le-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-le-join_01.ast
@@ -16,25 +16,25 @@
 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 [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=nested
       ]
       Field=key1
@@ -42,7 +42,7 @@
     <=
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
         Field=nested
       ]
       Field=key2
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-lt-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-lt-join_01.ast
index d1340a7..77d36af 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-lt-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/primary-lt-join_01.ast
@@ -16,25 +16,25 @@
 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 [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=nested
       ]
       Field=key1
@@ -42,7 +42,7 @@
     <
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
         Field=nested
       ]
       Field=key2
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.ast
index f473daa..46331ad 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multiindex.ast
@@ -52,7 +52,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=nested
       ]
       Field=id
@@ -63,7 +63,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=nested
       ]
       Field=author-id
@@ -74,7 +74,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=nested
       ]
       Field=name
@@ -85,7 +85,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=nested
       ]
       Field=message
@@ -97,20 +97,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=user ]
+          Variable [ Name=$user ]
           Field=nested
         ]
         Field=id
@@ -118,7 +118,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=message ]
+          Variable [ Name=$message ]
           Field=nested
         ]
         Field=author-id-copy
@@ -128,7 +128,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=user ]
+          Variable [ Name=$user ]
           Field=nested
         ]
         Field=id
@@ -140,7 +140,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=user ]
+          Variable [ Name=$user ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.ast
index da63583..38f9516 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join-multipred.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,20 +49,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -70,7 +70,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -80,7 +80,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=authors
@@ -88,7 +88,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=authors
@@ -98,7 +98,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=misc
@@ -106,7 +106,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=misc
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.ast
index ed76a3a..19acac3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index-join/secondary-equi-join_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,19 +49,19 @@
     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 [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -69,7 +69,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-01.ast
index ff85f1c..eb6d290 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-01.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,13 +23,13 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-02.ast
index 38ee1a4..e6bdae1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-02.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,13 +23,13 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-03.ast
index 90374f8..7478680 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-03.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,13 +23,13 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-04.ast
index 3323d94..7b7c9ff 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-04.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,13 +23,13 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-05.ast
index 51e77bd..c7a94fd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-05.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,13 +23,13 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-06.ast
index 36acf34..c741b6a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-06.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,13 +23,13 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-07.ast
index e7bd4eb..e62439a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-07.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-07.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,13 +23,13 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-08.ast
index 8a5f1fe..32c1d15 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-08.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-08.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-09.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-09.ast
index 76e34ac..249389f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-09.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-09.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,14 +23,14 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -42,7 +42,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-10.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-10.ast
index 9ccaf53..83886ec 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-10.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-10.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-11.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-11.ast
index 00bf9b0..6fee41c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-11.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-11.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,14 +23,14 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -42,7 +42,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-12.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-12.ast
index c1fa5b8..05d7739 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-12.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-12.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,14 +23,14 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -42,7 +42,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-13.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-13.ast
index 80e548c..23b3de3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-13.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-13.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,14 +23,14 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -42,7 +42,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-14.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-14.ast
index 2beb6c8..cfa80b1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-14.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-14.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,14 +23,14 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -42,7 +42,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-15.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-15.ast
index 2e7c34d..7e40c6c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-15.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-15.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -51,7 +51,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -63,7 +63,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-16.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-16.ast
index a0d2024..1d39214 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-16.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-16.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -51,7 +51,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -63,7 +63,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-17.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-17.ast
index ca9d1e4..6fe0b15 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-17.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-17.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,14 +23,14 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -42,7 +42,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-18.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-18.ast
index 0d21462..abcad1b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-18.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-18.ast
@@ -15,7 +15,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
   Field=nested
 ]
 ]
@@ -23,14 +23,14 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -42,7 +42,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-19.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-19.ast
index 2552695..eabd287 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-19.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-19.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -51,7 +51,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -63,7 +63,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-20.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-20.ast
index a9477f4..86492ba 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-20.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-20.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -51,7 +51,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -63,7 +63,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-21.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-21.ast
index f1cc44f..34023a6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-21.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-21.ast
@@ -14,19 +14,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-22.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-22.ast
index f60d49a..abc957f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-22.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-22.ast
@@ -14,19 +14,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-23.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-23.ast
index d579b4a..ad4ead6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-23.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-23.ast
@@ -14,19 +14,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-24.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-24.ast
index 2e6266c..c7ce593 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-24.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-24.ast
@@ -14,19 +14,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-25.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-25.ast
index d64bdca..92a315d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-25.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-25.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-26.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-26.ast
index 6bc69ad..8ccd5b2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-26.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-26.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-27.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-27.ast
index a6f2345..06e8188 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-27.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-27.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -51,7 +51,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -63,7 +63,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-28.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-28.ast
index 2a51684..f710e35 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-28.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-28.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -51,7 +51,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -63,7 +63,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-29.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-29.ast
index a7966c3..eedd0d1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-29.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-29.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -51,7 +51,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -63,7 +63,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-30.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-30.ast
index 4ad0c9f..3097f37 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-30.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-30.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -51,7 +51,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -63,7 +63,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-31.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-31.ast
index 26d58ad..3b420b2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-31.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-31.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-32.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-32.ast
index 1e99964..c12a9d3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-32.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-primary-32.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, fname], [nested, lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-33.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-33.ast
index eeeb689..41653ee 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-33.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-33.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-34.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-34.ast
index da50a8f..beb40bc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-34.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-34.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-35.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-35.ast
index 827c234..b0b6f7c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-35.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-35.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-36.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-36.ast
index f512b57..a1b0125 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-36.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-36.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-37.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-37.ast
index c258c82..e47ad48 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-37.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-37.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-38.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-38.ast
index ba3e074..9fb769b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-38.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-38.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-39.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-39.ast
index ff9c109..0548e38 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-39.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-39.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-40.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-40.ast
index f1750b5..4d9e481 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-40.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-40.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-41.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-41.ast
index d9371a4..8895f4f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-41.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-41.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-42.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-42.ast
index ee46585..0a46fe4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-42.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-42.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-43.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-43.ast
index 1cd20fe..d56a20d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-43.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-43.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-44.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-44.ast
index a45c21d..4a2e9a8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-44.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-44.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-45.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-45.ast
index 9b91435..faa6df8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-45.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-45.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-46.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-46.ast
index 6bc3955..d730df6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-46.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-46.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-47.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-47.ast
index 15a5734..62f7711 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-47.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-47.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -52,7 +52,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -64,7 +64,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-48.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-48.ast
index 5ef0fca..0b0f3fc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-48.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-48.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -52,7 +52,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -64,7 +64,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-49.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-49.ast
index f4b31ee..6cc6478 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-49.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-49.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-50.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-50.ast
index 6d1f06f..3b5ca90 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-50.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-50.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-51.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-51.ast
index f2aa26a..724e948 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-51.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-51.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -52,7 +52,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -64,7 +64,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-52.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-52.ast
index 61becde..5594a15 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-52.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-52.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -52,7 +52,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -64,7 +64,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-53.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-53.ast
index 8ef97e2..91a3072 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-53.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-53.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -52,7 +52,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -64,7 +64,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-54.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-54.ast
index 598b37f..0dde970 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-54.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-54.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-55.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-55.ast
index 3f8f239..c939202 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-55.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-55.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-56.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-56.ast
index 954abaf..f173658 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-56.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-56.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-57.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-57.ast
index 7747cb9..4397481 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-57.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-57.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-58.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-58.ast
index 3579bd7..c0ef98f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-58.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-58.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-59.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-59.ast
index 3b1647a..06fb34c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-59.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-59.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-60.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-60.ast
index 8c4d048..8bb9cbe 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-60.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-60.ast
@@ -15,19 +15,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-61.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-61.ast
index 7496536..afb7c7b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-61.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-61.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -52,7 +52,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -64,7 +64,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-62.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-62.ast
index eb610ea..d2de0a8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-62.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-62.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-63.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-63.ast
index 40b17fa..ac470b4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-63.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/btree-index/btree-secondary-63.ast
@@ -15,20 +15,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -40,7 +40,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.ast
index 40bd920..2a2447b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains-panic.ast
@@ -17,19 +17,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-contains-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -39,7 +39,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains.ast
index 3b42bbf..ea8456d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-contains.ast
@@ -17,19 +17,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-contains.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -39,7 +39,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
index 8e0e781..de58b35 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
@@ -17,20 +17,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -40,6 +40,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.ast
index 4bed1f6..7219ea6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-check.ast
@@ -17,20 +17,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=authors
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-panic.ast
index 8b8a08d..dec4a8c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance-panic.ast
@@ -17,20 +17,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=authors
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.ast
index 577375a..d9a978b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-edit-distance.ast
@@ -17,20 +17,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=authors
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
index c57cdb2..bdc2fbf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
@@ -19,19 +19,19 @@
 Set simthreshold=1
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
index 63b40b7..9aec6f0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
@@ -20,20 +20,20 @@
 Set simthreshold=0.8f
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.ast
index b6c0c6c..4494aa8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard-check.ast
@@ -18,13 +18,13 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
@@ -32,7 +32,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.ast
index 680a980..f0c7506 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ngram-jaccard.ast
@@ -18,13 +18,13 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
@@ -32,7 +32,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.ast
index eb849fa..7cdc47f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check-panic.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-edit-distance-check-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=interests
@@ -62,7 +62,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.ast
index fcfd527..7e4626b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-check.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-edit-distance-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=interests
@@ -62,7 +62,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.ast
index 7137fa4..8f80b01 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance-panic.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-edit-distance-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=interests
@@ -62,7 +62,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.ast
index f368e08..83d0571 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-edit-distance.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-edit-distance.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=interests
@@ -62,7 +62,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
index 21e8d25..eef9997 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-edit-distance.ast
@@ -33,19 +33,19 @@
 Set simthreshold=1
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
@@ -60,7 +60,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.ast
index 4ff7005..ca89a6a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-fuzzyeq-jaccard.ast
@@ -33,19 +33,19 @@
 Set simthreshold=0.8f
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.ast
index cba059e..fc7f74c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard-check.ast
@@ -31,20 +31,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.similarity-jaccard-check@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=interests
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard.ast
index 471e4b4..3985eea 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/olist-jaccard.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_olist-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=interests
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
index 7ceee06..8d69835 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-fuzzyeq-jaccard.ast
@@ -34,19 +34,19 @@
 Set simthreshold=0.8f
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.ast
index 3ab2f47..e0b48ba 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard-check.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ulist-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.similarity-jaccard-check@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=interests
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.ast
index 47e2710..f7501e4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/ulist-jaccard.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ulist-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=interests
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-contains.ast
index 9574946..f0da7f6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-contains.ast
@@ -17,19 +17,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-contains.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -39,7 +39,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
index 3425852..2cd00d0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
@@ -19,20 +19,20 @@
 Set simthreshold=0.5f
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.ast
index 775bf9d..1bbb4e1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard-check.ast
@@ -17,13 +17,13 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
@@ -31,7 +31,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard.ast
index 30322e0..f69b698 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-basic/word-jaccard.ast
@@ -17,13 +17,13 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
@@ -31,7 +31,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
index 64d82a8..3274d55 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
@@ -17,20 +17,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=eda ]
+Let Variable [ Name=$eda ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -38,12 +38,12 @@
     LiteralExpr [STRING] [Amihay Motro]
     LiteralExpr [LONG] [3]
   ]
-LetVariable [ Name=edb ]
+Let Variable [ Name=$edb ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -54,12 +54,12 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=eda ]
+      Variable [ Name=$eda ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     IndexAccessor [
-      Variable [ Name=edb ]
+      Variable [ Name=$edb ]
       Index:       LiteralExpr [LONG] [0]
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
index c81f45c..ba67f6c1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
@@ -17,20 +17,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=edb ]
+Let Variable [ Name=$edb ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -38,12 +38,12 @@
     LiteralExpr [STRING] [Amihay Motro]
     LiteralExpr [LONG] [5]
   ]
-LetVariable [ Name=eda ]
+Let Variable [ Name=$eda ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -54,12 +54,12 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=edb ]
+      Variable [ Name=$edb ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     IndexAccessor [
-      Variable [ Name=eda ]
+      Variable [ Name=$eda ]
       Index:       LiteralExpr [LONG] [0]
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
index 7607155..b4cf5a8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
@@ -17,20 +17,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -40,6 +40,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.ast
index 4cd835e..690da4c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-let.ast
@@ -17,20 +17,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -40,6 +40,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
index 6d03271..0e0ef6b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
@@ -23,7 +23,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=id
@@ -34,7 +34,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
@@ -46,7 +46,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   IndexAccessor [
@@ -54,7 +54,7 @@
       FunctionCall test.substring@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
index 3387f65..7e7436a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
@@ -23,7 +23,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=id
@@ -34,7 +34,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
@@ -46,24 +46,24 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=word ]
+  Variable [ Name=$word ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=word ]
+      Variable [ Name=$word ]
       LiteralExpr [STRING] [Multmedia]
       LiteralExpr [LONG] [1]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.ast
index 8ad226c..eb504ee 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-let.ast
@@ -18,21 +18,21 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -49,6 +49,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
index b918f87..894bfdf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
@@ -22,12 +22,12 @@
   (
     LiteralExpr [STRING] [Paper]
     :
-    Variable [ Name=paper_tokens ]
+    Variable [ Name=$paper_tokens ]
   )
   (
     LiteralExpr [STRING] [Query]
     :
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$query_tokens ]
   )
 ]
 ]
@@ -35,14 +35,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.gram-tokens@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
@@ -50,22 +50,22 @@
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.gram-tokens@3[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.ast
index 9c5afe5..de2b1ee 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let-panic.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_olist-edit-distance-check-let-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
@@ -59,13 +59,13 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.ast
index ab8e971..8ca4b77 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-edit-distance-check-let.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_olist-edit-distance-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
@@ -59,13 +59,13 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.ast
index 1b70a40..72bc93d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/olist-jaccard-check-let.ast
@@ -31,20 +31,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_olist-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
@@ -58,6 +58,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.ast
index 7109124..c04b63d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/ulist-jaccard-check-let.ast
@@ -32,20 +32,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ulist-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
@@ -59,6 +59,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.ast
index c2c8ed1..38c78e1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-let.ast
@@ -17,21 +17,21 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_word-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -44,6 +44,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.ast
index e9ee13e..163f016 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-complex/word-jaccard-check-multi-let.ast
@@ -21,12 +21,12 @@
   (
     LiteralExpr [STRING] [Paper]
     :
-    Variable [ Name=paper_tokens ]
+    Variable [ Name=$paper_tokens ]
   )
   (
     LiteralExpr [STRING] [Query]
     :
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$query_tokens ]
   )
 ]
 ]
@@ -34,33 +34,33 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
     ]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.8]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
index d3d4af4..62696f8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
@@ -41,7 +41,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=tweetid
@@ -52,7 +52,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=message-text
@@ -71,7 +71,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -82,7 +82,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=message-text
@@ -94,21 +94,21 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.edit-distance-check@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=message-text
           ]
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=message-text
@@ -118,14 +118,14 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -133,7 +133,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -143,7 +143,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -158,13 +158,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -177,7 +177,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
index ac59629..2e47442 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-jaccard-check-idx_01.ast
@@ -41,7 +41,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=tweetid
@@ -52,7 +52,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=referred-topics
@@ -71,7 +71,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -82,7 +82,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=referred-topics
@@ -94,21 +94,21 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.similarity-jaccard-check@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=referred-topics
           ]
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=referred-topics
@@ -118,14 +118,14 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -133,7 +133,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -143,7 +143,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -158,13 +158,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -177,7 +177,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.ast
index a19d646..5ba5f32 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-check_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     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 [
@@ -63,14 +63,14 @@
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -83,7 +83,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -91,7 +91,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.ast
index 49546ce..37e8adf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-contains.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     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 [
@@ -63,14 +63,14 @@
       FunctionCall test.edit-distance-contains@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -83,7 +83,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -91,7 +91,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.ast
index 72b766e..5a6ff28 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance-inline.ast
@@ -23,7 +23,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=authors
@@ -34,7 +34,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=authors
@@ -43,7 +43,7 @@
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -51,27 +51,27 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=authors
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=authors
@@ -80,7 +80,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <
       LiteralExpr [LONG] [3]
     ]
@@ -88,7 +88,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -96,7 +96,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.ast
index ac71369..d7ed172 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-edit-distance_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     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 [
@@ -63,14 +63,14 @@
       FunctionCall test.edit-distance@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -83,7 +83,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -91,7 +91,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
index 376f2bc..c4feb38 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
@@ -38,12 +38,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -51,20 +51,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=authors
@@ -72,7 +72,7 @@
       ~=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=authors
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -90,7 +90,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
index 1200ac7..4dc9a32 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
@@ -39,12 +39,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -52,13 +52,13 @@
     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 [
@@ -66,7 +66,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -78,7 +78,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -91,7 +91,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -99,7 +99,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.ast
index 3e8a945..b698c0a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-check_01.ast
@@ -37,12 +37,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -50,13 +50,13 @@
     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 [
@@ -65,7 +65,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -76,7 +76,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -92,7 +92,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -100,7 +100,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.ast
index 1b1ea1a..e516607 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard-inline.ast
@@ -24,7 +24,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -35,7 +35,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=title
@@ -44,7 +44,7 @@
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -52,21 +52,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -77,7 +77,7 @@
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -89,7 +89,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
@@ -97,7 +97,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -105,7 +105,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.ast
index 10bf0c9..5ce3d57 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ngram-jaccard_01.ast
@@ -37,12 +37,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -50,13 +50,13 @@
     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 [
@@ -65,7 +65,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -76,7 +76,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -92,7 +92,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -100,7 +100,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.ast
index ef43cbb..c699f9a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-check_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -63,14 +63,14 @@
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=interests
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=interests
@@ -83,7 +83,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -91,7 +91,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.ast
index bae005f..07980e6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance-inline.ast
@@ -38,7 +38,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=interests
@@ -49,7 +49,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=interests
@@ -58,7 +58,7 @@
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -66,27 +66,27 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=interests
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=interests
@@ -95,7 +95,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [2]
     ]
@@ -103,7 +103,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -111,7 +111,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.ast
index 1b7af59..9a7c3ab 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-edit-distance_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -63,14 +63,14 @@
       FunctionCall test.edit-distance@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=interests
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=interests
@@ -83,7 +83,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -91,7 +91,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
index 90819cd..f441dfd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.ast
@@ -38,12 +38,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -51,20 +51,20 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=interests
@@ -72,7 +72,7 @@
       ~=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=interests
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -90,7 +90,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
index 9d66f1a..44af4b1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.ast
@@ -38,12 +38,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -51,20 +51,20 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=interests
@@ -72,7 +72,7 @@
       ~=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=interests
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -90,7 +90,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.ast
index 9012c9d..78179ce 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-check_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -63,14 +63,14 @@
       FunctionCall test.similarity-jaccard-check@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=interests
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=interests
@@ -83,7 +83,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -91,7 +91,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.ast
index 1dfeea7..481a48f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard-inline.ast
@@ -38,7 +38,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=interests
@@ -49,7 +49,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=interests
@@ -58,7 +58,7 @@
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -66,27 +66,27 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=interests
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=interests
@@ -95,7 +95,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.7]
     ]
@@ -103,7 +103,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -111,7 +111,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.ast
index c9de1c8..4412aa0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/olist-jaccard_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -63,14 +63,14 @@
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=interests
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=interests
@@ -83,7 +83,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -91,7 +91,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
index dfa31df..e394989 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.ast
@@ -38,12 +38,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -51,20 +51,20 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=interests
@@ -72,7 +72,7 @@
       ~=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=interests
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -90,7 +90,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.ast
index b1f82d3..53f66d9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-check_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -63,14 +63,14 @@
       FunctionCall test.similarity-jaccard-check@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=interests
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=interests
@@ -83,7 +83,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -91,7 +91,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.ast
index 01fa39d..dc4c405 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard-inline.ast
@@ -38,7 +38,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=interests
@@ -49,7 +49,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=interests
@@ -58,7 +58,7 @@
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -66,27 +66,27 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=interests
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=interests
@@ -95,7 +95,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.7]
     ]
@@ -103,7 +103,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -111,7 +111,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.ast
index d19dc98..bd7e024 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/ulist-jaccard_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -63,14 +63,14 @@
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=interests
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=interests
@@ -83,7 +83,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -91,7 +91,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
index d7f822e..2dad5cb 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
@@ -38,12 +38,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -51,13 +51,13 @@
     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 [
@@ -65,7 +65,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -75,7 +75,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -86,7 +86,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -94,7 +94,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
index cc26ec4..e8b4564 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
@@ -37,7 +37,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -48,7 +48,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=nested
       ]
       Field=tweetid
@@ -58,7 +58,7 @@
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -68,21 +68,21 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t2 ]
+  Variable [ Name=$t2 ]
 ]
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=nested
         ]
         Field=message-text
@@ -91,7 +91,7 @@
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=nested
         ]
         Field=message-text
@@ -102,14 +102,14 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=nested
         ]
         Field=tweetid
@@ -123,7 +123,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=nested
         ]
         Field=tweetid
@@ -131,7 +131,7 @@
       !=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=nested
         ]
         Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.ast
index 495205f..7f05b15 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-check_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     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 [
@@ -64,7 +64,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -73,7 +73,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -87,7 +87,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -95,7 +95,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.ast
index 3b57240..e33d74d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard-inline.ast
@@ -23,7 +23,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -34,7 +34,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=title
@@ -43,7 +43,7 @@
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -51,21 +51,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -74,7 +74,7 @@
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -84,7 +84,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
@@ -92,7 +92,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -100,7 +100,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard_01.ast
index 8340047..51acd74 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/inverted-index-join/word-jaccard_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     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 [
@@ -64,7 +64,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -73,7 +73,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -87,7 +87,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -95,7 +95,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
index 40e523f..76b9fe4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
@@ -37,7 +37,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -48,7 +48,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -65,7 +65,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -76,7 +76,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -88,22 +88,22 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -116,14 +116,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -134,7 +134,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -147,7 +147,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
index ceee580..0e1f873 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
@@ -37,7 +37,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -48,7 +48,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -65,7 +65,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -76,7 +76,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -88,25 +88,25 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall test.spatial-intersect@2[
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=sender-location
             ]
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -114,7 +114,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -124,7 +124,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -139,14 +139,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -157,7 +157,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -170,7 +170,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.ast
index e0cb78f..6aa939e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_01.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,25 +38,25 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.ast
index 47d62e5..9db17c9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_02.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,25 +38,25 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.ast
index 27c0ce2..3ddad6e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-index/rtree-index-join/spatial-intersect-point_03.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,26 +37,26 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=point
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.ast
index e53eac9..d24e5ac 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/disjunction-to-join.ast
@@ -14,20 +14,20 @@
 DatasetDecl TestSet(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TestSet]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=nested
         ]
         Field=idx
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=nested
         ]
         Field=idx
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
index 068caed..34bd59c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
@@ -36,7 +36,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -47,7 +47,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -64,7 +64,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -75,7 +75,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -87,13 +87,13 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=countA
@@ -101,7 +101,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -110,7 +110,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -125,13 +125,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -144,7 +144,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
index 3ebfb0f..be7c075 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
@@ -35,7 +35,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -46,7 +46,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -63,7 +63,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -74,7 +74,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -86,13 +86,13 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=countA
@@ -100,7 +100,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -109,7 +109,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -124,13 +124,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -143,7 +143,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
index 45cb41b..b74cb45 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
@@ -36,7 +36,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -47,7 +47,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -64,7 +64,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -75,7 +75,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -87,14 +87,14 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=countA
@@ -102,7 +102,7 @@
             =
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=countB
@@ -112,7 +112,7 @@
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -120,7 +120,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -130,7 +130,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -145,13 +145,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -164,7 +164,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
index b3a5334..a077d25 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
@@ -35,7 +35,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -46,7 +46,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -63,7 +63,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -74,7 +74,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -86,14 +86,14 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=countA
@@ -101,7 +101,7 @@
             =
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=countB
@@ -111,7 +111,7 @@
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -119,7 +119,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -129,7 +129,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -144,13 +144,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -163,7 +163,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.ast
index b21bac9..a2a5032 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_01.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -51,7 +51,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -61,7 +61,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -69,7 +69,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.ast
index e60c411..48340af 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_02.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -51,7 +51,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -61,7 +61,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -69,7 +69,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.ast
index fd3753d..aeb32e4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-join_03.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -51,7 +51,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -61,7 +61,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -69,7 +69,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.ast
index 3d0403f..7938842 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_01.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -51,7 +51,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -61,7 +61,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -69,7 +69,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.ast
index bd1ea77..123b788 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_02.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -51,7 +51,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -61,7 +61,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -69,7 +69,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.ast
index d4b02fb..f09ca2c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_03.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -51,7 +51,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -61,7 +61,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -69,7 +69,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.ast
index 4178cd2..53b226f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_04.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -51,7 +51,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -61,7 +61,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -69,7 +69,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.ast
index 7cf0182..2c06658 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_05.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -51,7 +51,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -61,7 +61,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -69,7 +69,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.ast
index dcc85a8..51d28ce 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-composite-key-prefix-join_06.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=fname
@@ -51,7 +51,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=fname
@@ -61,7 +61,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp1 ]
+          Variable [ Name=$emp1 ]
           Field=nested
         ]
         Field=lname
@@ -69,7 +69,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp2 ]
+          Variable [ Name=$emp2 ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.ast
index dbddd340..11c4bf2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multiindex.ast
@@ -51,7 +51,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=nested
       ]
       Field=id
@@ -62,7 +62,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=nested
       ]
       Field=author-id
@@ -73,7 +73,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=nested
       ]
       Field=name
@@ -84,7 +84,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=nested
       ]
       Field=message
@@ -96,20 +96,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=user ]
+          Variable [ Name=$user ]
           Field=nested
         ]
         Field=id
@@ -117,7 +117,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=message ]
+          Variable [ Name=$message ]
           Field=nested
         ]
         Field=author-id-copy
@@ -127,7 +127,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=user ]
+          Variable [ Name=$user ]
           Field=nested
         ]
         Field=id
@@ -139,7 +139,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=user ]
+          Variable [ Name=$user ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.ast
index b9aaf17..11de0a8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join-multipred.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,20 +48,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -69,7 +69,7 @@
       =
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -79,7 +79,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=authors
@@ -87,7 +87,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=authors
@@ -97,7 +97,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=misc
@@ -105,7 +105,7 @@
       >
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=misc
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.ast
index 8a0335a..9968af1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_01.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,19 +48,19 @@
     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 [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -68,7 +68,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.ast
index e1a95b8..9bd1222 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_02.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,19 +48,19 @@
     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 [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -68,7 +68,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.ast
index 580e6c7..f65b690 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_03.ast
@@ -34,12 +34,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -47,19 +47,19 @@
     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 [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -67,7 +67,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.ast
index 5fbe533..1150ccc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_04.ast
@@ -20,12 +20,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [arec2]
     :
-    Variable [ Name=a2 ]
+    Variable [ Name=$a2 ]
   )
 ]
 ]
@@ -33,19 +33,19 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a2 ]
+  Variable [ Name=$a2 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -53,7 +53,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a2 ]
+        Variable [ Name=$a2 ]
         Field=nested
       ]
       Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.ast
index f0d219c..da298cc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index-join/secondary-equi-join_05.ast
@@ -34,12 +34,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -47,19 +47,19 @@
     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 [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -67,7 +67,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-33.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-33.ast
index 725f188..24af576 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-33.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-33.ast
@@ -13,19 +13,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-34.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-34.ast
index f0c02da..3930fd6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-34.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-34.ast
@@ -13,19 +13,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-35.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-35.ast
index cea0334..b674574 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-35.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-35.ast
@@ -13,19 +13,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-36.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-36.ast
index 28048b6..92a28cc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-36.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-36.ast
@@ -13,19 +13,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-37.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-37.ast
index 27af6f4..250ad1e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-37.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-37.ast
@@ -13,19 +13,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-38.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-38.ast
index c88b533..a7108e0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-38.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-38.ast
@@ -13,19 +13,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-39.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-39.ast
index d1df2ac..cb1774e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-39.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-39.ast
@@ -13,19 +13,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-40.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-40.ast
index b6c72c9..92971eb 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-40.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-40.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-41.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-41.ast
index a9496a7..7906d28 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-41.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-41.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-42.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-42.ast
index 22b97e9..922645d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-42.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-42.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-43.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-43.ast
index 4aef985..06ae9d0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-43.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-43.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-44.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-44.ast
index d0a296f..4a49cb2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-44.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-44.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-45.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-45.ast
index 0255cc2..316459e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-45.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-45.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-46.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-46.ast
index eaed89e..9525790 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-46.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-46.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-47.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-47.ast
index f512fbd..17ecdff 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-47.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-47.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -50,7 +50,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-48.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-48.ast
index f55b564..5158032 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-48.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-48.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -50,7 +50,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-49.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-49.ast
index 50d65a3..64d6ccd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-49.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-49.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-50.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-50.ast
index eb5f1f9..5fe76e0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-50.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-50.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-51.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-51.ast
index cef6838..da19614 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-51.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-51.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -50,7 +50,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-52.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-52.ast
index 341807f..4a1d2d8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-52.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-52.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -50,7 +50,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-53.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-53.ast
index c9c1c17..397de9a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-53.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-53.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -50,7 +50,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-54.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-54.ast
index 5dd8fe0..54ef7c8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-54.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-54.ast
@@ -14,19 +14,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-55.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-55.ast
index bb8a2e3..37c3193 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-55.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-55.ast
@@ -14,19 +14,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-56.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-56.ast
index 442d010..658a2e7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-56.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-56.ast
@@ -14,19 +14,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-57.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-57.ast
index d5d1b10..bb40c7c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-57.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-57.ast
@@ -14,19 +14,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-58.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-58.ast
index 0f5da93..07be18c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-58.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-58.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-59.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-59.ast
index 63c2c5c..1299c17 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-59.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-59.ast
@@ -14,20 +14,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -39,7 +39,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-60.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-60.ast
index bfa8c23..d237003 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-60.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-60.ast
@@ -14,19 +14,19 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=nested
       ]
       Field=fname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-61.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-61.ast
index eaed6ec..9d7a3b3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-61.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-61.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
@@ -50,7 +50,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-62.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-62.ast
index 07e0455..e68bb37 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-62.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-62.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-63.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-63.ast
index b0e4f3c..60cabc1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-63.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/btree-index/btree-secondary-63.ast
@@ -13,20 +13,20 @@
 DatasetDecl testdst(TestType) partitioned by [[nested, id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=fname
@@ -38,7 +38,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=emp ]
+          Variable [ Name=$emp ]
           Field=nested
         ]
         Field=lname
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.ast
index 4c4c0e8..9e7aed0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains-panic.ast
@@ -16,19 +16,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-contains-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -38,7 +38,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.ast
index f8f86e7..60162e9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-contains.ast
@@ -16,19 +16,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-contains.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -38,7 +38,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
index fb663bf..6b0f81e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check-panic.ast
@@ -16,20 +16,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -39,6 +39,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.ast
index 68fc643..89b8dcc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-check.ast
@@ -16,20 +16,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=authors
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.ast
index 559cd4b..bfdea24 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance-panic.ast
@@ -16,20 +16,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=authors
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.ast
index 4457052..d629746 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-edit-distance.ast
@@ -16,20 +16,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=authors
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
index a746713..fcad98a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
@@ -18,19 +18,19 @@
 Set simthreshold=1
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
index d02c0d1..b059b1d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
@@ -19,20 +19,20 @@
 Set simthreshold=0.8f
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.ast
index c891779..9055050 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard-check.ast
@@ -17,13 +17,13 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
@@ -31,7 +31,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.ast
index 762849f..82a72f9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/ngram-jaccard.ast
@@ -17,13 +17,13 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
@@ -31,7 +31,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-contains.ast
index 6b72faf..0c425ac 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-contains.ast
@@ -16,19 +16,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-contains.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -38,7 +38,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
index 7858ad9..8bfedca 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-fuzzyeq-jaccard.ast
@@ -18,20 +18,20 @@
 Set simthreshold=0.5f
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-check.ast
index 6bdc8ff..e370ef4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard-check.ast
@@ -16,13 +16,13 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
@@ -30,7 +30,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.ast
index 53a2733..3e080c5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-basic/word-jaccard.ast
@@ -16,13 +16,13 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
@@ -30,7 +30,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
index ca25fbb..7ff7fa8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
@@ -16,20 +16,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=eda ]
+Let Variable [ Name=$eda ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -37,12 +37,12 @@
     LiteralExpr [STRING] [Amihay Motro]
     LiteralExpr [LONG] [3]
   ]
-LetVariable [ Name=edb ]
+Let Variable [ Name=$edb ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -53,12 +53,12 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=eda ]
+      Variable [ Name=$eda ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     IndexAccessor [
-      Variable [ Name=edb ]
+      Variable [ Name=$edb ]
       Index:       LiteralExpr [LONG] [0]
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
index 0fc7e6d..98fd444 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
@@ -16,20 +16,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=edb ]
+Let Variable [ Name=$edb ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -37,12 +37,12 @@
     LiteralExpr [STRING] [Amihay Motro]
     LiteralExpr [LONG] [5]
   ]
-LetVariable [ Name=eda ]
+Let Variable [ Name=$eda ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -53,12 +53,12 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=edb ]
+      Variable [ Name=$edb ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     IndexAccessor [
-      Variable [ Name=eda ]
+      Variable [ Name=$eda ]
       Index:       LiteralExpr [LONG] [0]
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
index ae78c81..9354f98 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
@@ -16,20 +16,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -39,6 +39,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.ast
index 947360c..1da2986 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-let.ast
@@ -16,20 +16,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -39,6 +39,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
index 9dba3e7..b9bae08 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-substring.ast
@@ -22,7 +22,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=id
@@ -33,7 +33,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
@@ -45,7 +45,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   IndexAccessor [
@@ -53,7 +53,7 @@
       FunctionCall test.substring@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=nested
           ]
           Field=title
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
index 7b55d93..fcc11b3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
@@ -22,7 +22,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=id
@@ -33,7 +33,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
@@ -45,24 +45,24 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=word ]
+  Variable [ Name=$word ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=word ]
+      Variable [ Name=$word ]
       LiteralExpr [STRING] [Multmedia]
       LiteralExpr [LONG] [1]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.ast
index 79a88fe..3875cd8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-let.ast
@@ -17,21 +17,21 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -48,6 +48,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
index 5010c1b..db83edf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/ngram-jaccard-check-multi-let.ast
@@ -21,12 +21,12 @@
   (
     LiteralExpr [STRING] [Paper]
     :
-    Variable [ Name=paper_tokens ]
+    Variable [ Name=$paper_tokens ]
   )
   (
     LiteralExpr [STRING] [Query]
     :
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$query_tokens ]
   )
 ]
 ]
@@ -34,14 +34,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.gram-tokens@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
@@ -49,22 +49,22 @@
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.gram-tokens@3[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.ast
index 7dbeebc..0132430 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-let.ast
@@ -16,21 +16,21 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_word-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -43,6 +43,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.ast
index 17f311a..55c28e7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-complex/word-jaccard-check-multi-let.ast
@@ -20,12 +20,12 @@
   (
     LiteralExpr [STRING] [Paper]
     :
-    Variable [ Name=paper_tokens ]
+    Variable [ Name=$paper_tokens ]
   )
   (
     LiteralExpr [STRING] [Query]
     :
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$query_tokens ]
   )
 ]
 ]
@@ -33,33 +33,33 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
     ]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.8]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
index 6711a42..10b23d7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
@@ -40,7 +40,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=tweetid
@@ -51,7 +51,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=message-text
@@ -70,7 +70,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -81,7 +81,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=message-text
@@ -93,21 +93,21 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.edit-distance-check@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=message-text
           ]
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=message-text
@@ -117,14 +117,14 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -132,7 +132,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -142,7 +142,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -157,13 +157,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -176,7 +176,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.ast
index 4e28240..fb0a906 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_01.ast
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [title1]
     :
     FieldAccessor [
-      Variable [ Name=o1 ]
+      Variable [ Name=$o1 ]
       Field=title
     ]
   )
@@ -33,7 +33,7 @@
     LiteralExpr [STRING] [title2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=title
     ]
   )
@@ -43,47 +43,47 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=title
       ]
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.ast
index 506ae04..4df1127 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_02.ast
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [title1]
     :
     FieldAccessor [
-      Variable [ Name=o1 ]
+      Variable [ Name=$o1 ]
       Field=title
     ]
   )
@@ -33,7 +33,7 @@
     LiteralExpr [STRING] [title2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=title
     ]
   )
@@ -43,47 +43,47 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=title
       ]
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.ast
index 1818952..a836da0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_03.ast
@@ -16,7 +16,7 @@
     LiteralExpr [STRING] [title1]
     :
     FieldAccessor [
-      Variable [ Name=o1 ]
+      Variable [ Name=$o1 ]
       Field=title
     ]
   )
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [title2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=title
     ]
   )
@@ -34,47 +34,47 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=title
       ]
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.ast
index 7cbcd11..42281a1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-contains_04.ast
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [title1]
     :
     FieldAccessor [
-      Variable [ Name=o1 ]
+      Variable [ Name=$o1 ]
       Field=title
     ]
   )
@@ -32,7 +32,7 @@
     LiteralExpr [STRING] [title2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=title
     ]
   )
@@ -42,47 +42,47 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=title
       ]
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.ast
index ba7ded4..8e3ad38 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     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 [
@@ -62,14 +62,14 @@
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -90,7 +90,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.ast
index 3073186..2429f49 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -62,14 +62,14 @@
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -90,7 +90,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.ast
index 02ea90a..c7665cc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_03.ast
@@ -20,12 +20,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -33,13 +33,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -47,14 +47,14 @@
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -67,7 +67,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -75,7 +75,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.ast
index 88fd01a..1ceb471 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_04.ast
@@ -34,12 +34,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -47,13 +47,13 @@
     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 [
@@ -61,14 +61,14 @@
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -81,7 +81,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -89,7 +89,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.ast
index 88fd01a..1ceb471 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-check_05.ast
@@ -34,12 +34,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -47,13 +47,13 @@
     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 [
@@ -61,14 +61,14 @@
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -81,7 +81,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -89,7 +89,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.ast
index 734acef..d4e3350 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-contains.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     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 [
@@ -62,14 +62,14 @@
       FunctionCall test.edit-distance-contains@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -90,7 +90,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.ast
index 0a2ffb5..09f2572 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance-inline.ast
@@ -22,7 +22,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=authors
@@ -33,7 +33,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=authors
@@ -42,7 +42,7 @@
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -50,27 +50,27 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=authors
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=authors
@@ -79,7 +79,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <
       LiteralExpr [LONG] [3]
     ]
@@ -87,7 +87,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -95,7 +95,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.ast
index ebf2183..940f918 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_01.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     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 [
@@ -62,14 +62,14 @@
       FunctionCall test.edit-distance@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -90,7 +90,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.ast
index 59aadbd..5e5f175 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_02.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -62,14 +62,14 @@
       FunctionCall test.edit-distance@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -90,7 +90,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.ast
index d14d9bf..c2fca7f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_03.ast
@@ -20,12 +20,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -33,13 +33,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -47,14 +47,14 @@
       FunctionCall test.edit-distance@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -67,7 +67,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -75,7 +75,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.ast
index e0d3984..b33f72b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_04.ast
@@ -34,12 +34,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -47,13 +47,13 @@
     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 [
@@ -61,14 +61,14 @@
       FunctionCall test.edit-distance@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -81,7 +81,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -89,7 +89,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.ast
index e0d3984..b33f72b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-edit-distance_05.ast
@@ -34,12 +34,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -47,13 +47,13 @@
     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 [
@@ -61,14 +61,14 @@
       FunctionCall test.edit-distance@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=authors
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=authors
@@ -81,7 +81,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -89,7 +89,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
index 1099052..3ae061f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
@@ -37,12 +37,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -50,20 +50,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=authors
@@ -71,7 +71,7 @@
       ~=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=authors
@@ -81,7 +81,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -89,7 +89,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
index e63c7f0..855d1f0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
@@ -37,12 +37,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -50,20 +50,20 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=authors
@@ -71,7 +71,7 @@
       ~=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=authors
@@ -81,7 +81,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -89,7 +89,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
index c69f8e9..0ba9b96 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
@@ -22,12 +22,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -35,20 +35,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=authors
@@ -56,7 +56,7 @@
       ~=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=authors
@@ -66,7 +66,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -74,7 +74,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
index 8e3de15..77c3912 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,20 +49,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=authors
@@ -70,7 +70,7 @@
       ~=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=authors
@@ -80,7 +80,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -88,7 +88,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
index 8e3de15..77c3912 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,20 +49,20 @@
     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 [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=authors
@@ -70,7 +70,7 @@
       ~=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=authors
@@ -80,7 +80,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -88,7 +88,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
index c745c0c..a3e07df 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
@@ -38,12 +38,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -51,13 +51,13 @@
     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 [
@@ -65,7 +65,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -77,7 +77,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -90,7 +90,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -98,7 +98,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
index d72fbf6..0515157 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
@@ -38,12 +38,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -51,13 +51,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -65,7 +65,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -77,7 +77,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -90,7 +90,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -98,7 +98,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
index 8eb9e41..02de029 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
@@ -23,12 +23,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -36,13 +36,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -50,7 +50,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -62,7 +62,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -75,7 +75,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -83,7 +83,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
index c4baee4..43ce4fd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
@@ -37,12 +37,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -50,13 +50,13 @@
     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 [
@@ -64,7 +64,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -76,7 +76,7 @@
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -89,7 +89,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -97,7 +97,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.ast
index 15915a7..8479adc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     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 [
@@ -64,7 +64,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -75,7 +75,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -91,7 +91,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -99,7 +99,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.ast
index 7355da2..3a0af2b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_02.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -64,7 +64,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -75,7 +75,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -91,7 +91,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -99,7 +99,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.ast
index 0d42d7b..ba335fc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_03.ast
@@ -21,12 +21,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -34,13 +34,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -49,7 +49,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -60,7 +60,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -76,7 +76,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -84,7 +84,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.ast
index e4bc3b7..546f130 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-check_04.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     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 [
@@ -63,7 +63,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -74,7 +74,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -90,7 +90,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -98,7 +98,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.ast
index 31a2be6..38a5907 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard-inline.ast
@@ -23,7 +23,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -34,7 +34,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=title
@@ -43,7 +43,7 @@
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -51,21 +51,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -76,7 +76,7 @@
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -88,7 +88,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
@@ -96,7 +96,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -104,7 +104,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.ast
index cd31721..f43dedb 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_01.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     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 [
@@ -64,7 +64,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -75,7 +75,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -91,7 +91,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -99,7 +99,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.ast
index f3815a6..89114ec 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_02.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -64,7 +64,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -75,7 +75,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -91,7 +91,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -99,7 +99,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.ast
index 9231855..8fa79f3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_03.ast
@@ -21,12 +21,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -34,13 +34,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -49,7 +49,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -60,7 +60,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -76,7 +76,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -84,7 +84,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.ast
index 28e16ed..03cb954 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/ngram-jaccard_04.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     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 [
@@ -63,7 +63,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -74,7 +74,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -90,7 +90,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -98,7 +98,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
index 08258f2..d686415 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.ast
@@ -37,12 +37,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -50,13 +50,13 @@
     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 [
@@ -64,7 +64,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -74,7 +74,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -85,7 +85,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -93,7 +93,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.ast
index 0e70ed6..036d136 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.ast
@@ -37,12 +37,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -50,13 +50,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -64,7 +64,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -74,7 +74,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -85,7 +85,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -93,7 +93,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.ast
index 82ede4a..868b838 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_03.ast
@@ -22,12 +22,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -35,13 +35,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -49,7 +49,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -59,7 +59,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -70,7 +70,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -78,7 +78,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.ast
index 8649e7b..8228647 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_04.ast
@@ -36,12 +36,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -49,13 +49,13 @@
     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 [
@@ -63,7 +63,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=title
@@ -73,7 +73,7 @@
       FunctionCall test.word-tokens@1[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=title
@@ -84,7 +84,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -92,7 +92,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
index 1116f75..c7ddb54 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check-after-btree-access.ast
@@ -36,7 +36,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -47,7 +47,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=nested
       ]
       Field=tweetid
@@ -57,7 +57,7 @@
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -67,21 +67,21 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t2 ]
+  Variable [ Name=$t2 ]
 ]
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=nested
         ]
         Field=message-text
@@ -90,7 +90,7 @@
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=nested
         ]
         Field=message-text
@@ -101,14 +101,14 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=nested
         ]
         Field=tweetid
@@ -122,7 +122,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=nested
         ]
         Field=tweetid
@@ -130,7 +130,7 @@
       !=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=nested
         ]
         Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.ast
index f6dee16..84cffe8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_01.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     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 [
@@ -63,7 +63,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -72,7 +72,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -86,7 +86,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -94,7 +94,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.ast
index d4005f3..398bdd5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_02.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -63,7 +63,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -72,7 +72,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -86,7 +86,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -94,7 +94,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.ast
index 717ee06..50df581 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_03.ast
@@ -20,12 +20,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -33,13 +33,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -48,7 +48,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -57,7 +57,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -71,7 +71,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -79,7 +79,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.ast
index 9fe2f4a..327d750 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-check_04.ast
@@ -34,12 +34,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -47,13 +47,13 @@
     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 [
@@ -62,7 +62,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -71,7 +71,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -85,7 +85,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -93,7 +93,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.ast
index 7824dfa..b7f45d7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard-inline.ast
@@ -22,7 +22,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=title
@@ -33,7 +33,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=title
@@ -42,7 +42,7 @@
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -50,21 +50,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -73,7 +73,7 @@
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -83,7 +83,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
@@ -91,7 +91,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -99,7 +99,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.ast
index 1197bd39..b5d8f53 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_01.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     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 [
@@ -63,7 +63,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -72,7 +72,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -86,7 +86,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -94,7 +94,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.ast
index 7278fdf..c1ecf1a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_02.ast
@@ -35,12 +35,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -48,13 +48,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -63,7 +63,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -72,7 +72,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -86,7 +86,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -94,7 +94,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.ast
index 2a3b131..a953fdd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_03.ast
@@ -20,12 +20,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -33,13 +33,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -48,7 +48,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -57,7 +57,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -71,7 +71,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -79,7 +79,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.ast
index 4e6e0f8..483b580 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/inverted-index-join/word-jaccard_04.ast
@@ -34,12 +34,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -47,13 +47,13 @@
     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 [
@@ -62,7 +62,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -71,7 +71,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -85,7 +85,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -93,7 +93,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
index 4ad6b23..8e51c71 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
@@ -36,7 +36,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -47,7 +47,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -64,7 +64,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -75,7 +75,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -87,22 +87,22 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -115,14 +115,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -133,7 +133,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -146,7 +146,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
index ef78724..5ec7f58 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
@@ -36,7 +36,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -47,7 +47,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -64,7 +64,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -75,7 +75,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -87,25 +87,25 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall test.spatial-intersect@2[
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=sender-location
             ]
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -113,7 +113,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -123,7 +123,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -138,14 +138,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -156,7 +156,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -169,7 +169,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.ast
index e0cb78f..6aa939e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_01.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,25 +38,25 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.ast
index 47d62e5..9db17c9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_02.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,25 +38,25 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.ast
index 27c0ce2..3ddad6e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_03.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,26 +37,26 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=point
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.ast
index 07a4bc9..b83cd3f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_04.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,26 +37,26 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=point
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.ast
index 07a4bc9..b83cd3f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested-open-index/rtree-index-join/spatial-intersect-point_05.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,26 +37,26 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=point
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj2.ast
index 84c6489..6864f31 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj2.ast
@@ -54,12 +54,12 @@
   (
     LiteralExpr [STRING] [cust]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
   (
     LiteralExpr [STRING] [orders]
     :
-    Variable [ Name=orders ]
+    Variable [ Name=$orders ]
   )
 ]
 ]
@@ -67,9 +67,9 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=orders ]
+Let Variable [ Name=$orders ]
   :=
   (
     SELECT ELEMENT [
@@ -77,12 +77,12 @@
       (
         LiteralExpr [STRING] [order]
         :
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
       )
       (
         LiteralExpr [STRING] [items]
         :
-        Variable [ Name=items ]
+        Variable [ Name=$items ]
       )
     ]
     ]
@@ -90,29 +90,29 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
     ]
-    LetVariable [ Name=items ]
+    Let Variable [ Name=$items ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItems]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_orderkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_orderkey
             ]
           ]
@@ -120,12 +120,12 @@
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_custkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_custkey
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj3.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj3.ast
index 026c1ee..4920f71 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj3.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nested_loj3.ast
@@ -64,12 +64,12 @@
   (
     LiteralExpr [STRING] [cust]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
   (
     LiteralExpr [STRING] [orders]
     :
-    Variable [ Name=orders ]
+    Variable [ Name=$orders ]
   )
 ]
 ]
@@ -77,9 +77,9 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=orders ]
+Let Variable [ Name=$orders ]
   :=
   (
     SELECT ELEMENT [
@@ -87,12 +87,12 @@
       (
         LiteralExpr [STRING] [order]
         :
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
       )
       (
         LiteralExpr [STRING] [items]
         :
-        Variable [ Name=items ]
+        Variable [ Name=$items ]
       )
     ]
     ]
@@ -100,9 +100,9 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
     ]
-    LetVariable [ Name=items ]
+    Let Variable [ Name=$items ]
       :=
       (
         SELECT ELEMENT [
@@ -110,12 +110,12 @@
           (
             LiteralExpr [STRING] [item]
             :
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
           )
           (
             LiteralExpr [STRING] [part_supplier]
             :
-            Variable [ Name=partsupp ]
+            Variable [ Name=$partsupp ]
           )
         ]
         ]
@@ -123,42 +123,42 @@
             LiteralExpr [STRING] [LineItems]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
-        LetVariable [ Name=partsupp ]
+        Let Variable [ Name=$partsupp ]
           :=
           (
             SELECT ELEMENT [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [PartSupp]
               ]
               AS
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
             ]
             Where
               OperatorExpr [
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=ps ]
+                    Variable [ Name=$ps ]
                     Field=ps_partkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l ]
+                    Variable [ Name=$l ]
                     Field=l_partkey
                   ]
                 ]
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=ps ]
+                    Variable [ Name=$ps ]
                     Field=ps_suppkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l ]
+                    Variable [ Name=$l ]
                     Field=l_suppkey
                   ]
                 ]
@@ -167,12 +167,12 @@
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_orderkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_orderkey
             ]
           ]
@@ -180,12 +180,12 @@
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_custkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_custkey
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.ast
index 4578539..6444609 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/disjunction-to-join.ast
@@ -8,19 +8,19 @@
 DatasetDecl TestSet(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TestSet]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=idx
       ]
       =
@@ -29,7 +29,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=idx
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
index 411ae6e..676e410 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_1.ast
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -52,7 +52,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -60,7 +60,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -70,23 +70,23 @@
           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
@@ -99,12 +99,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -114,7 +114,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
index b2a62b5..a98d6c6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_01_2.ast
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -37,7 +37,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -51,7 +51,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -59,7 +59,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -69,23 +69,23 @@
           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
@@ -98,12 +98,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -113,7 +113,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
index b110492..aeddf34 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_1.ast
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -52,7 +52,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -60,7 +60,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -70,37 +70,37 @@
           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
@@ -113,12 +113,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -128,7 +128,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
index d4b8773..949bc95 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/leftouterjoin-probe-pidx-with-join-btree-sidx_02_2.ast
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -37,7 +37,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -51,7 +51,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -59,7 +59,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -69,37 +69,37 @@
           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
@@ -112,12 +112,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -127,7 +127,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.ast
index 929810c..aa21221 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_01.ast
@@ -12,12 +12,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -25,36 +25,36 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.ast
index 4a9748e..f2d72fd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_02.ast
@@ -12,12 +12,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -25,36 +25,36 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.ast
index 465c611..a0013b3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-join_03.ast
@@ -12,12 +12,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -25,36 +25,36 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.ast
index 2477dc0..435e232 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_01.ast
@@ -12,12 +12,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -25,36 +25,36 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.ast
index dbf0d2c..3436d26 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_02.ast
@@ -12,12 +12,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -25,36 +25,36 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.ast
index 9ed20d5..5ffc7d0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_03.ast
@@ -12,12 +12,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -25,36 +25,36 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.ast
index 58a15a8..a8b9222 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_04.ast
@@ -12,12 +12,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -25,36 +25,36 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.ast
index 59f0a35..bf2e615 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_05.ast
@@ -12,12 +12,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -25,36 +25,36 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.ast
index 8475704..c5e7691 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-composite-key-prefix-join_06.ast
@@ -12,12 +12,12 @@
   (
     LiteralExpr [STRING] [emp1]
     :
-    Variable [ Name=emp1 ]
+    Variable [ Name=$emp1 ]
   )
   (
     LiteralExpr [STRING] [emp2]
     :
-    Variable [ Name=emp2 ]
+    Variable [ Name=$emp2 ]
   )
 ]
 ]
@@ -25,36 +25,36 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.ast
index 6d5ac37..0b210cb 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multiindex.ast
@@ -40,7 +40,7 @@
     LiteralExpr [STRING] [fbu-ID]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
   )
@@ -48,7 +48,7 @@
     LiteralExpr [STRING] [fbm-auth-ID]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=author-id
     ]
   )
@@ -56,7 +56,7 @@
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -64,7 +64,7 @@
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
   )
@@ -74,31 +74,31 @@
     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
       ]
       >=
@@ -107,7 +107,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.ast
index 9c8c6a0..2290bb0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join-multipred.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,48 +38,48 @@
     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
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.ast
index 146ec9b..9549946 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_01.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,23 +38,23 @@
     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 [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.ast
index 40d3c17..2e3e53a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_02.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,23 +38,23 @@
     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 [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.ast
index b7c9493..ca97be0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_03.ast
@@ -15,12 +15,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -28,23 +28,23 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.ast
index 1c7d4ec..f19a41e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_04.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,23 +37,23 @@
     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 [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.ast
index 1c7d4ec..f19a41e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index-join/secondary-equi-join_05.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,23 +37,23 @@
     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 [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-33.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-33.ast
index c3c8ec0..1927dc8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-33.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-33.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-34.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-34.ast
index 355a2c7..8e5f71f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-34.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-34.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-35.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-35.ast
index 8b03bd9..87f8f43 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-35.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-35.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-36.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-36.ast
index 1953531..628c58d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-36.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-36.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-37.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-37.ast
index 9adbdf0..7969e13 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-37.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-37.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     !=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-38.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-38.ast
index 5ea1105..57881a5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-38.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-38.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-39.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-39.ast
index c348799..09ee7bc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-39.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-39.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=lname
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-40.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-40.ast
index 35bf424..3cb506d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-40.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-40.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-41.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-41.ast
index 3f7146f..71b8263 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-41.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-41.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -29,7 +29,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-42.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-42.ast
index 5a770cf..f32a2f3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-42.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-42.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-43.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-43.ast
index 130d7e4..c9eb315 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-43.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-43.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-44.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-44.ast
index 40a2665..d9f0d50 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-44.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-44.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-45.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-45.ast
index 70d1db7..4ba35bc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-45.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-45.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-46.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-46.ast
index d4d72c2..bd41a0b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-46.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-46.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-47.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-47.ast
index e408310..ae0ef7a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-47.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-47.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -38,7 +38,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -47,7 +47,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-48.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-48.ast
index dc7597e..ede6359 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-48.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-48.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
@@ -38,7 +38,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -47,7 +47,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-49.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-49.ast
index 8b6dda5..a45a7b8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-49.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-49.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-50.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-50.ast
index 2793524..ae85df2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-50.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-50.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       !=
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       !=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-51.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-51.ast
index 8485705..3259f08 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-51.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-51.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -38,7 +38,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -47,7 +47,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-52.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-52.ast
index 2423780..461ace3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-52.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-52.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
@@ -38,7 +38,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -47,7 +47,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-53.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-53.ast
index 3c706c4..6fe1c53 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-53.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-53.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
@@ -38,7 +38,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -47,7 +47,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-54.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-54.ast
index 629a96e..fd1385d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-54.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-54.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-55.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-55.ast
index 570ccfe..f826ec0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-55.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-55.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     >=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-56.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-56.ast
index b0f15af..c18e798 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-56.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-56.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-57.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-57.ast
index 0697c8f..b4d8a4b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-57.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-57.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-58.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-58.ast
index cf8bd4f..61d7e19 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-58.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-58.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-59.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-59.ast
index 48b75f0..89b635f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-59.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-59.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-60.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-60.ast
index f1ebcef..51aade1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-60.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-60.ast
@@ -8,18 +8,18 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=fname
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-61.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-61.ast
index 39d1390..23f7c3e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-61.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-61.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
@@ -38,7 +38,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -47,7 +47,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-62.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-62.ast
index f5be1ae..af866d8f7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-62.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-62.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       =
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-63.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-63.ast
index 9b8c4a9..7c033ff 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-63.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/btree-index/btree-secondary-63.ast
@@ -8,19 +8,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.ast
index 4eb7d54..9fce7e9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains-panic.ast
@@ -11,25 +11,25 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-contains-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Mu]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.ast
index 58ef699..8717cd8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-contains.ast
@@ -11,25 +11,25 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-contains.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.ast
index 2835349..ef92b67 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check-panic.ast
@@ -11,19 +11,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-check-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.ast
index 323733c..dbe99f8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-check.ast
@@ -11,19 +11,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Amihay Motro]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.ast
index 2252062..8a68f37 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance-panic.ast
@@ -11,19 +11,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Amihay Motro]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.ast
index 6f70a3d..e06550e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-edit-distance.ast
@@ -11,19 +11,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-edit-distance.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Amihay Motro]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
index 4da4614..cc4dd19 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-edit-distance.ast
@@ -13,18 +13,18 @@
 Set simthreshold=1
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     ~=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
index c867d14..f261627 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-fuzzyeq-jaccard.ast
@@ -14,19 +14,19 @@
 Set simthreshold=0.8f
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.ast
index 8419388..421e18f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard-check.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.similarity-jaccard-check@3[
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.ast
index c1166a2..b8fdf89 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/ngram-jaccard.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-contains.ast
index c86b14f..47abd72 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-contains.ast
@@ -11,25 +11,25 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-contains.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.ast
index 1076dab..875d090 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-fuzzyeq-jaccard.ast
@@ -13,19 +13,19 @@
 Set simthreshold=0.5f
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.ast
index 6e0979d..c1c70c0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard-check.ast
@@ -11,20 +11,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-jaccard-check.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.similarity-jaccard-check@3[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.ast
index 9ddcfa7..67cf511 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-basic/word-jaccard.ast
@@ -11,20 +11,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
index 2d8959f..fdb3756 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_01.ast
@@ -11,29 +11,29 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=eda ]
+Let Variable [ Name=$eda ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
     LiteralExpr [LONG] [3]
   ]
-LetVariable [ Name=edb ]
+Let Variable [ Name=$edb ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -42,12 +42,12 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=eda ]
+      Variable [ Name=$eda ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     IndexAccessor [
-      Variable [ Name=edb ]
+      Variable [ Name=$edb ]
       Index:       LiteralExpr [LONG] [0]
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
index 66573e5..8c6e725 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic-nopanic_02.ast
@@ -11,29 +11,29 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic-nopanic_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=edb ]
+Let Variable [ Name=$edb ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
     LiteralExpr [LONG] [5]
   ]
-LetVariable [ Name=eda ]
+Let Variable [ Name=$eda ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -42,12 +42,12 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=edb ]
+      Variable [ Name=$edb ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     IndexAccessor [
-      Variable [ Name=eda ]
+      Variable [ Name=$eda ]
       Index:       LiteralExpr [LONG] [0]
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
index 10dbaf0..e273b6c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let-panic.ast
@@ -11,19 +11,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let-panic.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.ast
index 581af35..988b924 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-let.ast
@@ -11,19 +11,19 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-edit-distance-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.ast
index 288d9cb..b11af23 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-substring.ast
@@ -16,7 +16,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=id
     ]
   )
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   )
@@ -34,14 +34,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
       FunctionCall test.substring@3[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
         LiteralExpr [LONG] [0]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
index 367d1c9..d6e60b8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-edit-distance-check-word-tokens.ast
@@ -16,7 +16,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=id
     ]
   )
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   )
@@ -34,21 +34,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=word ]
+  Variable [ Name=$word ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=word ]
+      Variable [ Name=$word ]
       LiteralExpr [STRING] [Multmedia]
       LiteralExpr [LONG] [1]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.ast
index 34e8c02..1ea8a57 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-let.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_ngram-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -40,6 +40,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.ast
index c389116..2bb8ae2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/ngram-jaccard-check-multi-let.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [Paper]
     :
-    Variable [ Name=paper_tokens ]
+    Variable [ Name=$paper_tokens ]
   )
   (
     LiteralExpr [STRING] [Query]
     :
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$query_tokens ]
   )
 ]
 ]
@@ -29,34 +29,34 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.gram-tokens@3[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.gram-tokens@3[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.ast
index 845fd53..9e3ffd6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-let.ast
@@ -11,20 +11,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-complex_word-jaccard-check-let.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -35,6 +35,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.ast
index 85231a2..2195633 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-complex/word-jaccard-check-multi-let.ast
@@ -15,12 +15,12 @@
   (
     LiteralExpr [STRING] [Paper]
     :
-    Variable [ Name=paper_tokens ]
+    Variable [ Name=$paper_tokens ]
   )
   (
     LiteralExpr [STRING] [Query]
     :
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$query_tokens ]
   )
 ]
 ]
@@ -28,30 +28,30 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.8]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
index 70709c7..4decbcf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/leftouterjoin-probe-pidx-with-join-edit-distance-check-idx_01.ast
@@ -34,7 +34,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=tweetid
         ]
       )
@@ -42,7 +42,7 @@
         LiteralExpr [STRING] [topics]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=message-text
         ]
       )
@@ -58,7 +58,7 @@
           LiteralExpr [STRING] [id]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -66,7 +66,7 @@
           LiteralExpr [STRING] [topics]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
         )
@@ -76,17 +76,17 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.edit-distance-check@3[
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=message-text
           ]
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
           LiteralExpr [LONG] [7]
@@ -94,25 +94,25 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -125,12 +125,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     >
@@ -140,7 +140,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.ast
index 4e28240..fb0a906 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_01.ast
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [title1]
     :
     FieldAccessor [
-      Variable [ Name=o1 ]
+      Variable [ Name=$o1 ]
       Field=title
     ]
   )
@@ -33,7 +33,7 @@
     LiteralExpr [STRING] [title2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=title
     ]
   )
@@ -43,47 +43,47 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=title
       ]
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.ast
index fc5ebed..e1907ec 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_02.ast
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [title1]
     :
     FieldAccessor [
-      Variable [ Name=o1 ]
+      Variable [ Name=$o1 ]
       Field=title
     ]
   )
@@ -33,7 +33,7 @@
     LiteralExpr [STRING] [title2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=title
     ]
   )
@@ -43,47 +43,47 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=title
       ]
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.ast
index 1818952..a836da0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_03.ast
@@ -16,7 +16,7 @@
     LiteralExpr [STRING] [title1]
     :
     FieldAccessor [
-      Variable [ Name=o1 ]
+      Variable [ Name=$o1 ]
       Field=title
     ]
   )
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [title2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=title
     ]
   )
@@ -34,47 +34,47 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=title
       ]
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.ast
index 7cbcd11..42281a1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-contains_04.ast
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [title1]
     :
     FieldAccessor [
-      Variable [ Name=o1 ]
+      Variable [ Name=$o1 ]
       Field=title
     ]
   )
@@ -32,7 +32,7 @@
     LiteralExpr [STRING] [title2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=title
     ]
   )
@@ -42,47 +42,47 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=title
       ]
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.ast
index 24cea4f..3c5feeb 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,24 +38,24 @@
     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 [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -65,12 +65,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.ast
index 9ed8bd6..de05bf0 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_02.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,24 +38,24 @@
     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 [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -65,12 +65,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.ast
index d7a8a14..ff136b2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_03.ast
@@ -15,12 +15,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -28,24 +28,24 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -55,12 +55,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.ast
index 975753c..219e048 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_04.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,24 +37,24 @@
     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 [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -64,12 +64,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.ast
index 975753c..219e048 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_05.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,24 +37,24 @@
     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 [
     IndexAccessor [
       FunctionCall test.edit-distance-check@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -64,12 +64,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.ast
index 0ba4ab2..8e71586 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-check_inline_03.ast
@@ -15,18 +15,18 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
     IndexAccessor [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -36,23 +36,23 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
     LiteralExpr [LONG] [3]
@@ -60,18 +60,18 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.ast
index a6118a3..919ba68 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,24 +38,24 @@
     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 [
     IndexAccessor [
       FunctionCall test.edit-distance-contains@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
         LiteralExpr [LONG] [3]
@@ -65,12 +65,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.ast
index 2d0a7e1..be87f37 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_01.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,24 +38,24 @@
     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 [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
       ]
@@ -65,12 +65,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.ast
index c0418f8..af9b9ef 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_02.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,24 +38,24 @@
     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 [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
       ]
@@ -65,12 +65,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.ast
index eabbfb8..e76d8dd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_03.ast
@@ -15,12 +15,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -28,24 +28,24 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
       ]
@@ -55,12 +55,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.ast
index 4555680..43f5e80 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_04.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,24 +37,24 @@
     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 [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
       ]
@@ -64,12 +64,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.ast
index 4555680..43f5e80 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_05.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,24 +37,24 @@
     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 [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=authors
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=authors
         ]
       ]
@@ -64,12 +64,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.ast
index 605f8eb..8d5e71f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-edit-distance_inline_03.ast
@@ -15,17 +15,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -33,42 +33,42 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <
       LiteralExpr [LONG] [3]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
index cedac1c..dd72303 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_01.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -40,36 +40,36 @@
     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=authors
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=authors
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
index 862c2ac..d1fbdf9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -40,36 +40,36 @@
     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=authors
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=authors
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
index 2a03604..37f51d6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_03.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -30,36 +30,36 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     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=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
index 4cc1d44..c8716bf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_04.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,36 +39,36 @@
     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=authors
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=authors
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
index 4cc1d44..c8716bf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_05.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,36 +39,36 @@
     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=authors
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=authors
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
index 937e1ef..2d6408f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.ast
@@ -28,12 +28,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -41,20 +41,20 @@
     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 [
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -63,7 +63,7 @@
       ~=
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -73,12 +73,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
index e86171e..4f086b3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_02.ast
@@ -28,12 +28,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -41,20 +41,20 @@
     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 [
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -63,7 +63,7 @@
       ~=
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -73,12 +73,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
index da0a3f0..44134d6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_03.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -31,20 +31,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -53,7 +53,7 @@
       ~=
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -63,12 +63,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
index 52a174d..502deb9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_04.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -40,20 +40,20 @@
     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 [
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -62,7 +62,7 @@
       ~=
       FunctionCall test.gram-tokens@3[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
         LiteralExpr [LONG] [3]
@@ -72,12 +72,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.ast
index 28649b3..d983a09 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,13 +39,13 @@
     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 [
@@ -53,7 +53,7 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -61,7 +61,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -74,12 +74,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.ast
index a2bf04b..26d0cca 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_02.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,13 +39,13 @@
     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 [
@@ -53,7 +53,7 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -61,7 +61,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -74,12 +74,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.ast
index f09596d..021ac4d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_03.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -29,13 +29,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -43,7 +43,7 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -51,7 +51,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -64,12 +64,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.ast
index f8c933d..f9aa024 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_04.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,13 +38,13 @@
     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 [
@@ -52,7 +52,7 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -60,7 +60,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -73,12 +73,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.ast
index 0bfbc9a..cfe55f3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard-check_inline_03.ast
@@ -16,18 +16,18 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -37,20 +37,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -58,7 +58,7 @@
     ]
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -69,18 +69,18 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.ast
index 12cb405..d287581 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_01.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,13 +39,13 @@
     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 [
@@ -53,7 +53,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -61,7 +61,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -74,12 +74,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.ast
index 923a598..423fa95 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_02.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,13 +39,13 @@
     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 [
@@ -53,7 +53,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -61,7 +61,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -74,12 +74,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.ast
index 462bc03..9a5b13d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_03.ast
@@ -16,12 +16,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -29,13 +29,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -43,7 +43,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -51,7 +51,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -64,12 +64,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.ast
index 000ee08..eb3854e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_04.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,13 +38,13 @@
     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 [
@@ -52,7 +52,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -60,7 +60,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -73,12 +73,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.ast
index 30800d3..cbdbe18 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/ngram-jaccard_inline_03.ast
@@ -16,17 +16,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -34,20 +34,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -55,7 +55,7 @@
     ]
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -65,19 +65,19 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.ast
index 79578d2..22bb3f5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -40,27 +40,27 @@
     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 [
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
       ]
       ~=
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
       ]
@@ -68,12 +68,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.ast
index fc7db91..d0372f91 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_02.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -40,27 +40,27 @@
     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 [
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
       ]
       ~=
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
       ]
@@ -68,12 +68,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.ast
index d10fd14..1ca2f30 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_03.ast
@@ -17,12 +17,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -30,27 +30,27 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
       ]
       ~=
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
       ]
@@ -58,12 +58,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.ast
index 534cd4e..d02fe3f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_04.ast
@@ -26,12 +26,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -39,27 +39,27 @@
     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 [
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=title
         ]
       ]
       ~=
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=title
         ]
       ]
@@ -67,12 +67,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.ast
index a87ff18..40affc1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check-after-btree-access.ast
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [t1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [t2]
     :
     FieldAccessor [
-      Variable [ Name=t2 ]
+      Variable [ Name=$t2 ]
       Field=tweetid
     ]
   )
@@ -46,7 +46,7 @@
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -56,26 +56,26 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t2 ]
+  Variable [ Name=$t2 ]
 ]
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=message-text
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=message-text
       ]
     ]
@@ -84,13 +84,13 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=tweetid
       ]
       <
@@ -101,12 +101,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=tweetid
       ]
       !=
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=tweetid
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.ast
index 690735b0..bf554dd 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_01.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,13 +38,13 @@
     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 [
@@ -52,13 +52,13 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -69,12 +69,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.ast
index ec6adfd..eea0cc7 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_02.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,13 +38,13 @@
     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 [
@@ -52,13 +52,13 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -69,12 +69,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.ast
index 18dbb83..da4db64 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_03.ast
@@ -15,12 +15,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -28,13 +28,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -42,13 +42,13 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -59,12 +59,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.ast
index a3a68cb..dba70e2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_04.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,13 +37,13 @@
     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 [
@@ -51,13 +51,13 @@
       FunctionCall test.similarity-jaccard-check@3[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -68,12 +68,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.ast
index 416c538..2c1b84d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard-check_inline_03.ast
@@ -15,18 +15,18 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -36,26 +36,26 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
     ]
@@ -64,18 +64,18 @@
 Where
   OperatorExpr [
     IndexAccessor [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       Index:       LiteralExpr [LONG] [0]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.ast
index 68ebc3e..2c603af 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_01.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,13 +38,13 @@
     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 [
@@ -52,13 +52,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -69,12 +69,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.ast
index 10dc0d9..38e2909 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_02.ast
@@ -25,12 +25,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -38,13 +38,13 @@
     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 [
@@ -52,13 +52,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -69,12 +69,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.ast
index 7144736..764bafa 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_03.ast
@@ -15,12 +15,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -28,13 +28,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -42,13 +42,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -59,12 +59,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.ast
index 3de70de..7bdfb3c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_04.ast
@@ -24,12 +24,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -37,13 +37,13 @@
     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 [
@@ -51,13 +51,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -68,12 +68,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.ast
index ef4702f..f11b74c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/inverted-index-join/word-jaccard_inline_03.ast
@@ -15,17 +15,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -33,26 +33,26 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
     ]
@@ -60,19 +60,19 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
index c6215a7..bc0c4b4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -52,7 +52,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -60,7 +60,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -70,19 +70,19 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -95,13 +95,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -109,7 +109,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -119,7 +119,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
index 7714257..8715603 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -52,7 +52,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -60,7 +60,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -70,33 +70,33 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall test.spatial-intersect@2[
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=sender-location
             ]
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           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
@@ -109,13 +109,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -123,7 +123,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -133,7 +133,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.ast
index 8d9e77f..e5b4056 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_01.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,22 +44,22 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.ast
index 856ea02..e97c1e5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_02.ast
@@ -31,12 +31,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -44,22 +44,22 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.ast
index f58f90c..1119266 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_03.ast
@@ -18,12 +18,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -31,22 +31,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.ast
index 760c2a9..955bf16 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_04.ast
@@ -19,12 +19,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -32,22 +32,22 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.ast
index 760c2a9..955bf16 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/open-index-enforced/rtree-index-join/spatial-intersect-point_05.ast
@@ -19,12 +19,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -32,22 +32,22 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
index b0b5d55..427b83b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
@@ -27,7 +27,7 @@
   (
     LiteralExpr [STRING] [name]
     :
-    Variable [ Name=name ]
+    Variable [ Name=$name ]
   )
   (
     LiteralExpr [STRING] [age]
@@ -42,21 +42,27 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Groupby
-  Variable [ Name=name ]
+  Variable [ Name=$name ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=name
   ]
-  With
-  Variable [ Name=c ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$c ]
+   AS c
+  )
 
 Orderby
-  Variable [ Name=name ]
+  Variable [ Name=$name ]
   DESC
-  Variable [ Name=age ]
+  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [age]
+  ]
   ASC
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
index d163a64..2494cbc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
@@ -17,13 +17,24 @@
   (
     LiteralExpr [STRING] [cid]
     :
-    Variable [ Name=cid ]
+    Variable [ Name=$cid ]
   )
   (
     LiteralExpr [STRING] [ordpercust]
     :
     FunctionCall orders-aggreg.count@1[
-      Variable [ Name=o ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=o
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
   (
@@ -33,13 +44,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=total
         ]
         ]
-        FROM [          Variable [ Name=o ]
+        FROM [          Variable [ Name=$o ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -51,13 +62,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=total
         ]
         ]
-        FROM [          Variable [ Name=o ]
+        FROM [          Variable [ Name=$o ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -68,15 +79,19 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Groupby
-  Variable [ Name=cid ]
+  Variable [ Name=$cid ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=cid
   ]
-  With
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$o ]
+   AS o
+  )
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-composite-index-search.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-composite-index-search.ast
index 6794bab..a74c45c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-composite-index-search.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-composite-index-search.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -37,7 +37,7 @@
     LiteralExpr [STRING] [o_orderstatus]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderstatus
     ]
   )
@@ -47,13 +47,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -62,7 +62,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderstatus
       ]
       =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_01.ast
index 8741e35..1142ebc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_01.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,13 +39,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -54,7 +54,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_totalprice
       ]
       >
@@ -63,7 +63,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_02.ast
index b857754..06dd552 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive-open_02.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -37,7 +37,7 @@
     LiteralExpr [STRING] [o_totalprice]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_totalprice
     ]
   )
@@ -47,13 +47,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -62,7 +62,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_totalprice
       ]
       >
@@ -71,7 +71,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_01.ast
index 650e686..91cb4da 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_01.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,13 +39,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -54,7 +54,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_totalprice
       ]
       >
@@ -63,7 +63,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_02.ast
index 31640db..8eaa989 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_02.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -37,7 +37,7 @@
     LiteralExpr [STRING] [o_totalprice]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_totalprice
     ]
   )
@@ -47,13 +47,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -62,7 +62,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_totalprice
       ]
       >
@@ -71,7 +71,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-open.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-open.ast
index 4c57ec7..04a11b5 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-open.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-open.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,12 +39,12 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search.ast
index 19dbf0e..995cd6e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,12 +39,12 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search-open.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search-open.ast
index f1487ab..eca2c7d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search-open.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search-open.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,12 +39,12 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search.ast
index 24aae22..81fd86b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,12 +39,12 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
     =
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/pull_select_above_eq_join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/pull_select_above_eq_join.ast
index 8cc5d3c..ba71f97 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/pull_select_above_eq_join.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/pull_select_above_eq_join.ast
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [uid]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=uid
     ]
   )
@@ -35,7 +35,7 @@
     LiteralExpr [STRING] [vid]
     :
     FieldAccessor [
-      Variable [ Name=visitor ]
+      Variable [ Name=$visitor ]
       Field=vid
     ]
   )
@@ -45,36 +45,36 @@
     LiteralExpr [STRING] [Users]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Visitors]
   ]
   AS
-  Variable [ Name=visitor ]
+  Variable [ Name=$visitor ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=name
       ]
       =
       FieldAccessor [
-        Variable [ Name=visitor ]
+        Variable [ Name=$visitor ]
         Field=name
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=city
       ]
       !=
       FieldAccessor [
-        Variable [ Name=visitor ]
+        Variable [ Name=$visitor ]
         Field=city
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push-project-through-group.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push-project-through-group.ast
index 7c6bdae..e2ad00e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push-project-through-group.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push-project-through-group.ast
@@ -17,14 +17,14 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=id
     ]
   )
   (
     LiteralExpr [STRING] [matches]
     :
-    Variable [ Name=matches ]
+    Variable [ Name=$matches ]
   )
 ]
 ]
@@ -32,14 +32,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=matches ]
+Let Variable [ Name=$matches ]
   :=
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
     ]
@@ -47,17 +47,17 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=authors
         ]
         =
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=authors
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push_limit.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push_limit.ast
index 86b08c0..9d04a0c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push_limit.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push_limit.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [price]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_totalprice
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [date]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderdate
     ]
   )
@@ -39,12 +39,12 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_totalprice
     ]
     >
@@ -52,7 +52,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
index 49be1ab..1a4fc42 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
@@ -27,12 +27,12 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [sum_qty]
@@ -41,13 +41,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -59,13 +59,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -78,7 +78,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -86,15 +86,15 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -107,7 +107,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -115,7 +115,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -124,15 +124,15 @@
             LiteralExpr [LONG] [1]
             +
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_tax
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -144,13 +144,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -162,13 +162,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -180,13 +180,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -195,7 +195,18 @@
     LiteralExpr [STRING] [count_order]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=l ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -204,36 +215,40 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipdate
     ]
     <=
     LiteralExpr [STRING] [1998-09-02]
   ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
index 0861454..ed3f76e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
@@ -54,22 +54,22 @@
   (
     LiteralExpr [STRING] [l_orderkey]
     :
-    Variable [ Name=l_orderkey ]
+    Variable [ Name=$l_orderkey ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
   (
     LiteralExpr [STRING] [o_orderdate]
     :
-    Variable [ Name=o_orderdate ]
+    Variable [ Name=$o_orderdate ]
   )
   (
     LiteralExpr [STRING] [o_shippriority]
     :
-    Variable [ Name=o_shippriority ]
+    Variable [ Name=$o_shippriority ]
   )
 ]
 ]
@@ -77,26 +77,26 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItems]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_mktsegment
         ]
         =
@@ -105,12 +105,12 @@
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_custkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_custkey
         ]
       ]
@@ -119,19 +119,19 @@
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_orderkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderkey
         ]
       ]
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderdate
         ]
         <
@@ -140,7 +140,7 @@
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_shipdate
         ]
         >
@@ -149,37 +149,43 @@
     ]
   ]
 Groupby
-  Variable [ Name=l_orderkey ]
+  Variable [ Name=$l_orderkey ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_orderkey
   ]
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderdate
   ]
-  Variable [ Name=o_shippriority ]
+  Variable [ Name=$o_shippriority ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_shippriority
   ]
-  With
-  Variable [ Name=c ]
-  Variable [ Name=l ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  Variable [ Name=$o ]
+   AS o
+  Variable [ Name=$c ]
+   AS c
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall q3_shipping_priority.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -187,22 +193,22 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=l ]
+      FROM [        Variable [ Name=$l ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   ASC
 
 Limit
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
index 9e3437f..2b8e44b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
@@ -83,12 +83,12 @@
   (
     LiteralExpr [STRING] [n_name]
     :
-    Variable [ Name=n_name ]
+    Variable [ Name=$n_name ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
 ]
 ]
@@ -96,7 +96,7 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   (
     SELECT ELEMENT [
@@ -105,7 +105,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=n_name
         ]
       )
@@ -113,7 +113,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_extendedprice
         ]
       )
@@ -121,7 +121,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_discount
         ]
       )
@@ -129,7 +129,7 @@
         LiteralExpr [STRING] [s_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=s_nationkey
         ]
       )
@@ -137,7 +137,7 @@
         LiteralExpr [STRING] [o_custkey]
         :
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_custkey
         ]
       )
@@ -147,7 +147,7 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
 ,
       (
         SELECT ELEMENT [
@@ -156,7 +156,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=n_name
             ]
           )
@@ -164,7 +164,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_extendedprice
             ]
           )
@@ -172,7 +172,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_discount
             ]
           )
@@ -180,7 +180,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_orderkey
             ]
           )
@@ -188,7 +188,7 @@
             LiteralExpr [STRING] [s_nationkey]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=s_nationkey
             ]
           )
@@ -198,7 +198,7 @@
             LiteralExpr [STRING] [LineItems]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
 ,
           (
             SELECT ELEMENT [
@@ -207,7 +207,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=n1 ]
+                  Variable [ Name=$n1 ]
                   Field=n_name
                 ]
               )
@@ -215,7 +215,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -223,7 +223,7 @@
                 LiteralExpr [STRING] [s_nationkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
               )
@@ -233,7 +233,7 @@
                 LiteralExpr [STRING] [Suppliers]
               ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
 ,
               (
                 SELECT ELEMENT [
@@ -242,7 +242,7 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_name
                     ]
                   )
@@ -250,7 +250,7 @@
                     LiteralExpr [STRING] [n_nationkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_nationkey
                     ]
                   )
@@ -260,31 +260,31 @@
                     LiteralExpr [STRING] [Nations]
                   ]
                   AS
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
 ,
                   FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [Regions]
                   ]
                   AS
-                  Variable [ Name=r ]
+                  Variable [ Name=$r ]
                 ]
                 Where
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=n ]
+                        Variable [ Name=$n ]
                         Field=n_regionkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_regionkey
                       ]
                     ]
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_name
                       ]
                       =
@@ -293,57 +293,57 @@
                   ]
               )
               AS
-              Variable [ Name=n1 ]
+              Variable [ Name=$n1 ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=n1 ]
+                  Variable [ Name=$n1 ]
                   Field=n_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=s1 ]
+          Variable [ Name=$s1 ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=s_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=l1 ]
+      Variable [ Name=$l1 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l1 ]
+            Variable [ Name=$l1 ]
             Field=l_orderkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderdate
           ]
           >=
@@ -352,7 +352,7 @@
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderdate
           ]
           <
@@ -361,53 +361,58 @@
       ]
   )
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_nationkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=s_nationkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_custkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=o_custkey
       ]
     ]
   ]
 Groupby
-  Variable [ Name=n_name ]
+  Variable [ Name=$n_name ]
   :=
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=n_name
   ]
-  With
-  Variable [ Name=o1 ]
-  Variable [ Name=c ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$o1 ]
+   AS o1
+  Variable [ Name=$c ]
+   AS c
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall q5_local_supplier.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -415,19 +420,19 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=o1 ]
+      FROM [        Variable [ Name=$o1 ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q08_group_by.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q08_group_by.ast
index 0e9337f..0045b3e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q08_group_by.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q08_group_by.ast
@@ -97,7 +97,7 @@
     LiteralExpr [STRING] [o_orderdate]
     :
     FieldAccessor [
-      Variable [ Name=lnrcop ]
+      Variable [ Name=$lnrcop ]
       Field=o_orderdate
     ]
   )
@@ -105,7 +105,7 @@
     LiteralExpr [STRING] [l_discount]
     :
     FieldAccessor [
-      Variable [ Name=lnrcop ]
+      Variable [ Name=$lnrcop ]
       Field=l_discount
     ]
   )
@@ -113,7 +113,7 @@
     LiteralExpr [STRING] [l_extendedprice]
     :
     FieldAccessor [
-      Variable [ Name=lnrcop ]
+      Variable [ Name=$lnrcop ]
       Field=l_extendedprice
     ]
   )
@@ -121,7 +121,7 @@
     LiteralExpr [STRING] [l_suppkey]
     :
     FieldAccessor [
-      Variable [ Name=lnrcop ]
+      Variable [ Name=$lnrcop ]
       Field=l_suppkey
     ]
   )
@@ -129,7 +129,7 @@
     LiteralExpr [STRING] [s_nationkey]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_nationkey
     ]
   )
@@ -139,7 +139,7 @@
     LiteralExpr [STRING] [Supplier]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
 ,
   (
     SELECT ELEMENT [
@@ -148,7 +148,7 @@
         LiteralExpr [STRING] [o_orderdate]
         :
         FieldAccessor [
-          Variable [ Name=lnrco ]
+          Variable [ Name=$lnrco ]
           Field=o_orderdate
         ]
       )
@@ -156,7 +156,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=lnrco ]
+          Variable [ Name=$lnrco ]
           Field=l_discount
         ]
       )
@@ -164,7 +164,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=lnrco ]
+          Variable [ Name=$lnrco ]
           Field=l_extendedprice
         ]
       )
@@ -172,7 +172,7 @@
         LiteralExpr [STRING] [l_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=lnrco ]
+          Variable [ Name=$lnrco ]
           Field=l_suppkey
         ]
       )
@@ -185,7 +185,7 @@
             LiteralExpr [STRING] [o_orderdate]
             :
             FieldAccessor [
-              Variable [ Name=nrco ]
+              Variable [ Name=$nrco ]
               Field=o_orderdate
             ]
           )
@@ -193,7 +193,7 @@
             LiteralExpr [STRING] [l_partkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_partkey
             ]
           )
@@ -201,7 +201,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_discount
             ]
           )
@@ -209,7 +209,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_extendedprice
             ]
           )
@@ -217,7 +217,7 @@
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
           )
@@ -227,7 +227,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
 ,
           (
             SELECT ELEMENT [
@@ -236,7 +236,7 @@
                 LiteralExpr [STRING] [o_orderdate]
                 :
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
               )
@@ -244,7 +244,7 @@
                 LiteralExpr [STRING] [o_orderkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderkey
                 ]
               )
@@ -254,7 +254,7 @@
                 LiteralExpr [STRING] [Orders]
               ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
 ,
               (
                 SELECT ELEMENT [
@@ -263,7 +263,7 @@
                     LiteralExpr [STRING] [c_custkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=c ]
+                      Variable [ Name=$c ]
                       Field=c_custkey
                     ]
                   )
@@ -273,7 +273,7 @@
                     LiteralExpr [STRING] [Customer]
                   ]
                   AS
-                  Variable [ Name=c ]
+                  Variable [ Name=$c ]
 ,
                   (
                     SELECT ELEMENT [
@@ -282,7 +282,7 @@
                         LiteralExpr [STRING] [n_nationkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=n1 ]
+                          Variable [ Name=$n1 ]
                           Field=n_nationkey
                         ]
                       )
@@ -292,31 +292,31 @@
                         LiteralExpr [STRING] [Nation]
                       ]
                       AS
-                      Variable [ Name=n1 ]
+                      Variable [ Name=$n1 ]
 ,
                       FunctionCall Metadata.dataset@1[
                         LiteralExpr [STRING] [Region]
                       ]
                       AS
-                      Variable [ Name=r1 ]
+                      Variable [ Name=$r1 ]
                     ]
                     Where
                       OperatorExpr [
                         OperatorExpr [
                           FieldAccessor [
-                            Variable [ Name=n1 ]
+                            Variable [ Name=$n1 ]
                             Field=n_regionkey
                           ]
                           =
                           FieldAccessor [
-                            Variable [ Name=r1 ]
+                            Variable [ Name=$r1 ]
                             Field=r_regionkey
                           ]
                         ]
                         and
                         OperatorExpr [
                           FieldAccessor [
-                            Variable [ Name=r1 ]
+                            Variable [ Name=$r1 ]
                             Field=r_name
                           ]
                           =
@@ -325,57 +325,57 @@
                       ]
                   )
                   AS
-                  Variable [ Name=nr ]
+                  Variable [ Name=$nr ]
                 ]
                 Where
                   OperatorExpr [
                     FieldAccessor [
-                      Variable [ Name=c ]
+                      Variable [ Name=$c ]
                       Field=c_nationkey
                     ]
                     =
                     FieldAccessor [
-                      Variable [ Name=nr ]
+                      Variable [ Name=$nr ]
                       Field=n_nationkey
                     ]
                   ]
               )
               AS
-              Variable [ Name=nrc ]
+              Variable [ Name=$nrc ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=nrc ]
+                  Variable [ Name=$nrc ]
                   Field=c_custkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_custkey
                 ]
               ]
           )
           AS
-          Variable [ Name=nrco ]
+          Variable [ Name=$nrco ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_orderkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=nrco ]
+                Variable [ Name=$nrco ]
                 Field=o_orderkey
               ]
             ]
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=nrco ]
+                Variable [ Name=$nrco ]
                 Field=o_orderdate
               ]
               >=
@@ -384,7 +384,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=nrco ]
+                Variable [ Name=$nrco ]
                 Field=o_orderdate
               ]
               <=
@@ -393,31 +393,31 @@
           ]
       )
       AS
-      Variable [ Name=lnrco ]
+      Variable [ Name=$lnrco ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Part]
       ]
       AS
-      Variable [ Name=p ]
+      Variable [ Name=$p ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=lnrco ]
+            Variable [ Name=$lnrco ]
             Field=l_partkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_type
           ]
           =
@@ -426,17 +426,17 @@
       ]
   )
   AS
-  Variable [ Name=lnrcop ]
+  Variable [ Name=$lnrcop ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_suppkey
     ]
     =
     FieldAccessor [
-      Variable [ Name=lnrcop ]
+      Variable [ Name=$lnrcop ]
       Field=l_suppkey
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q09_group_by.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q09_group_by.ast
index 8f0e8b8..7e19e44 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q09_group_by.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q09_group_by.ast
@@ -107,7 +107,7 @@
     LiteralExpr [STRING] [l_extendedprice]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=l_extendedprice
     ]
   )
@@ -115,7 +115,7 @@
     LiteralExpr [STRING] [l_discount]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=l_discount
     ]
   )
@@ -123,7 +123,7 @@
     LiteralExpr [STRING] [l_quantity]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=l_quantity
     ]
   )
@@ -131,7 +131,7 @@
     LiteralExpr [STRING] [l_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=l_orderkey
     ]
   )
@@ -139,7 +139,7 @@
     LiteralExpr [STRING] [n_name]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=n_name
     ]
   )
@@ -147,7 +147,7 @@
     LiteralExpr [STRING] [ps_supplycost]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=ps_supplycost
     ]
   )
@@ -157,7 +157,7 @@
     LiteralExpr [STRING] [Part]
   ]
   AS
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ,
   (
     SELECT ELEMENT [
@@ -166,7 +166,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_extendedprice
         ]
       )
@@ -174,7 +174,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_discount
         ]
       )
@@ -182,7 +182,7 @@
         LiteralExpr [STRING] [l_quantity]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_quantity
         ]
       )
@@ -190,7 +190,7 @@
         LiteralExpr [STRING] [l_partkey]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_partkey
         ]
       )
@@ -198,7 +198,7 @@
         LiteralExpr [STRING] [l_orderkey]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_orderkey
         ]
       )
@@ -206,7 +206,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=n_name
         ]
       )
@@ -214,7 +214,7 @@
         LiteralExpr [STRING] [ps_supplycost]
         :
         FieldAccessor [
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
           Field=ps_supplycost
         ]
       )
@@ -224,7 +224,7 @@
         LiteralExpr [STRING] [Partsupp]
       ]
       AS
-      Variable [ Name=ps ]
+      Variable [ Name=$ps ]
 ,
       (
         SELECT ELEMENT [
@@ -233,7 +233,7 @@
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
           )
@@ -241,7 +241,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_extendedprice
             ]
           )
@@ -249,7 +249,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_discount
             ]
           )
@@ -257,7 +257,7 @@
             LiteralExpr [STRING] [l_quantity]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_quantity
             ]
           )
@@ -265,7 +265,7 @@
             LiteralExpr [STRING] [l_partkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_partkey
             ]
           )
@@ -273,7 +273,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_orderkey
             ]
           )
@@ -281,7 +281,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=n_name
             ]
           )
@@ -294,7 +294,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -302,7 +302,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
                   Field=n_name
                 ]
               )
@@ -312,87 +312,87 @@
                 LiteralExpr [STRING] [Supplier]
               ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
 ,
               FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Nation]
               ]
               AS
-              Variable [ Name=n ]
+              Variable [ Name=$n ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
                   Field=n_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=s1 ]
+          Variable [ Name=$s1 ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=s_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=l1 ]
+      Variable [ Name=$l1 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_suppkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=l1 ]
+            Variable [ Name=$l1 ]
             Field=l_suppkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=l1 ]
+            Variable [ Name=$l1 ]
             Field=l_partkey
           ]
         ]
       ]
   )
   AS
-  Variable [ Name=l2 ]
+  Variable [ Name=$l2 ]
 ]
 Where
   OperatorExpr [
     FunctionCall q09_group_by.contains@2[
       FieldAccessor [
-        Variable [ Name=p ]
+        Variable [ Name=$p ]
         Field=p_name
       ]
       LiteralExpr [STRING] [green]
@@ -400,12 +400,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=p ]
+        Variable [ Name=$p ]
         Field=p_partkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=l2 ]
+        Variable [ Name=$l2 ]
         Field=l_partkey
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q1.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q1.ast
index be44464..9a32c3d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q1.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q1.ast
@@ -32,7 +32,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -42,20 +42,20 @@
     LiteralExpr [STRING] [User]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=i ]
+    [Variable [ Name=$i ]
     In
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         =
         LiteralExpr [STRING] [movies]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
index 118f8d8..6f4cf7a 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
@@ -37,17 +37,17 @@
   (
     LiteralExpr [STRING] [sig_name]
     :
-    Variable [ Name=sig_name ]
+    Variable [ Name=$sig_name ]
   )
   (
     LiteralExpr [STRING] [total_count]
     :
-    Variable [ Name=sig_sponsorship_count ]
+    Variable [ Name=$sig_sponsorship_count ]
   )
   (
     LiteralExpr [STRING] [chapter_breakdown]
     :
-    Variable [ Name=by_chapter ]
+    Variable [ Name=$by_chapter ]
   )
 ]
 ]
@@ -55,47 +55,64 @@
     LiteralExpr [STRING] [Event]
   ]
   AS
-  Variable [ Name=event ]
+  Variable [ Name=$event ]
 ,
   FieldAccessor [
-    Variable [ Name=event ]
+    Variable [ Name=$event ]
     Field=sponsoring_sigs
   ]
   AS
-  Variable [ Name=sponsor ]
+  Variable [ Name=$sponsor ]
 ]
-LetVariable [ Name=es ]
+Let Variable [ Name=$es ]
   :=
   RecordConstructor [
     (
       LiteralExpr [STRING] [event]
       :
-      Variable [ Name=event ]
+      Variable [ Name=$event ]
     )
     (
       LiteralExpr [STRING] [sponsor]
       :
-      Variable [ Name=sponsor ]
+      Variable [ Name=$sponsor ]
     )
   ]
 Groupby
-  Variable [ Name=sig_name ]
+  Variable [ Name=$sig_name ]
   :=
   FieldAccessor [
-    Variable [ Name=sponsor ]
+    Variable [ Name=$sponsor ]
     Field=sig_name
   ]
-  With
-  Variable [ Name=es ]
-  Variable [ Name=sponsor ]
-  Variable [ Name=event ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$es ]
+   AS es
+  Variable [ Name=$sponsor ]
+   AS sponsor
+  Variable [ Name=$event ]
+   AS event
+  )
 
-LetVariable [ Name=sig_sponsorship_count ]
+Let Variable [ Name=$sig_sponsorship_count ]
   :=
   FunctionCall events.count@1[
-    Variable [ Name=es ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=es
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
-LetVariable [ Name=by_chapter ]
+Let Variable [ Name=$by_chapter ]
   :=
   (
     SELECT ELEMENT [
@@ -103,42 +120,64 @@
       (
         LiteralExpr [STRING] [chapter_name]
         :
-        Variable [ Name=chapter_name ]
+        Variable [ Name=$chapter_name ]
       )
       (
         LiteralExpr [STRING] [escount]
         :
         FunctionCall events.count@1[
-          Variable [ Name=e ]
+          (
+            SELECT ELEMENT [
+            FieldAccessor [
+              Variable [ Name=#4 ]
+              Field=e
+            ]
+            ]
+            FROM [              Variable [ Name=#3 ]
+              AS
+              Variable [ Name=#4 ]
+            ]
+          )
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=es ]
+    FROM [      Variable [ Name=$es ]
       AS
-      Variable [ Name=e ]
+      Variable [ Name=$e ]
     ]
     Groupby
-      Variable [ Name=chapter_name ]
+      Variable [ Name=$chapter_name ]
       :=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=e ]
+          Variable [ Name=$e ]
           Field=sponsor
         ]
         Field=chapter_name
       ]
-      With
-      Variable [ Name=e ]
-      Variable [ Name=sig_sponsorship_count ]
-      Variable [ Name=sponsor ]
-      Variable [ Name=event ]
-      Variable [ Name=es ]
-      Variable [ Name=sig_name ]
+      GROUP AS
+      Variable [ Name=#3 ]
+      (
+      Variable [ Name=$e ]
+       AS e
+      Variable [ Name=$sig_sponsorship_count ]
+       AS sig_sponsorship_count
+      Variable [ Name=$es ]
+       AS es
+      Variable [ Name=$event ]
+       AS event
+      Variable [ Name=$sponsor ]
+       AS sponsor
+      Variable [ Name=$sig_name ]
+       AS sig_name
+      Variable [ Name=#1 ]
+       AS #1
+      )
 
   )
 Orderby
-  Variable [ Name=sig_sponsorship_count ]
+  Variable [ Name=$sig_sponsorship_count ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
index 416cf4e..7cf52e9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
@@ -1,5 +1,5 @@
 Query:
-LetVariable [ Name=sample ]
+Let Variable [ Name=$sample ]
   :=
   UnorderedListConstructor [
     RecordConstructor [
@@ -152,35 +152,40 @@
   (
     LiteralExpr [STRING] [u]
     :
-    Variable [ Name=u ]
+    Variable [ Name=$u ]
   )
   (
     LiteralExpr [STRING] [recs]
     :
     (
       SELECT ELEMENT [
-      Variable [ Name=srec ]
+      Variable [ Name=$srec ]
       ]
-      FROM [        Variable [ Name=s ]
+      FROM [        Variable [ Name=$s ]
         AS
-        Variable [ Name=srec ]
+        Variable [ Name=$srec ]
       ]
     )
   )
 ]
 ]
-FROM [  Variable [ Name=sample ]
+FROM [  Variable [ Name=$sample ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
 ]
 Groupby
-  Variable [ Name=u ]
+  Variable [ Name=$u ]
   :=
   FieldAccessor [
-    Variable [ Name=s ]
+    Variable [ Name=$s ]
     Field=uid
   ]
-  With
-  Variable [ Name=s ]
-  Variable [ Name=sample ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$s ]
+   AS s
+  Variable [ Name=$sample ]
+   AS sample
+  )
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
index 7f8f2d3..65d7c96 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
@@ -54,7 +54,7 @@
         LiteralExpr [STRING] [c_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_acctbal
         ]
       )
@@ -62,26 +62,26 @@
         LiteralExpr [STRING] [c_custkey]
         :
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_custkey
         ]
       )
       (
         LiteralExpr [STRING] [cntrycode]
         :
-        Variable [ Name=phone_substr ]
+        Variable [ Name=$phone_substr ]
       )
     ]
     ]
-    FROM [      Variable [ Name=Customer ]
+    FROM [      Variable [ Name=$Customer ]
       AS
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
     ]
-    LetVariable [ Name=phone_substr ]
+    Let Variable [ Name=$phone_substr ]
       :=
       FunctionCall tpch.substring@3[
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_phone
         ]
         LiteralExpr [LONG] [1]
@@ -90,43 +90,43 @@
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [13]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [31]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [23]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [29]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [30]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [18]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [17]
         ]
@@ -135,13 +135,13 @@
 }
 
 Query:
-LetVariable [ Name=avg ]
+Let Variable [ Name=$avg ]
   :=
   FunctionCall tpch.avg@1[
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_acctbal
       ]
       ]
@@ -149,13 +149,13 @@
           LiteralExpr [STRING] [Customer]
         ]
         AS
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
       ]
-      LetVariable [ Name=phone_substr ]
+      Let Variable [ Name=$phone_substr ]
         :=
         FunctionCall tpch.substring@3[
           FieldAccessor [
-            Variable [ Name=c ]
+            Variable [ Name=$c ]
             Field=c_phone
           ]
           LiteralExpr [LONG] [1]
@@ -165,7 +165,7 @@
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_acctbal
             ]
             >
@@ -174,43 +174,43 @@
           and
           OperatorExpr [
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [13]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [31]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [23]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [29]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [30]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [18]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [17]
             ]
@@ -223,13 +223,24 @@
   (
     LiteralExpr [STRING] [cntrycode]
     :
-    Variable [ Name=cntrycode ]
+    Variable [ Name=$cntrycode ]
   )
   (
     LiteralExpr [STRING] [numcust]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=ct ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=ct
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
   (
@@ -239,13 +250,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=c_acctbal
         ]
         ]
-        FROM [          Variable [ Name=ct ]
+        FROM [          Variable [ Name=$ct ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -255,30 +266,30 @@
 FROM [  FunctionCall tpch.q22_customer_tmp@0[
   ]
   AS
-  Variable [ Name=ct ]
+  Variable [ Name=$ct ]
 ]
 Where
   OperatorExpr [
     FunctionCall tpch.count@1[
       (
         SELECT ELEMENT [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Orders]
           ]
           AS
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=ct ]
+              Variable [ Name=$ct ]
               Field=c_custkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_custkey
             ]
           ]
@@ -288,17 +299,22 @@
     LiteralExpr [LONG] [0]
   ]
 Groupby
-  Variable [ Name=cntrycode ]
+  Variable [ Name=$cntrycode ]
   :=
   FieldAccessor [
-    Variable [ Name=ct ]
+    Variable [ Name=$ct ]
     Field=cntrycode
   ]
-  With
-  Variable [ Name=ct ]
-  Variable [ Name=avg ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$ct ]
+   AS ct
+  Variable [ Name=$avg ]
+   AS avg
+  )
 
 Orderby
-  Variable [ Name=cntrycode ]
+  Variable [ Name=$cntrycode ]
   ASC
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
index fef8a60..92954c3 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
@@ -26,13 +26,24 @@
   (
     LiteralExpr [STRING] [l_linenumber]
     :
-    Variable [ Name=l_linenumber ]
+    Variable [ Name=$l_linenumber ]
   )
   (
     LiteralExpr [STRING] [count_order]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=l ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -41,15 +52,19 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Groupby
-  Variable [ Name=l_linenumber ]
+  Variable [ Name=$l_linenumber ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linenumber
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
index 1409681..6d9ed62 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
@@ -12,7 +12,7 @@
   (
     LiteralExpr [STRING] [gid]
     :
-    Variable [ Name=aid ]
+    Variable [ Name=$aid ]
   )
   (
     LiteralExpr [STRING] [avg]
@@ -21,19 +21,19 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
           Field=value
         ]
         ]
-        FROM [          Variable [ Name=i ]
+        FROM [          Variable [ Name=$i ]
           AS
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
         ]
         Where
           FunctionCall test.not@1[
             FunctionCall test.is-null@1[
               FieldAccessor [
-                Variable [ Name=j ]
+                Variable [ Name=$j ]
                 Field=value
               ]
             ]
@@ -47,15 +47,19 @@
     LiteralExpr [STRING] [test]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Groupby
-  Variable [ Name=aid ]
+  Variable [ Name=$aid ]
   :=
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=key1
   ]
-  With
-  Variable [ Name=i ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$i ]
+   AS i
+  )
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
index d8a415a..b639cfa 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
@@ -57,7 +57,7 @@
 DatasetDecl Customer(CustomerType) partitioned by [[c_custkey]]
 DatasetDecl SelectedNation(NationType) partitioned by [[n_nationkey]]
 Query:
-LetVariable [ Name=t ]
+Let Variable [ Name=$t ]
   :=
   (
     SELECT ELEMENT [
@@ -66,7 +66,7 @@
         LiteralExpr [STRING] [n_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_nationkey
         ]
       )
@@ -74,7 +74,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_name
         ]
       )
@@ -84,28 +84,28 @@
         LiteralExpr [STRING] [Nation]
       ]
       AS
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [SelectedNation]
       ]
       AS
-      Variable [ Name=sn ]
+      Variable [ Name=$sn ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_nationkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=sn ]
+          Variable [ Name=$sn ]
           Field=n_nationkey
         ]
       ]
   )
-LetVariable [ Name=X ]
+Let Variable [ Name=$X ]
   :=
   (
     SELECT ELEMENT [
@@ -113,94 +113,101 @@
       (
         LiteralExpr [STRING] [nation_key]
         :
-        Variable [ Name=nation_key ]
+        Variable [ Name=$nation_key ]
       )
       (
         LiteralExpr [STRING] [order_date]
         :
-        Variable [ Name=orderdate ]
+        Variable [ Name=$orderdate ]
       )
       (
         LiteralExpr [STRING] [sum_price]
         :
-        Variable [ Name=sum ]
+        Variable [ Name=$sum ]
       )
     ]
     ]
-    FROM [      Variable [ Name=t ]
+    FROM [      Variable [ Name=$t ]
       AS
-      Variable [ Name=n ]
+      Variable [ Name=$n ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Customer]
       ]
       AS
-      Variable [ Name=customer ]
+      Variable [ Name=$customer ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=orders ]
+      Variable [ Name=$orders ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=orders ]
+            Variable [ Name=$orders ]
             Field=o_custkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_custkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_nationkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
             Field=n_nationkey
           ]
         ]
       ]
     Groupby
-      Variable [ Name=orderdate ]
+      Variable [ Name=$orderdate ]
       :=
       FieldAccessor [
-        Variable [ Name=orders ]
+        Variable [ Name=$orders ]
         Field=o_orderdate
       ]
-      Variable [ Name=nation_key ]
+      Variable [ Name=$nation_key ]
       :=
       FieldAccessor [
-        Variable [ Name=n ]
+        Variable [ Name=$n ]
         Field=n_nationkey
       ]
-      With
-      Variable [ Name=orders ]
-      Variable [ Name=n ]
-      Variable [ Name=customer ]
-      Variable [ Name=t ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$orders ]
+       AS orders
+      Variable [ Name=$customer ]
+       AS customer
+      Variable [ Name=$n ]
+       AS n
+      Variable [ Name=$t ]
+       AS t
+      )
 
-    LetVariable [ Name=sum ]
+    Let Variable [ Name=$sum ]
       :=
       FunctionCall tpch.sum@1[
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_totalprice
           ]
           ]
-          FROM [            Variable [ Name=orders ]
+          FROM [            Variable [ Name=$orders ]
             AS
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
           ]
         )
       ]
@@ -210,7 +217,7 @@
   (
     LiteralExpr [STRING] [nation_key]
     :
-    Variable [ Name=nation_key ]
+    Variable [ Name=$nation_key ]
   )
   (
     LiteralExpr [STRING] [sum_price]
@@ -222,7 +229,7 @@
           LiteralExpr [STRING] [orderdate]
           :
           FieldAccessor [
-            Variable [ Name=y ]
+            Variable [ Name=$y ]
             Field=order_date
           ]
         )
@@ -230,19 +237,19 @@
           LiteralExpr [STRING] [sum_price]
           :
           FieldAccessor [
-            Variable [ Name=y ]
+            Variable [ Name=$y ]
             Field=sum_price
           ]
         )
       ]
       ]
-      FROM [        Variable [ Name=x ]
+      FROM [        Variable [ Name=$x ]
         AS
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
       ]
       Orderby
         FieldAccessor [
-          Variable [ Name=y ]
+          Variable [ Name=$y ]
           Field=sum_price
         ]
         DESC
@@ -253,19 +260,25 @@
   )
 ]
 ]
-FROM [  Variable [ Name=X ]
+FROM [  Variable [ Name=$X ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Groupby
-  Variable [ Name=nation_key ]
+  Variable [ Name=$nation_key ]
   :=
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=nation_key
   ]
-  With
-  Variable [ Name=x ]
-  Variable [ Name=X ]
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$x ]
+   AS x
+  Variable [ Name=$X ]
+   AS X
+  Variable [ Name=$t ]
+   AS t
+  )
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
index 1726c87..743546b 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
@@ -26,39 +26,39 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [count_cheaps]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=cheaps ]
+      Variable [ Name=$cheaps ]
     ]
   )
   (
     LiteralExpr [STRING] [avg_expensive_discounts]
     :
     FunctionCall tpch.avg@1[
-      Variable [ Name=expensives ]
+      Variable [ Name=$expensives ]
     ]
   )
   (
     LiteralExpr [STRING] [sum_disc_prices]
     :
     FunctionCall tpch.sum@1[
-      Variable [ Name=disc_prices ]
+      Variable [ Name=$disc_prices ]
     ]
   )
   (
     LiteralExpr [STRING] [total_charges]
     :
     FunctionCall tpch.sum@1[
-      Variable [ Name=charges ]
+      Variable [ Name=$charges ]
     ]
   )
 ]
@@ -67,83 +67,87 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipdate
     ]
     <=
     LiteralExpr [STRING] [1998-09-02]
   ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
-LetVariable [ Name=expensives ]
+Let Variable [ Name=$expensives ]
   :=
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=l_discount
     ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         <=
         LiteralExpr [DOUBLE] [0.05]
       ]
   )
-LetVariable [ Name=cheaps ]
+Let Variable [ Name=$cheaps ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         >
         LiteralExpr [DOUBLE] [0.05]
       ]
   )
-LetVariable [ Name=charges ]
+Let Variable [ Name=$charges ]
   :=
   (
     SELECT ELEMENT [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=l_extendedprice
       ]
       *
@@ -151,7 +155,7 @@
         LiteralExpr [LONG] [1]
         -
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
       ]
@@ -160,24 +164,24 @@
         LiteralExpr [LONG] [1]
         +
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_tax
         ]
       ]
     ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
   )
-LetVariable [ Name=disc_prices ]
+Let Variable [ Name=$disc_prices ]
   :=
   (
     SELECT ELEMENT [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=l_extendedprice
       ]
       *
@@ -185,20 +189,20 @@
         LiteralExpr [LONG] [1]
         -
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
       ]
     ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
   )
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
index 3be4f1c..c6e9030 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
@@ -26,25 +26,25 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [count_cheaps]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=cheap ]
+      Variable [ Name=$cheap ]
     ]
   )
   (
     LiteralExpr [STRING] [count_expensives]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=expensive ]
+      Variable [ Name=$expensive ]
     ]
   )
 ]
@@ -53,67 +53,71 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipdate
     ]
     <=
     LiteralExpr [STRING] [1998-09-02]
   ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
-LetVariable [ Name=cheap ]
+Let Variable [ Name=$cheap ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=m ]
+          Variable [ Name=$m ]
           Field=l_discount
         ]
         >
         LiteralExpr [DOUBLE] [0.05]
       ]
   )
-LetVariable [ Name=expensive ]
+Let Variable [ Name=$expensive ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=l_discount
         ]
         <=
@@ -121,8 +125,8 @@
       ]
   )
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
index 56a8784..6263b32 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
@@ -29,7 +29,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
@@ -37,12 +37,12 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_shipdate
             ]
             <=
@@ -58,7 +58,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
@@ -66,7 +66,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -79,7 +79,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -87,7 +87,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -97,7 +97,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -110,7 +110,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -118,7 +118,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -127,7 +127,7 @@
             LiteralExpr [LONG] [1]
             +
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_tax
             ]
           ]
@@ -137,7 +137,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -149,7 +149,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
@@ -157,12 +157,12 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_shipdate
             ]
             <=
@@ -178,7 +178,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
@@ -186,7 +186,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -198,7 +198,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         ]
@@ -206,7 +206,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -217,13 +217,13 @@
     FunctionCall tpch.count@1[
       (
         SELECT ELEMENT [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast
index 7a7b3f2..68be626 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast
@@ -11,12 +11,12 @@
   (
     LiteralExpr [STRING] [x]
     :
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
   )
   (
     LiteralExpr [STRING] [y]
     :
-    Variable [ Name=y ]
+    Variable [ Name=$y ]
   )
 ]
 ]
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [s]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=z ]
+      Variable [ Name=$z ]
       Field=c
     ]
     ]
@@ -72,21 +72,21 @@
         ]
       ]
       AS
-      Variable [ Name=z ]
+      Variable [ Name=$z ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=b
         ]
         =
         FieldAccessor [
-          Variable [ Name=z ]
+          Variable [ Name=$z ]
           Field=a
         ]
       ]
   )
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast
index 98b006e..3ee03e6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast
@@ -11,12 +11,12 @@
   (
     LiteralExpr [STRING] [x]
     :
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
   )
   (
     LiteralExpr [STRING] [y]
     :
-    Variable [ Name=y ]
+    Variable [ Name=$y ]
   )
 ]
 ]
@@ -37,12 +37,12 @@
     ]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=z ]
+      Variable [ Name=$z ]
       Field=b
     ]
     ]
@@ -50,21 +50,21 @@
         LiteralExpr [STRING] [s]
       ]
       AS
-      Variable [ Name=z ]
+      Variable [ Name=$z ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=a
         ]
         =
         FieldAccessor [
-          Variable [ Name=z ]
+          Variable [ Name=$z ]
           Field=b
         ]
       ]
   )
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast
index 576eeb7..94772a1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast
@@ -12,17 +12,17 @@
 DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=friends_count
   ]
   DESC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast
index ec49be3..a49fe29 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast
@@ -12,17 +12,17 @@
 DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=friends_count
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast
index aefabe9..4f20128 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast
@@ -12,17 +12,17 @@
 DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=screen-name
   ]
   DESC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast
index 28b636d..bc35555 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast
@@ -12,17 +12,17 @@
 DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=screen-name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast
index d82296c..d7f7412 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -39,7 +39,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=tweetid
       ]
       ]
@@ -47,15 +47,15 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender_location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
     )
   )
@@ -65,13 +65,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender_location
     ]
     LiteralExpr [DOUBLE] [5.0]
@@ -80,7 +80,7 @@
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=send_time
       ]
       >=
@@ -91,7 +91,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=send_time
       ]
       <
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
index 21be39a..2b3ca1c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
@@ -31,7 +31,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -39,7 +39,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -53,7 +53,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -61,7 +61,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -71,19 +71,19 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -96,13 +96,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -110,7 +110,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -120,7 +120,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
index 3b039ef..0a2af0c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
@@ -31,7 +31,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -39,7 +39,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -53,7 +53,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -61,7 +61,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -71,33 +71,33 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall test.spatial-intersect@2[
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=sender-location
             ]
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           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
@@ -110,13 +110,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -124,7 +124,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -134,7 +134,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
index a3aa3df..c1b795d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [subscription-id]
     :
     FieldAccessor [
-      Variable [ Name=sub ]
+      Variable [ Name=$sub ]
       Field=subscription-id
     ]
   )
@@ -40,7 +40,7 @@
   (
     LiteralExpr [STRING] [message-text]
     :
-    Variable [ Name=text ]
+    Variable [ Name=$text ]
   )
 ]
 ]
@@ -48,19 +48,19 @@
     LiteralExpr [STRING] [TweetHistorySubscriptions]
   ]
   AS
-  Variable [ Name=sub ]
+  Variable [ Name=$sub ]
 ,
   (
     SELECT ELEMENT [
-    Variable [ Name=tweet ]
+    Variable [ Name=$tweet ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [TweetMessages]
       ]
       AS
-      Variable [ Name=tweet ]
+      Variable [ Name=$tweet ]
     ]
-    LetVariable [ Name=circle ]
+    Let Variable [ Name=$circle ]
       :=
       FunctionCall twitter.create-circle@2[
         FunctionCall Metadata.dataset@1[
@@ -71,18 +71,18 @@
     Where
       FunctionCall twitter.spatial-intersect@2[
         FieldAccessor [
-          Variable [ Name=tweet ]
+          Variable [ Name=$tweet ]
           Field=sender-location
         ]
-        Variable [ Name=circle ]
+        Variable [ Name=$circle ]
       ]
   )
   AS
-  Variable [ Name=text ]
+  Variable [ Name=$text ]
 ]
-LetVariable [ Name=location ]
+Let Variable [ Name=$location ]
   :=
   FieldAccessor [
-    Variable [ Name=sub ]
+    Variable [ Name=$sub ]
     Field=location
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast
index a8e2ae2..5b3f0ed 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast
@@ -20,12 +20,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -33,22 +33,22 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast
index 0aa0b07..65dcb89 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast
@@ -20,12 +20,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -33,22 +33,22 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast
index becb74f..a23d20d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast
@@ -19,12 +19,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -32,22 +32,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast
index 1bd9875..d448f79 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -31,12 +31,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast
index 976f9b2..be9f7ba 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -31,12 +31,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast
index b712741..5d98fcf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast
@@ -12,26 +12,26 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=ed ]
+Variable [ Name=$ed ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Michael J. Carey]
   ]
 Where
   OperatorExpr [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     <=
     LiteralExpr [LONG] [2]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast
index 8cc5d87..8cb00e4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=ed ]
+Variable [ Name=$ed ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Michael J. Carey]
@@ -33,5 +33,5 @@
   OperatorExpr [
     LiteralExpr [LONG] [2]
     >=
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast
index 0afd566..be27388 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast
@@ -12,26 +12,26 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_03.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=ed ]
+Variable [ Name=$ed ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Michael J. Carey]
   ]
 Where
   OperatorExpr [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     <
     LiteralExpr [LONG] [3]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast
index 360a3ad..82c6a12 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_04.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=ed ]
+Variable [ Name=$ed ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Michael J. Carey]
@@ -33,5 +33,5 @@
   OperatorExpr [
     LiteralExpr [LONG] [3]
     >
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast
index a00c490..a1a6dc6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast
@@ -12,26 +12,26 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_05.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=ed ]
+Variable [ Name=$ed ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Michael J. Carey]
   ]
 Where
   OperatorExpr [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     >=
     LiteralExpr [LONG] [2]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast
index d09f4da..1b44ad2 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_06.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=ed ]
+Variable [ Name=$ed ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Michael J. Carey]
@@ -33,5 +33,5 @@
   OperatorExpr [
     LiteralExpr [LONG] [2]
     <=
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast
index a01a0d7..5479ba4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast
@@ -12,26 +12,26 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_07.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=ed ]
+Variable [ Name=$ed ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Michael J. Carey]
   ]
 Where
   OperatorExpr [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     >
     LiteralExpr [LONG] [2]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast
index 39923d0..06ff6a1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_08.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=ed ]
+Variable [ Name=$ed ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Michael J. Carey]
@@ -33,5 +33,5 @@
   OperatorExpr [
     LiteralExpr [LONG] [2]
     <
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast
index 920d504..b0d66b8 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-to-edit-distance-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Michael J. Carey]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast
index 5de5e0c..bc55325 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast
@@ -12,13 +12,13 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-to-edit-distance-check_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
@@ -26,7 +26,7 @@
     >=
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Michael J. Carey]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast
index d224018..dbcb285 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-to-edit-distance-check_03.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Michael J. Carey]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast
index 730fbc8..dcaaab9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast
@@ -12,13 +12,13 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-to-edit-distance-check_04.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
@@ -26,7 +26,7 @@
     >
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Michael J. Carey]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast
index 77c7c3a..ab8a7ac 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-to-edit-distance-check_05.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Michael J. Carey]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast
index 1dcbc43..2ec5fca 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast
@@ -12,13 +12,13 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-to-edit-distance-check_06.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
@@ -26,7 +26,7 @@
     <=
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Michael J. Carey]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast
index bc85255..44c733d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast
@@ -12,19 +12,19 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-to-edit-distance-check_07.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Michael J. Carey]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_08.ast
index b29718f..366a0bc 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_08.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_08.ast
@@ -12,13 +12,13 @@
 WriteOutputTo asterix_nc1:rttest/similarity_edit-distance-to-edit-distance-check_08.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
@@ -26,7 +26,7 @@
     <
     FunctionCall test.edit-distance@2[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=authors
       ]
       LiteralExpr [STRING] [Michael J. Carey]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-edit-distance-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-edit-distance-check.ast
index 1e6bf52..225cd3c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-edit-distance-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-edit-distance-check.ast
@@ -14,18 +14,18 @@
 Set simthreshold=1
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     ~=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-jaccard-check.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-jaccard-check.ast
index d9dec49..bc71c3e 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-jaccard-check.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/fuzzyeq-to-jaccard-check.ast
@@ -14,19 +14,19 @@
 Set simthreshold=0.8f
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_01.ast
index 6d38105..b91b293 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_01.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=jacc ]
+Variable [ Name=$jacc ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
@@ -35,7 +35,7 @@
   ]
 Where
   OperatorExpr [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     >=
     LiteralExpr [FLOAT] [0.8]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_02.ast
index 9d8cd1c..9394db4 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_02.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=jacc ]
+Variable [ Name=$jacc ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
@@ -37,5 +37,5 @@
   OperatorExpr [
     LiteralExpr [FLOAT] [0.8]
     <=
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_03.ast
index e313621..22ec108 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_03.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=jacc ]
+Variable [ Name=$jacc ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
@@ -35,7 +35,7 @@
   ]
 Where
   OperatorExpr [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     >
     LiteralExpr [FLOAT] [0.8]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_04.ast
index 2cf103b..1094e45 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_04.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=jacc ]
+Variable [ Name=$jacc ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
@@ -37,5 +37,5 @@
   OperatorExpr [
     LiteralExpr [FLOAT] [0.8]
     <
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_05.ast
index a2f2e67..d83e97d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_05.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=jacc ]
+Variable [ Name=$jacc ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
@@ -35,7 +35,7 @@
   ]
 Where
   OperatorExpr [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     <=
     LiteralExpr [FLOAT] [0.8]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_06.ast
index 7f7fe75..84cbc0d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_06.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=jacc ]
+Variable [ Name=$jacc ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
@@ -37,5 +37,5 @@
   OperatorExpr [
     LiteralExpr [FLOAT] [0.8]
     >=
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_07.ast
index 125ba29..693651d 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_07.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_07.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=jacc ]
+Variable [ Name=$jacc ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
@@ -35,7 +35,7 @@
   ]
 Where
   OperatorExpr [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     <
     LiteralExpr [FLOAT] [0.8]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_08.ast
index 0606689..15e3929 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_08.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-let-to-jaccard-check_08.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-let-to-jaccard-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=jacc ]
+Variable [ Name=$jacc ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
@@ -37,5 +37,5 @@
   OperatorExpr [
     LiteralExpr [FLOAT] [0.8]
     >
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_01.ast
index c0bd4ae..62661bb 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_01.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-to-jaccard-check_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_02.ast
index 72487c6..3386596 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_02.ast
@@ -12,13 +12,13 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-to-jaccard-check_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
@@ -27,7 +27,7 @@
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_03.ast
index 766a4f3..9b836ee 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_03.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_03.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-to-jaccard-check_02.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_04.ast
index a777ad6..d601a98 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_04.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_04.ast
@@ -12,13 +12,13 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-to-jaccard-check_03.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
@@ -27,7 +27,7 @@
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_05.ast
index ac86b47..3963f6f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_05.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_05.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-to-jaccard-check_05.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_06.ast
index 6d7a7b2..d7e9ffcf 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_06.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_06.ast
@@ -12,13 +12,13 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-to-jaccard-check_06.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
@@ -27,7 +27,7 @@
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_07.ast
index 0fc5b61..484b6f1 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_07.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_07.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-to-jaccard-check_07.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_08.ast
index b664f0f..e9d8f62 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_08.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/jaccard-to-jaccard-check_08.ast
@@ -12,13 +12,13 @@
 WriteOutputTo asterix_nc1:rttest/similarity_jaccard-to-jaccard-check_08.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
@@ -27,7 +27,7 @@
     FunctionCall test.similarity-jaccard@2[
       FunctionCall test.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=title
         ]
       ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index.ast
index cd75cd7..d5c4b08 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/dont-skip-primary-index.ast
@@ -9,19 +9,19 @@
 DatasetDecl testdst(TestType) partitioned by [[fname], [lname]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -30,7 +30,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       >=
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
@@ -48,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=lname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index.ast
index 4e27860..87e800c 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-ngram-index.ast
@@ -12,25 +12,25 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_ngram-contains.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-secondary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-secondary-index.ast
index 976f9b2..be9f7ba 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-secondary-index.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-rtree-secondary-index.ast
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -31,12 +31,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-2.ast
index c55e4a6..c534506 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-2.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index-2.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index.ast
index c55e4a6..c534506 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-secondary-btree-index.ast
@@ -10,19 +10,19 @@
 DatasetDecl testdst(TestType) partitioned by [[id]]
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       >=
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=emp ]
+        Variable [ Name=$emp ]
         Field=fname
       ]
       <=
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index.ast
index e9bf2f5..1212e22 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/skip-index/skip-word-index.ast
@@ -12,20 +12,20 @@
 WriteOutputTo asterix_nc1:rttest/inverted-index-basic_word-jaccard.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -35,7 +35,7 @@
   ]
 Where
   OperatorExpr [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     >=
     LiteralExpr [FLOAT] [0.5]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/sort-cust.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/sort-cust.ast
index 3be6afa..b9baf55 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/sort-cust.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/sort-cust.ast
@@ -28,7 +28,7 @@
     LiteralExpr [STRING] [custname]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -36,7 +36,7 @@
     LiteralExpr [STRING] [custage]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
   )
@@ -46,11 +46,11 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=age
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
index 41669f9..80a8ba9 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
@@ -16,18 +16,18 @@
   (
     LiteralExpr [STRING] [left]
     :
-    Variable [ Name=paperLeft ]
+    Variable [ Name=$paperLeft ]
   )
   (
     LiteralExpr [STRING] [right]
     :
-    Variable [ Name=paperRight ]
+    Variable [ Name=$paperRight ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -37,13 +37,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperLeft ]
+  Variable [ Name=$paperLeft ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperRight ]
+  Variable [ Name=$paperRight ]
 ,
   (
     SELECT ELEMENT [
@@ -51,18 +51,18 @@
       (
         LiteralExpr [STRING] [idLeft]
         :
-        Variable [ Name=idLeft ]
+        Variable [ Name=$idLeft ]
       )
       (
         LiteralExpr [STRING] [idRight]
         :
-        Variable [ Name=idRight ]
+        Variable [ Name=$idRight ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -72,7 +72,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperLeft ]
+      Variable [ Name=$paperLeft ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -87,13 +87,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenLeft ]
+      Variable [ Name=$prefixTokenLeft ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperRight ]
+      Variable [ Name=$paperRight ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -108,276 +108,334 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenRight ]
+      Variable [ Name=$prefixTokenRight ]
     ]
-    LetVariable [ Name=lenLeft ]
+    Let Variable [ Name=$lenLeft ]
       :=
       FunctionCall fuzzyjoin.len@1[
         FunctionCall fuzzyjoin.counthashed-word-tokens@1[
           FieldAccessor [
-            Variable [ Name=paperLeft ]
+            Variable [ Name=$paperLeft ]
             Field=title
           ]
         ]
       ]
-    LetVariable [ Name=tokensLeft ]
+    Let Variable [ Name=$tokensLeft ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperLeft ]
+              Variable [ Name=$paperLeft ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenLeft ]
-              Variable [ Name=paperLeft ]
-              Variable [ Name=paperRight ]
-              Variable [ Name=prefixTokenRight ]
-              Variable [ Name=prefixTokenLeft ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenLeft ]
+               AS lenLeft
+              Variable [ Name=$prefixTokenRight ]
+               AS prefixTokenRight
+              Variable [ Name=$paperRight ]
+               AS paperRight
+              Variable [ Name=$prefixTokenLeft ]
+               AS prefixTokenLeft
+              Variable [ Name=$paperLeft ]
+               AS paperLeft
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=lenRight ]
+    Let Variable [ Name=$lenRight ]
       :=
       FunctionCall fuzzyjoin.len@1[
         FunctionCall fuzzyjoin.counthashed-word-tokens@1[
           FieldAccessor [
-            Variable [ Name=paperRight ]
+            Variable [ Name=$paperRight ]
             Field=title
           ]
         ]
       ]
-    LetVariable [ Name=tokensRight ]
+    Let Variable [ Name=$tokensRight ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperRight ]
+              Variable [ Name=$paperRight ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenRight ]
-              Variable [ Name=tokensLeft ]
-              Variable [ Name=lenLeft ]
-              Variable [ Name=paperLeft ]
-              Variable [ Name=paperRight ]
-              Variable [ Name=prefixTokenRight ]
-              Variable [ Name=prefixTokenLeft ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenRight ]
+               AS lenRight
+              Variable [ Name=$tokensLeft ]
+               AS tokensLeft
+              Variable [ Name=$lenLeft ]
+               AS lenLeft
+              Variable [ Name=$prefixTokenRight ]
+               AS prefixTokenRight
+              Variable [ Name=$paperRight ]
+               AS paperRight
+              Variable [ Name=$prefixTokenLeft ]
+               AS prefixTokenLeft
+              Variable [ Name=$paperLeft ]
+               AS paperLeft
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenLeft ]
-        Variable [ Name=tokensLeft ]
-        Variable [ Name=lenRight ]
-        Variable [ Name=tokensRight ]
-        Variable [ Name=prefixTokenLeft ]
+        Variable [ Name=$lenLeft ]
+        Variable [ Name=$tokensLeft ]
+        Variable [ Name=$lenRight ]
+        Variable [ Name=$tokensRight ]
+        Variable [ Name=$prefixTokenLeft ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenLeft ]
+          Variable [ Name=$prefixTokenLeft ]
           =
-          Variable [ Name=prefixTokenRight ]
+          Variable [ Name=$prefixTokenRight ]
         ]
         and
         OperatorExpr [
           OperatorExpr [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             >=
             LiteralExpr [FLOAT] [0.5]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=paperLeft ]
+              Variable [ Name=$paperLeft ]
               Field=id
             ]
             <
             FieldAccessor [
-              Variable [ Name=paperRight ]
+              Variable [ Name=$paperRight ]
               Field=id
             ]
           ]
         ]
       ]
     Groupby
-      Variable [ Name=idLeft ]
+      Variable [ Name=$idLeft ]
       :=
       FieldAccessor [
-        Variable [ Name=paperLeft ]
+        Variable [ Name=$paperLeft ]
         Field=id
       ]
-      Variable [ Name=idRight ]
+      Variable [ Name=$idRight ]
       :=
       FieldAccessor [
-        Variable [ Name=paperRight ]
+        Variable [ Name=$paperRight ]
         Field=id
       ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensRight ]
-      Variable [ Name=lenRight ]
-      Variable [ Name=tokensLeft ]
-      Variable [ Name=lenLeft ]
-      Variable [ Name=paperLeft ]
-      Variable [ Name=paperRight ]
-      Variable [ Name=prefixTokenRight ]
-      Variable [ Name=prefixTokenLeft ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensRight ]
+       AS tokensRight
+      Variable [ Name=$lenRight ]
+       AS lenRight
+      Variable [ Name=$tokensLeft ]
+       AS tokensLeft
+      Variable [ Name=$lenLeft ]
+       AS lenLeft
+      Variable [ Name=$prefixTokenRight ]
+       AS prefixTokenRight
+      Variable [ Name=$paperRight ]
+       AS paperRight
+      Variable [ Name=$prefixTokenLeft ]
+       AS prefixTokenLeft
+      Variable [ Name=$paperLeft ]
+       AS paperLeft
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idLeft
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperLeft ]
+        Variable [ Name=$paperLeft ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idRight
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperRight ]
+        Variable [ Name=$paperRight ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperLeft ]
+    Variable [ Name=$paperLeft ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperRight ]
+    Variable [ Name=$paperRight ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast
index c5360e2..1704a22 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast
@@ -20,23 +20,23 @@
 ]
 DatasetDecl FacebookUsers(FacebookUserType) partitioned by [[id]]
 Query:
-LetVariable [ Name=lonelyusers ]
+Let Variable [ Name=$lonelyusers ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [FacebookUsers]
       ]
       AS
-      Variable [ Name=d ]
+      Variable [ Name=$d ]
     ]
     Where
       OperatorExpr [
         FunctionCall TinySocial.count@1[
           FieldAccessor [
-            Variable [ Name=d ]
+            Variable [ Name=$d ]
             Field=friend-ids
           ]
         ]
@@ -44,23 +44,23 @@
         LiteralExpr [LONG] [2]
       ]
   )
-LetVariable [ Name=lonelyusers2 ]
+Let Variable [ Name=$lonelyusers2 ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [FacebookUsers]
       ]
       AS
-      Variable [ Name=d ]
+      Variable [ Name=$d ]
     ]
     Where
       OperatorExpr [
         FunctionCall TinySocial.count@1[
           FieldAccessor [
-            Variable [ Name=d ]
+            Variable [ Name=$d ]
             Field=friend-ids
           ]
         ]
@@ -78,7 +78,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=id
         ]
       )
@@ -86,7 +86,7 @@
         LiteralExpr [STRING] [name]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=name
         ]
       )
@@ -100,7 +100,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=l2 ]
+          Variable [ Name=$l2 ]
           Field=id
         ]
       )
@@ -108,7 +108,7 @@
         LiteralExpr [STRING] [name]
         :
         FieldAccessor [
-          Variable [ Name=l2 ]
+          Variable [ Name=$l2 ]
           Field=name
         ]
       )
@@ -116,34 +116,34 @@
   )
 ]
 ]
-FROM [  Variable [ Name=lonelyusers ]
+FROM [  Variable [ Name=$lonelyusers ]
   AS
-  Variable [ Name=l1 ]
+  Variable [ Name=$l1 ]
 ,
-  Variable [ Name=lonelyusers2 ]
+  Variable [ Name=$lonelyusers2 ]
   AS
-  Variable [ Name=l2 ]
+  Variable [ Name=$l2 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l1 ]
+      Variable [ Name=$l1 ]
       Field=id
     ]
     <
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l1 ]
+    Variable [ Name=$l1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=l2 ]
+    Variable [ Name=$l2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_01.ast
index 6467025..adb3de6 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_01.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_01.ast
@@ -2,7 +2,7 @@
 WriteOutputTo asterix_nc1:rttest/unnest-to-join_01.adm
 Query:
 SELECT ELEMENT [
-Variable [ Name=y ]
+Variable [ Name=$y ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -13,7 +13,7 @@
     LiteralExpr [LONG] [6]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   OrderedListConstructor [
     LiteralExpr [LONG] [4]
@@ -24,11 +24,11 @@
     LiteralExpr [LONG] [9]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     =
-    Variable [ Name=y ]
+    Variable [ Name=$y ]
   ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_02.ast
index fa15409..aedd68f 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_02.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest-to-join_02.ast
@@ -3,7 +3,7 @@
 Query:
 SELECT ELEMENT [
 QuantifiedExpression SOME [
-  [Variable [ Name=x ]
+  [Variable [ Name=$x ]
   In
     OrderedListConstructor [
       LiteralExpr [LONG] [1]
@@ -14,7 +14,7 @@
       LiteralExpr [LONG] [6]
     ]
   ]
-  [Variable [ Name=y ]
+  [Variable [ Name=$y ]
   In
     OrderedListConstructor [
       LiteralExpr [LONG] [4]
@@ -27,9 +27,9 @@
   ]
   Satifies [
     OperatorExpr [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       =
-      Variable [ Name=y ]
+      Variable [ Name=$y ]
     ]
   ]
 ]
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest_list_in_subplan.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest_list_in_subplan.ast
index 57ba302..c037665 100644
--- a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest_list_in_subplan.ast
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/unnest_list_in_subplan.ast
@@ -23,12 +23,12 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -36,53 +36,53 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       Field=rank
     ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [TOKENSRANKEDADM]
       ]
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
         FieldAccessor [
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           Field=token
         ]
       ]
     Orderby
       FieldAccessor [
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
         Field=rank
       ]
       ASC
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias.sqlpp
index 746660c..72eb1d9 100644
--- a/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias.sqlpp
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias.sqlpp
@@ -21,4 +21,4 @@
 GROUP BY root
 WITH u AS root
 HAVING root > 0
-ORDER BY u; 
\ No newline at end of file
+ORDER BY u;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/1.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/1.ast
index 5615495..4cd023d 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/1.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/1.ast
@@ -5,7 +5,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -15,20 +15,20 @@
     LiteralExpr [STRING] [User]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=i ]
+    [Variable [ Name=$i ]
     In
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         =
         LiteralExpr [STRING] [movies]
       ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
index 7de063f..fbf13fc 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
@@ -4,17 +4,17 @@
   (
     LiteralExpr [STRING] [sig_name]
     :
-    Variable [ Name=sig_name ]
+    Variable [ Name=$sig_name ]
   )
   (
     LiteralExpr [STRING] [total_count]
     :
-    Variable [ Name=sig_sponsorship_count ]
+    Variable [ Name=$sig_sponsorship_count ]
   )
   (
     LiteralExpr [STRING] [chapter_breakdown]
     :
-    Variable [ Name=by_chapter ]
+    Variable [ Name=$by_chapter ]
   )
 ]
 ]
@@ -22,47 +22,64 @@
     LiteralExpr [STRING] [Event]
   ]
   AS
-  Variable [ Name=event ]
+  Variable [ Name=$event ]
 ,
   FieldAccessor [
-    Variable [ Name=event ]
+    Variable [ Name=$event ]
     Field=sponsoring_sigs
   ]
   AS
-  Variable [ Name=sponsor ]
+  Variable [ Name=$sponsor ]
 ]
-LetVariable [ Name=es ]
+Let Variable [ Name=$es ]
   :=
   RecordConstructor [
     (
       LiteralExpr [STRING] [event]
       :
-      Variable [ Name=event ]
+      Variable [ Name=$event ]
     )
     (
       LiteralExpr [STRING] [sponsor]
       :
-      Variable [ Name=sponsor ]
+      Variable [ Name=$sponsor ]
     )
   ]
 Groupby
-  Variable [ Name=sig_name ]
+  Variable [ Name=$sig_name ]
   :=
   FieldAccessor [
-    Variable [ Name=sponsor ]
+    Variable [ Name=$sponsor ]
     Field=sig_name
   ]
-  With
-  Variable [ Name=es ]
-  Variable [ Name=sponsor ]
-  Variable [ Name=event ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$es ]
+   AS es
+  Variable [ Name=$sponsor ]
+   AS sponsor
+  Variable [ Name=$event ]
+   AS event
+  )
 
-LetVariable [ Name=sig_sponsorship_count ]
+Let Variable [ Name=$sig_sponsorship_count ]
   :=
   FunctionCall null.count@1[
-    Variable [ Name=es ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=es
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
-LetVariable [ Name=by_chapter ]
+Let Variable [ Name=$by_chapter ]
   :=
   (
     SELECT ELEMENT [
@@ -70,42 +87,64 @@
       (
         LiteralExpr [STRING] [chapter_name]
         :
-        Variable [ Name=chapter_name ]
+        Variable [ Name=$chapter_name ]
       )
       (
         LiteralExpr [STRING] [escount]
         :
         FunctionCall null.count@1[
-          Variable [ Name=es ]
+          (
+            SELECT ELEMENT [
+            FieldAccessor [
+              Variable [ Name=#3 ]
+              Field=es
+            ]
+            ]
+            FROM [              Variable [ Name=#1 ]
+              AS
+              Variable [ Name=#3 ]
+            ]
+          )
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=es ]
+    FROM [      Variable [ Name=$es ]
       AS
-      Variable [ Name=e ]
+      Variable [ Name=$e ]
     ]
     Groupby
-      Variable [ Name=chapter_name ]
+      Variable [ Name=$chapter_name ]
       :=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=e ]
+          Variable [ Name=$e ]
           Field=sponsor
         ]
         Field=chapter_name
       ]
-      With
-      Variable [ Name=e ]
-      Variable [ Name=sig_sponsorship_count ]
-      Variable [ Name=sponsor ]
-      Variable [ Name=event ]
-      Variable [ Name=es ]
-      Variable [ Name=sig_name ]
+      GROUP AS
+      Variable [ Name=#4 ]
+      (
+      Variable [ Name=$e ]
+       AS e
+      Variable [ Name=$sig_sponsorship_count ]
+       AS sig_sponsorship_count
+      Variable [ Name=$es ]
+       AS es
+      Variable [ Name=$event ]
+       AS event
+      Variable [ Name=$sponsor ]
+       AS sponsor
+      Variable [ Name=$sig_name ]
+       AS sig_name
+      Variable [ Name=#1 ]
+       AS #1
+      )
 
   )
 Orderby
-  Variable [ Name=sig_sponsorship_count ]
+  Variable [ Name=$sig_sponsorship_count ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/4.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/4.ast
index e739c37..1aad304 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/4.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/4.ast
@@ -4,7 +4,7 @@
   (
     LiteralExpr [STRING] [similar_sigs]
     :
-    Variable [ Name=similar_sigs ]
+    Variable [ Name=$similar_sigs ]
   )
 ]
 ]
@@ -12,9 +12,9 @@
     LiteralExpr [STRING] [SIGroup]
   ]
   AS
-  Variable [ Name=sig ]
+  Variable [ Name=$sig ]
 ]
-LetVariable [ Name=similar_sigs ]
+Let Variable [ Name=$similar_sigs ]
   :=
   (
     SELECT ELEMENT [
@@ -23,7 +23,7 @@
         LiteralExpr [STRING] [sig_name]
         :
         FieldAccessor [
-          Variable [ Name=similar_sig ]
+          Variable [ Name=$similar_sig ]
           Field=name
         ]
       )
@@ -33,24 +33,24 @@
         LiteralExpr [STRING] [SIGroup]
       ]
       AS
-      Variable [ Name=similar_sig ]
+      Variable [ Name=$similar_sig ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=similar_sig ]
+          Variable [ Name=$similar_sig ]
           !=
-          Variable [ Name=sig ]
+          Variable [ Name=$sig ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=similar_sig ]
+            Variable [ Name=$similar_sig ]
             Field=interests
           ]
           ~=
           FieldAccessor [
-            Variable [ Name=sig ]
+            Variable [ Name=$sig ]
             Field=interests
           ]
         ]
@@ -59,7 +59,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=sig ]
+      Variable [ Name=$sig ]
       Field=name
     ]
     =
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/5.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/5.ast
index 73f0cd6..dfb6f09 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/5.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/5.ast
@@ -4,7 +4,7 @@
   (
     LiteralExpr [STRING] [collocated_evnets]
     :
-    Variable [ Name=collocated_events ]
+    Variable [ Name=$collocated_events ]
   )
 ]
 ]
@@ -12,9 +12,9 @@
     LiteralExpr [STRING] [Event]
   ]
   AS
-  Variable [ Name=event ]
+  Variable [ Name=$event ]
 ]
-LetVariable [ Name=collocated_events ]
+Let Variable [ Name=$collocated_events ]
   :=
   (
     SELECT ELEMENT [
@@ -23,7 +23,7 @@
         LiteralExpr [STRING] [event_name]
         :
         FieldAccessor [
-          Variable [ Name=collocated_event ]
+          Variable [ Name=$collocated_event ]
           Field=name
         ]
       )
@@ -33,14 +33,14 @@
         LiteralExpr [STRING] [Events]
       ]
       AS
-      Variable [ Name=collocated_event ]
+      Variable [ Name=$collocated_event ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=collocated_event ]
+              Variable [ Name=$collocated_event ]
               Field=location
             ]
             Field=street
@@ -48,7 +48,7 @@
           ~=
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=event ]
+              Variable [ Name=$event ]
               Field=location
             ]
             Field=street
@@ -58,7 +58,7 @@
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=collocated_event ]
+              Variable [ Name=$collocated_event ]
               Field=location
             ]
             Field=city
@@ -66,7 +66,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=event ]
+              Variable [ Name=$event ]
               Field=location
             ]
             Field=city
@@ -76,7 +76,7 @@
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=collocated_event ]
+              Variable [ Name=$collocated_event ]
               Field=location
             ]
             Field=state
@@ -84,7 +84,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=event ]
+              Variable [ Name=$event ]
               Field=location
             ]
             Field=state
@@ -94,7 +94,7 @@
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=collocated_event ]
+              Variable [ Name=$collocated_event ]
               Field=location
             ]
             Field=zip
@@ -102,7 +102,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=event ]
+              Variable [ Name=$event ]
               Field=location
             ]
             Field=zip
@@ -113,7 +113,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=event ]
+      Variable [ Name=$event ]
       Field=name
     ]
     =
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/6.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/6.ast
index dcbd485..effebf2 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/6.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/6.ast
@@ -5,14 +5,14 @@
     LiteralExpr [STRING] [user_name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
   (
     LiteralExpr [STRING] [similar_users]
     :
-    Variable [ Name=similar_users ]
+    Variable [ Name=$similar_users ]
   )
 ]
 ]
@@ -20,9 +20,9 @@
     LiteralExpr [STRING] [Users]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
-LetVariable [ Name=similar_users ]
+Let Variable [ Name=$similar_users ]
   :=
   (
     SELECT ELEMENT [
@@ -31,14 +31,14 @@
         LiteralExpr [STRING] [user_name]
         :
         FieldAccessor [
-          Variable [ Name=similar_user ]
+          Variable [ Name=$similar_user ]
           Field=name
         ]
       )
       (
         LiteralExpr [STRING] [similarity]
         :
-        Variable [ Name=similarity ]
+        Variable [ Name=$similarity ]
       )
     ]
     ]
@@ -46,36 +46,36 @@
         LiteralExpr [STRING] [Users]
       ]
       AS
-      Variable [ Name=similar_user ]
+      Variable [ Name=$similar_user ]
     ]
-    LetVariable [ Name=similarity ]
+    Let Variable [ Name=$similarity ]
       :=
       FunctionCall null.jaccard_similarity@2[
         FieldAccessor [
-          Variable [ Name=user ]
+          Variable [ Name=$user ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=similar_user ]
+          Variable [ Name=$similar_user ]
           Field=interests
         ]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=user ]
+          Variable [ Name=$user ]
           !=
-          Variable [ Name=similar_user ]
+          Variable [ Name=$similar_user ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=similarity ]
+          Variable [ Name=$similarity ]
           >=
           LiteralExpr [DOUBLE] [0.75]
         ]
       ]
     Orderby
-      Variable [ Name=similarity ]
+      Variable [ Name=$similarity ]
       DESC
 
     Limit
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ANYInFieldAccessor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ANYInFieldAccessor.ast
index 2f60cbc..619350b 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ANYInFieldAccessor.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ANYInFieldAccessor.ast
@@ -5,7 +5,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -13,7 +13,7 @@
     LiteralExpr [STRING] [movie]
     :
     FieldAccessor [
-      Variable [ Name=mv ]
+      Variable [ Name=$mv ]
       Field=movie
     ]
   )
@@ -23,33 +23,33 @@
     LiteralExpr [STRING] [User]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Movie]
   ]
   AS
-  Variable [ Name=mv ]
+  Variable [ Name=$mv ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=i ]
+    [Variable [ Name=$i ]
     In
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=movie
         ]
         =
         IndexAccessor [
           FieldAccessor [
-            Variable [ Name=mv ]
+            Variable [ Name=$mv ]
             Field=movie
           ]
           Index: ANY
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast
index 4b9e932..a8b54c1 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast
@@ -3,14 +3,14 @@
 IfExpr [
   Condition:
     OperatorExpr [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       >
-      Variable [ Name=j ]
+      Variable [ Name=$j ]
     ]
   Then:
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
   Else:
-    Variable [ Name=j ]
+    Variable [ Name=$j ]
 ]
 ]
 FROM [  OrderedListConstructor [
@@ -20,7 +20,7 @@
     LiteralExpr [LONG] [40]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ,
   UnorderedListConstructor [
     LiteralExpr [LONG] [4]
@@ -28,5 +28,5 @@
     LiteralExpr [LONG] [6]
   ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
index b9bf49a..a46d1c9 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
@@ -1,5 +1,5 @@
 Query:
-LetVariable [ Name=users ]
+Let Variable [ Name=$users ]
   :=
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [User]
@@ -10,28 +10,28 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
 ]
 ]
-FROM [  Variable [ Name=users ]
+FROM [  Variable [ Name=$users ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=i ]
+    [Variable [ Name=$i ]
     In
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         =
         LiteralExpr [STRING] [movies]
       ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ListConstructor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ListConstructor.ast
index 3d3a387..f769a0d 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ListConstructor.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ListConstructor.ast
@@ -1,9 +1,9 @@
 Query:
 SELECT ELEMENT [
 OperatorExpr [
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
   +
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
 ]
 ]
 FROM [  OrderedListConstructor [
@@ -12,7 +12,7 @@
     LiteralExpr [LONG] [3]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ,
   UnorderedListConstructor [
     LiteralExpr [LONG] [4]
@@ -20,5 +20,5 @@
     LiteralExpr [LONG] [6]
   ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast
index 26addaa..cb03fe8 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast
@@ -1,77 +1,47 @@
 Query:
 SELECT [
-FunctionCall null.SQRT@1[
-  OperatorExpr [
-    FieldAccessor [
-      Variable [ Name=t ]
-      Field=a
-    ]
-    *
-    FieldAccessor [
-      Variable [ Name=t ]
-      Field=b
-    ]
-  ]
-]
+Variable [ Name=#1 ]
 root
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [tbl_name]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  FunctionCall null.SQRT@1[
-    OperatorExpr [
-      FieldAccessor [
-        Variable [ Name=t ]
-        Field=a
-      ]
-      *
-      FieldAccessor [
-        Variable [ Name=t ]
-        Field=b
-      ]
-    ]
-  ]
-  With
-  Variable [ Name=t ]
-
-LetVariable [ Name=u ]
+  Variable [ Name=#1 ]
   :=
   FunctionCall null.SQRT@1[
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=a
       ]
       *
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=b
       ]
     ]
   ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
+
+Let Variable [ Name=$u ]
+  :=
+  Variable [ Name=#1 ]
  HAVING
   OperatorExpr [
-    FunctionCall null.SQRT@1[
-      OperatorExpr [
-        FieldAccessor [
-          Variable [ Name=t ]
-          Field=a
-        ]
-        *
-        FieldAccessor [
-          Variable [ Name=t ]
-          Field=b
-        ]
-      ]
-    ]
+    Variable [ Name=#1 ]
     >
     LiteralExpr [LONG] [0]
   ]
 Orderby
-  Variable [ Name=u ]
+  Variable [ Name=$u ]
   ASC
 
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
index 90d32cc..6142478 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
@@ -23,32 +23,38 @@
     LiteralExpr [STRING] [tbl_name]
   ]
   AS
-  Variable [ Name=root ]
+  Variable [ Name=$root ]
 ]
 Groupby
-  FieldAccessor [
-    Variable [ Name=root ]
-    Field=id
-  ]
-  With
-  Variable [ Name=root ]
-
-LetVariable [ Name=u ]
+  Variable [ Name=#1 ]
   :=
   FieldAccessor [
-    Variable [ Name=root ]
+    Variable [ Name=$root ]
+    Field=id
+  ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$root ]
+   AS root
+  )
+
+Let Variable [ Name=$u ]
+  :=
+  FieldAccessor [
+    Variable [ Name=$root ]
     Field=time
   ]
  HAVING
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=root ]
+      Variable [ Name=$root ]
       Field=orders
     ]
     >
     LiteralExpr [LONG] [0]
   ]
 Orderby
-  Variable [ Name=u ]
+  Variable [ Name=$u ]
   ASC
 
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast
index 6b5693b..a7ae7ca 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast
@@ -4,19 +4,7 @@
   (
     LiteralExpr [STRING] [root]
     :
-    FunctionCall null.SQRT@1[
-      OperatorExpr [
-        FieldAccessor [
-          Variable [ Name=t ]
-          Field=a
-        ]
-        *
-        FieldAccessor [
-          Variable [ Name=t ]
-          Field=b
-        ]
-      ]
-    ]
+    Variable [ Name=#1 ]
   )
 ]
 ]
@@ -24,59 +12,41 @@
     LiteralExpr [STRING] [tbl_name]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  FunctionCall null.SQRT@1[
-    OperatorExpr [
-      FieldAccessor [
-        Variable [ Name=t ]
-        Field=a
-      ]
-      *
-      FieldAccessor [
-        Variable [ Name=t ]
-        Field=b
-      ]
-    ]
-  ]
-  With
-  Variable [ Name=t ]
-
-LetVariable [ Name=u ]
+  Variable [ Name=#1 ]
   :=
   FunctionCall null.SQRT@1[
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=a
       ]
       *
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=b
       ]
     ]
   ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
+
+Let Variable [ Name=$u ]
+  :=
+  Variable [ Name=#1 ]
  HAVING
   OperatorExpr [
-    FunctionCall null.SQRT@1[
-      OperatorExpr [
-        FieldAccessor [
-          Variable [ Name=t ]
-          Field=a
-        ]
-        *
-        FieldAccessor [
-          Variable [ Name=t ]
-          Field=b
-        ]
-      ]
-    ]
+    Variable [ Name=#1 ]
     >
     LiteralExpr [LONG] [0]
   ]
 Orderby
-  Variable [ Name=u ]
+  Variable [ Name=$u ]
   ASC
 
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/fieldAccessor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/fieldAccessor.ast
index 40bc769..0db2e76 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/fieldAccessor.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/fieldAccessor.ast
@@ -1,5 +1,5 @@
 Query:
-LetVariable [ Name=bla ]
+Let Variable [ Name=$bla ]
   :=
   RecordConstructor [
     (
@@ -11,12 +11,12 @@
 SELECT ELEMENT [
 OperatorExpr [
   FieldAccessor [
-    Variable [ Name=bla ]
+    Variable [ Name=$bla ]
     Field=name
   ]
   =
   FieldAccessor [
-    Variable [ Name=bla ]
+    Variable [ Name=$bla ]
     Field=name
   ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_array.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_array.ast
index 192bf6e..43c56e7 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_array.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_array.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [10]
@@ -8,5 +8,5 @@
     LiteralExpr [LONG] [30]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_bag.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_bag.ast
index e768f7e..79cb01d 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_bag.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_bag.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  UnorderedListConstructor [
     LiteralExpr [LONG] [10]
@@ -8,5 +8,5 @@
     LiteralExpr [LONG] [30]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_correlate.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_correlate.ast
index b354122..701d997 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_correlate.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_correlate.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=r ]
+Variable [ Name=$r ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [sensors]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
   INNER UNNEST
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=readings
     ]
      AS
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_flatten.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_flatten.ast
index 7668550..f3c8a42 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_flatten.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_flatten.ast
@@ -2,23 +2,23 @@
 Query:
 SELECT [
 FieldAccessor [
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
   Field=sensor
 ]
 sensor
-Variable [ Name=r ]
+Variable [ Name=$r ]
 reading
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [sensors]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
 ,
   FieldAccessor [
-    Variable [ Name=s ]
+    Variable [ Name=$s ]
     Field=readings
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_join.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_join.ast
index 0992966..d82b43d 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_join.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_join.ast
@@ -2,17 +2,17 @@
 Query:
 SELECT [
 FieldAccessor [
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
   Field=sensor
 ]
 sensor
 FieldAccessor [
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
   Field=readings
 ]
 readings
 FieldAccessor [
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
   Field=location
 ]
 location
@@ -21,22 +21,22 @@
     LiteralExpr [STRING] [sensors]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
   INNER JOIN
     FunctionCall Metadata.dataset@1[
       LiteralExpr [STRING] [sensorMeta]
     ]
     AS
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     ON
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=s ]
+        Variable [ Name=$s ]
         Field=sensor
       ]
       =
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=sensor
       ]
     ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate.ast
index 9fd948a..f11ecaf 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate.ast
@@ -2,17 +2,17 @@
 Query:
 SELECT [
 FieldAccessor [
-  Variable [ Name=sl ]
+  Variable [ Name=$sl ]
   Field=location
 ]
 location
 FieldAccessor [
-  Variable [ Name=sr ]
+  Variable [ Name=$sr ]
   Field=gas
 ]
 gas
 FieldAccessor [
-  Variable [ Name=sr ]
+  Variable [ Name=$sr ]
   Field=readings
 ]
 readings
@@ -62,7 +62,7 @@
     ]
   ]
   AS
-  Variable [ Name=sl ]
+  Variable [ Name=$sl ]
   LEFTOUTER UNNEST
     UnorderedListConstructor [
       RecordConstructor [
@@ -141,17 +141,17 @@
       ]
     ]
      AS
-    Variable [ Name=sr ]
+    Variable [ Name=$sr ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=sl ]
+      Variable [ Name=$sl ]
       Field=sensor
     ]
     =
     FieldAccessor [
-      Variable [ Name=sr ]
+      Variable [ Name=$sr ]
       Field=sensor
     ]
   ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate2.ast
index 9ace3b5..6036b55 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate2.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate2.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=r ]
+Variable [ Name=$r ]
 ]
 FROM [  UnorderedListConstructor [
     RecordConstructor [
@@ -48,12 +48,12 @@
     ]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
   LEFTOUTER UNNEST
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=readings
     ]
      AS
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_outer_join.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_outer_join.ast
index 0f82980..998fc6f 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_outer_join.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_outer_join.ast
@@ -2,17 +2,17 @@
 Query:
 SELECT [
 FieldAccessor [
-  Variable [ Name=sl ]
+  Variable [ Name=$sl ]
   Field=location
 ]
 location
 FieldAccessor [
-  Variable [ Name=sr ]
+  Variable [ Name=$sr ]
   Field=gas
 ]
 gas
 FieldAccessor [
-  Variable [ Name=sr ]
+  Variable [ Name=$sr ]
   Field=readings
 ]
 readings
@@ -62,7 +62,7 @@
     ]
   ]
   AS
-  Variable [ Name=sl ]
+  Variable [ Name=$sl ]
   LEFTOUTER JOIN
     UnorderedListConstructor [
       RecordConstructor [
@@ -141,16 +141,16 @@
       ]
     ]
     AS
-    Variable [ Name=sr ]
+    Variable [ Name=$sr ]
     ON
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=sl ]
+        Variable [ Name=$sl ]
         Field=sensor
       ]
       =
       FieldAccessor [
-        Variable [ Name=sr ]
+        Variable [ Name=$sr ]
         Field=sensor
       ]
     ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_where_select_clause.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_where_select_clause.ast
index bb0c8b5..b978b56 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_where_select_clause.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_where_select_clause.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [10]
@@ -10,11 +10,11 @@
     LiteralExpr [LONG] [10]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     =
     LiteralExpr [LONG] [10]
   ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl.ast
index e025413..90fa1e7 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl.ast
@@ -1,16 +1,16 @@
-FunctionDecl add([a, b]) {
+FunctionDecl add([$a, $b]) {
   OperatorExpr [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     +
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   ]
 }
 
-FunctionDecl minus([a, b]) {
+FunctionDecl minus([$a, $b]) {
   OperatorExpr [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     -
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   ]
 }
 
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
index 36f35dd..5983067 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
@@ -1,63 +1,63 @@
-FunctionDecl calculate([events]) {
+FunctionDecl calculate([$events]) {
   (
     SELECT ELEMENT [
     RecordConstructor [
       (
         LiteralExpr [STRING] [sig_name]
         :
-        Variable [ Name=sig_name ]
+        Variable [ Name=$sig_name ]
       )
       (
         LiteralExpr [STRING] [total_count]
         :
-        Variable [ Name=sig_sponsorship_count ]
+        Variable [ Name=$sig_sponsorship_count ]
       )
       (
         LiteralExpr [STRING] [chapter_breakdown]
         :
-        Variable [ Name=by_chapter ]
+        Variable [ Name=$by_chapter ]
       )
     ]
     ]
-    FROM [      Variable [ Name=events ]
+    FROM [      Variable [ Name=$events ]
       AS
-      Variable [ Name=event ]
+      Variable [ Name=$event ]
 ,
       FieldAccessor [
-        Variable [ Name=event ]
+        Variable [ Name=$event ]
         Field=sponsoring_sigs
       ]
       AS
-      Variable [ Name=sponsor ]
+      Variable [ Name=$sponsor ]
     ]
-    LetVariable [ Name=es ]
+    Let Variable [ Name=$es ]
       :=
       RecordConstructor [
         (
           LiteralExpr [STRING] [event]
           :
-          Variable [ Name=event ]
+          Variable [ Name=$event ]
         )
         (
           LiteralExpr [STRING] [sponsor]
           :
-          Variable [ Name=sponsor ]
+          Variable [ Name=$sponsor ]
         )
       ]
     Groupby
-      Variable [ Name=sig_name ]
+      Variable [ Name=$sig_name ]
       :=
       FieldAccessor [
-        Variable [ Name=sponsor ]
+        Variable [ Name=$sponsor ]
         Field=sig_name
       ]
 
-    LetVariable [ Name=sig_sponsorship_count ]
+    Let Variable [ Name=$sig_sponsorship_count ]
       :=
       FunctionCall null.count@1[
-        Variable [ Name=es ]
+        Variable [ Name=$es ]
       ]
-    LetVariable [ Name=by_chapter ]
+    Let Variable [ Name=$by_chapter ]
       :=
       (
         SELECT ELEMENT [
@@ -65,27 +65,27 @@
           (
             LiteralExpr [STRING] [chapter_name]
             :
-            Variable [ Name=chapter_name ]
+            Variable [ Name=$chapter_name ]
           )
           (
             LiteralExpr [STRING] [escount]
             :
             FunctionCall null.count@1[
-              Variable [ Name=es ]
+              Variable [ Name=$es ]
             ]
           )
         ]
         ]
-        FROM [          Variable [ Name=es ]
+        FROM [          Variable [ Name=$es ]
           AS
-          Variable [ Name=e ]
+          Variable [ Name=$e ]
         ]
         Groupby
-          Variable [ Name=chapter_name ]
+          Variable [ Name=$chapter_name ]
           :=
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=e ]
+              Variable [ Name=$e ]
               Field=sponsor
             ]
             Field=chapter_name
@@ -93,7 +93,7 @@
 
       )
     Orderby
-      Variable [ Name=sig_sponsorship_count ]
+      Variable [ Name=$sig_sponsorship_count ]
       DESC
 
     Limit
@@ -102,7 +102,7 @@
 }
 
 Query:
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FunctionCall null.calculate@1[
     FunctionCall Metadata.dataset@1[
@@ -110,5 +110,5 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast
index 407d545..de37697 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast
@@ -1,10 +1,10 @@
-FunctionDecl GT([a, b]) {
+FunctionDecl GT([$a, $b]) {
   IfExpr [
     Condition:
       OperatorExpr [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         >
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
       ]
     Then:
       LiteralExpr [TRUE]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl3.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl3.ast
index 487c466..54032ff 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl3.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl3.ast
@@ -1,4 +1,4 @@
-FunctionDecl function with spaces([a, b]) {
+FunctionDecl function with spaces([$a, $b]) {
   LiteralExpr [STRING] [string with spaces]
 }
 
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast
index b413291..feeed6e 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast
@@ -1,7 +1,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall null.count@1[
-  Variable [ Name=r ]
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      Variable [ Name=#2 ]
+      Field=r
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS
+      Variable [ Name=#2 ]
+    ]
+  )
 ]
 ]
 FROM [  UnorderedListConstructor [
@@ -79,15 +90,19 @@
     ]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Groupby
-  Variable [ Name=g ]
+  Variable [ Name=$g ]
   :=
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=gas
   ]
-  With
-  Variable [ Name=r ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$r ]
+   AS r
+  )
 
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
index 6e7af3a..da4a74f 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
@@ -5,37 +5,37 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
 ]
 ]
 FROM [  (
-    LetVariable [ Name=data ]
+    Let Variable [ Name=$data ]
       :=
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [User]
       ]
     SELECT ELEMENT [
-    Variable [ Name=data ]
+    Variable [ Name=$data ]
     ]
   )
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=i ]
+    [Variable [ Name=$i ]
     In
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         =
         LiteralExpr [STRING] [movies]
       ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast
index 46d3fb8..ea08249 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast
@@ -2,26 +2,26 @@
 SELECT ELEMENT [
 (
   SELECT ELEMENT [
-  Variable [ Name=k ]
+  Variable [ Name=$k ]
   ]
   FROM [    IfExpr [
       Condition:
         OperatorExpr [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           >
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
         ]
       Then:
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       Else:
-        Variable [ Name=j ]
+        Variable [ Name=$j ]
     ]
     AS
-    Variable [ Name=k ]
+    Variable [ Name=$k ]
   ]
   Where
     OperatorExpr [
-      Variable [ Name=k ]
+      Variable [ Name=$k ]
       <
       LiteralExpr [LONG] [10]
     ]
@@ -34,7 +34,7 @@
     LiteralExpr [LONG] [40]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ,
   UnorderedListConstructor [
     LiteralExpr [LONG] [4]
@@ -42,5 +42,5 @@
     LiteralExpr [LONG] [6]
   ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast
index 9673c91..84e2550 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast
@@ -2,26 +2,26 @@
 SELECT ELEMENT [
 (
   SELECT ELEMENT [
-  Variable [ Name=k ]
+  Variable [ Name=$k ]
   ]
   FROM [    IfExpr [
       Condition:
         OperatorExpr [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           >
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
         ]
       Then:
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       Else:
-        Variable [ Name=j ]
+        Variable [ Name=$j ]
     ]
     AS
-    Variable [ Name=k ]
+    Variable [ Name=$k ]
   ]
   Where
     OperatorExpr [
-      Variable [ Name=k ]
+      Variable [ Name=$k ]
       <
       LiteralExpr [LONG] [10]
     ]
@@ -33,18 +33,18 @@
     LiteralExpr [LONG] [30]
     (
       SELECT ELEMENT [
-      Variable [ Name=tmp ]
+      Variable [ Name=$tmp ]
       ]
       FROM [        FunctionCall Metadata.dataset@1[
           LiteralExpr [STRING] [number]
         ]
         AS
-        Variable [ Name=tmp ]
+        Variable [ Name=$tmp ]
       ]
     )
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ,
   UnorderedListConstructor [
     LiteralExpr [LONG] [4]
@@ -52,5 +52,5 @@
     LiteralExpr [LONG] [6]
   ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
index 4232303..a636e0d 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
@@ -4,17 +4,17 @@
   (
     LiteralExpr [STRING] [sig_name]
     :
-    Variable [ Name=sig_name ]
+    Variable [ Name=$sig_name ]
   )
   (
     LiteralExpr [STRING] [total_count]
     :
-    Variable [ Name=sig_sponsorship_count ]
+    Variable [ Name=$sig_sponsorship_count ]
   )
   (
     LiteralExpr [STRING] [chapter_breakdown]
     :
-    Variable [ Name=by_chapter ]
+    Variable [ Name=$by_chapter ]
   )
 ]
 ]
@@ -22,47 +22,64 @@
     LiteralExpr [STRING] [Event]
   ]
   AS
-  Variable [ Name=event ]
+  Variable [ Name=$event ]
 ,
   FieldAccessor [
-    Variable [ Name=event ]
+    Variable [ Name=$event ]
     Field=sponsoring_sigs
   ]
   AS
-  Variable [ Name=sponsor ]
+  Variable [ Name=$sponsor ]
 ]
-LetVariable [ Name=es ]
+Let Variable [ Name=$es ]
   :=
   RecordConstructor [
     (
       LiteralExpr [STRING] [event]
       :
-      Variable [ Name=event ]
+      Variable [ Name=$event ]
     )
     (
       LiteralExpr [STRING] [sponsor]
       :
-      Variable [ Name=sponsor ]
+      Variable [ Name=$sponsor ]
     )
   ]
 Groupby
-  Variable [ Name=sig_name ]
+  Variable [ Name=$sig_name ]
   :=
   FieldAccessor [
-    Variable [ Name=sponsor ]
+    Variable [ Name=$sponsor ]
     Field=sig_name
   ]
-  With
-  Variable [ Name=es ]
-  Variable [ Name=sponsor ]
-  Variable [ Name=event ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$es ]
+   AS es
+  Variable [ Name=$sponsor ]
+   AS sponsor
+  Variable [ Name=$event ]
+   AS event
+  )
 
-LetVariable [ Name=sig_sponsorship_count ]
+Let Variable [ Name=$sig_sponsorship_count ]
   :=
   FunctionCall null.count@1[
-    Variable [ Name=es ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=es
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
-LetVariable [ Name=by_chapter ]
+Let Variable [ Name=$by_chapter ]
   :=
   (
     SELECT ELEMENT [
@@ -70,42 +87,64 @@
       (
         LiteralExpr [STRING] [chapter_name]
         :
-        Variable [ Name=chapter_name ]
+        Variable [ Name=$chapter_name ]
       )
       (
         LiteralExpr [STRING] [escount]
         :
         FunctionCall null.count@1[
-          Variable [ Name=es ]
+          (
+            SELECT ELEMENT [
+            FieldAccessor [
+              Variable [ Name=#3 ]
+              Field=es
+            ]
+            ]
+            FROM [              Variable [ Name=#1 ]
+              AS
+              Variable [ Name=#3 ]
+            ]
+          )
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=es ]
+    FROM [      Variable [ Name=$es ]
       AS
-      Variable [ Name=e ]
+      Variable [ Name=$e ]
     ]
     Groupby
-      Variable [ Name=chapter_name ]
+      Variable [ Name=$chapter_name ]
       :=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=e ]
+          Variable [ Name=$e ]
           Field=sponsor
         ]
         Field=chapter_name
       ]
-      With
-      Variable [ Name=e ]
-      Variable [ Name=sig_sponsorship_count ]
-      Variable [ Name=sponsor ]
-      Variable [ Name=event ]
-      Variable [ Name=es ]
-      Variable [ Name=sig_name ]
+      GROUP AS
+      Variable [ Name=#4 ]
+      (
+      Variable [ Name=$e ]
+       AS e
+      Variable [ Name=$sig_sponsorship_count ]
+       AS sig_sponsorship_count
+      Variable [ Name=$es ]
+       AS es
+      Variable [ Name=$event ]
+       AS event
+      Variable [ Name=$sponsor ]
+       AS sponsor
+      Variable [ Name=$sig_name ]
+       AS sig_name
+      Variable [ Name=#1 ]
+       AS #1
+      )
 
   )
 Orderby
-  Variable [ Name=sig_sponsorship_count ]
+  Variable [ Name=$sig_sponsorship_count ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFor.ast
index 518d51b..d94617e 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFor.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFor.ast
@@ -5,7 +5,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -13,7 +13,7 @@
     LiteralExpr [STRING] [movie]
     :
     FieldAccessor [
-      Variable [ Name=mv ]
+      Variable [ Name=$mv ]
       Field=movie
     ]
   )
@@ -23,32 +23,32 @@
     LiteralExpr [STRING] [User]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Movie]
   ]
   AS
-  Variable [ Name=mv ]
+  Variable [ Name=$mv ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=i ]
+    [Variable [ Name=$i ]
     In
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=movie
         ]
         =
         FieldAccessor [
-          Variable [ Name=mv ]
+          Variable [ Name=$mv ]
           Field=movie
         ]
       ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/numberInFieldAccessor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/numberInFieldAccessor.ast
index 6a681a0..c9ad9d6 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/numberInFieldAccessor.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/numberInFieldAccessor.ast
@@ -5,7 +5,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -13,7 +13,7 @@
     LiteralExpr [STRING] [movie]
     :
     FieldAccessor [
-      Variable [ Name=mv ]
+      Variable [ Name=$mv ]
       Field=movie
     ]
   )
@@ -23,33 +23,33 @@
     LiteralExpr [STRING] [User]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Movie]
   ]
   AS
-  Variable [ Name=mv ]
+  Variable [ Name=$mv ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=i ]
+    [Variable [ Name=$i ]
     In
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=movie
         ]
         =
         IndexAccessor [
           FieldAccessor [
-            Variable [ Name=mv ]
+            Variable [ Name=$mv ]
             Field=movie
           ]
           Index:           LiteralExpr [LONG] [2]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast
index 6622fe1..3049374 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 value
 ]
 FROM [  OrderedListConstructor [
@@ -11,11 +11,11 @@
     LiteralExpr [LONG] [10]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     =
     LiteralExpr [LONG] [10]
   ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast
index bb0c8b5..b978b56 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [10]
@@ -10,11 +10,11 @@
     LiteralExpr [LONG] [10]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     =
     LiteralExpr [LONG] [10]
   ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast
index ef69119..fdc8591 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast
@@ -1,27 +1,27 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall null.foo1@0[
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 UNION ALL 
   SELECT ELEMENT [
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
   ]
   FROM [    FunctionCall null.foo2@0[
     ]
     AS
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
   ]
 UNION ALL 
   SELECT ELEMENT [
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
   ]
   FROM [    FunctionCall null.foo3@0[
     ]
     AS
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
   ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast
index 330ebef..698f469 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast
@@ -1,14 +1,14 @@
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   LiteralExpr [LONG] [1]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   LiteralExpr [LONG] [1]
 SELECT ELEMENT [
 OperatorExpr [
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
   -
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast
index 57c1c2c..7a32a1f 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
   Field=reading
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [sensors]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=reading
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/queries/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.aql
index 4ebf65d..cc15b41 100644
--- a/asterix-app/src/test/resources/runtimets/queries/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.aql
@@ -23,11 +23,12 @@
 where $l.l_partkey = $p.p_partkey
   and $l.l_shipdate >= '1995-09-01'
   and $l.l_shipdate < '1995-10-01'
-group by $t:=1 keeping $l, $p
+let $lp := {'p_type': $p.p_type, 'l_extendedprice': $l.l_extendedprice, 'l_discount': $l.l_discount}
+group by $t:=1 keeping $lp
 select 100.00 * sum(
-  from $i in $l
+  from $i in $lp
   select switch-case(like($i.p_type, 'PROMO%'),
                      true, $i.l_extendedprice*(1-$i.l_discount),
                      false, 0.0)
-  ) / sum(from $i in $l select $i.l_extendedprice * (1 - $i.l_discount)
+  ) / sum(from $i in $lp select $i.l_extendedprice * (1 - $i.l_discount)
 )
diff --git a/asterix-app/src/test/resources/runtimets/queries/tpch/q14_promotion_effect/q14_promotion_effect.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/tpch/q14_promotion_effect/q14_promotion_effect.3.query.aql
index e421d4a..c7fb01c 100644
--- a/asterix-app/src/test/resources/runtimets/queries/tpch/q14_promotion_effect/q14_promotion_effect.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/tpch/q14_promotion_effect/q14_promotion_effect.3.query.aql
@@ -23,11 +23,12 @@
 where $l.l_partkey = $p.p_partkey
   and $l.l_shipdate >= '1995-09-01'
   and $l.l_shipdate < '1995-10-01'
-group by $t:=1 with $l, $p
+let $lp := {'p_type': $p.p_type, 'l_extendedprice': $l.l_extendedprice, 'l_discount': $l.l_discount}
+group by $t:=1 with $lp
 return 100.00 * sum(
-  for $i in $l
+  for $i in $lp
   return switch-case(like($i.p_type, 'PROMO%'),
                      true, $i.l_extendedprice*(1-$i.l_discount),
                      false, 0.0)
-  ) / sum(for $i in $l return $i.l_extendedprice * (1 - $i.l_discount)
+  ) / sum(for $i in $lp return $i.l_extendedprice * (1 - $i.l_discount)
 )
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.1.ddl.sqlpp
new file mode 100644
index 0000000..bbccf8c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.1.ddl.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmpType AS {
+  name : string
+}
+
+CREATE TABLE Employee(EmpType) PRIMARY KEY name;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.2.update.sqlpp
new file mode 100644
index 0000000..99116f6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.2.update.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+  [
+   { 'name': 'Bill',
+     'deptno': 'K55',
+     'salary': 2000 },
+
+   { 'name': 'Fred',
+     'deptno': 'K55',
+     'salary': 3000 }
+  ]
+);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp
new file mode 100644
index 0000000..3e16b8c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+
+FROM Employee e
+GROUP BY e.deptno AS deptno GROUP AS g(e AS e)
+SELECT ELEMENT {
+  'deptno': deptno,
+  'avgpay': avg( (FROM g AS i SELECT ELEMENT i.e.salary) ),
+  'workers': (FROM g AS i SELECT ELEMENT  {'name': i.e.name, 'salary': i.e.salary})
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.1.ddl.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.2.update.sqlpp
new file mode 100644
index 0000000..19f0c1f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.2.update.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   }
+);
+
+INSERT INTO Incentive (
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  }
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp
new file mode 100644
index 0000000..f2ce8b7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM Employee e
+    JOIN Incentive i ON e.job_category = i.job_category
+    JOIN SuperStars s ON e.id = s.id
+GROUP BY e.department_id AS deptId
+GROUP AS eis(e AS e, i AS i, s AS s)
+SELECT ELEMENT {
+      'deptId': deptId,
+      'star_cost': sum( (FROM eis AS p SELECT ELEMENT p.e.salary + p.i.bonus) )
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.1.ddl.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.2.update.sqlpp
new file mode 100644
index 0000000..19f0c1f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.2.update.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   }
+);
+
+INSERT INTO Incentive (
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  }
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp
new file mode 100644
index 0000000..d0ac45b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM Employee e
+    JOIN Incentive i ON e.job_category = i.job_category
+    JOIN SuperStars s ON e.id = s.id
+GROUP BY e.department_id AS deptId
+GROUP AS eis(e AS e, i AS i, s AS s)
+SELECT ELEMENT {
+      'deptId': deptId,
+      'avgpay': avg( (FROM eis AS g SELECT ELEMENT g.e.salary + g.i.bonus) ),
+      'topstar_details':
+           (
+                FROM eis AS g
+                SELECT ELEMENT {
+                    'id': g.e.id,
+                    'salary': g.e.salary,
+                    'bonus': g.i.bonus
+                }
+                ORDER BY g.i.bonus DESC LIMIT 3
+           )
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.1.ddl.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.2.update.sqlpp
new file mode 100644
index 0000000..52443b5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.2.update.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+  [
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   },
+   {
+    'id': '234',
+    'job_category': 'Teach',
+    'salary': 2500,
+    'department_id': 'K54'
+   }
+  ]
+);
+
+INSERT INTO Incentive (
+ [
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  },
+  { 'job_category': 'Teach',
+    'bonus': 2000
+  }
+ ]
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.3.query.sqlpp
new file mode 100644
index 0000000..46c8644
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.3.query.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM  Employee e, Incentive i
+WHERE e.job_category = i.job_category
+GROUP BY e.department_id AS deptId
+GROUP AS ei(e AS e2, i AS i2)
+SELECT ELEMENT {
+    'deptId': deptId,
+    'job_category_details':
+         (  FROM ei AS g
+            SELECT ELEMENT {
+                'category': g.i2.job_category,
+                'bonus': g.i2.bonus
+            }
+            ORDER BY g.i2.bonus DESC LIMIT 3
+          )
+      }
+ORDER BY deptId DESC;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.1.ddl.sqlpp
new file mode 100644
index 0000000..2030780
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.1.ddl.sqlpp
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE CarType AS {
+  cid : string
+}
+
+CREATE TYPE TireType AS {
+  tid: string
+}
+
+CREATE TABLE Car(CarType) PRIMARY KEY cid;
+CREATE TABLE Tire(TireType) PRIMARY KEY tid;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.2.update.sqlpp
new file mode 100644
index 0000000..275e4fc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.2.update.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Car (
+  [
+   {
+    'cid': '1',
+    'make': 'Honda',
+    'model': 'Civic',
+    'price': 28000,
+    'tire_size': 'P205/55R16'
+   },
+   {
+    'cid': '2',
+    'make': 'Toyota',
+    'model': 'Corolla',
+    'price': 27000,
+    'tire_size': 'P205/55R16'
+   }
+  ]
+);
+
+INSERT INTO Tire (
+ [
+   {
+        'tid': '1',
+        'mfr': 'Bridgestone',
+        'brand': 'Turanza',
+        'size': 'P205/55R16',
+        'price': 150
+    },
+    {
+        'tid': '2',
+        'mfr': 'Goodyear',
+        'brand': 'Eagle',
+        'size': 'P205/55R16',
+        'price': 100
+    }
+ ]
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp
new file mode 100644
index 0000000..11c6c6f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+SELECT ELEMENT {
+        'Vehicle prices including 4 tires':
+        (   FROM Car c JOIN Tire t ON c.tire_size = t.size
+            GROUP BY c.tire_size AS tire_size GROUP AS g(c AS c, t AS t)
+            SELECT ELEMENT {
+                'tire_size': tire_size,
+                'avg_total_price': avg(
+                                         (  FROM g AS g
+                                            SELECT ELEMENT g.c.price + 4 * g.t.price
+                                          )
+                                       ),
+                'combinations':
+                            ( FROM g AS g
+                              SELECT ELEMENT {
+                                    'make': g.c.make,
+                                    'model': g.c.model,
+                                    'mfr': g.t.mfr,
+                                    'brand': g.t.brand,
+                                    'price': g.c.price + 4 * g.t.price
+                               }
+                               ORDER BY g.c.make, g.c.model, g.t.mfr, g.t.brand
+                            )
+              }
+        )
+    };
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.1.ddl.sqlpp
new file mode 100644
index 0000000..bbccf8c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.1.ddl.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmpType AS {
+  name : string
+}
+
+CREATE TABLE Employee(EmpType) PRIMARY KEY name;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.2.update.sqlpp
new file mode 100644
index 0000000..99116f6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.2.update.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+  [
+   { 'name': 'Bill',
+     'deptno': 'K55',
+     'salary': 2000 },
+
+   { 'name': 'Fred',
+     'deptno': 'K55',
+     'salary': 3000 }
+  ]
+);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
new file mode 100644
index 0000000..79758e3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+
+FROM Employee e
+GROUP BY e.deptno AS deptno GROUP AS g
+SELECT deptno AS deptno, avg(e.salary) AS avgpay,
+       (SELECT i.e.name AS name, i.e.salary AS salary FROM g AS i) AS workers;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.1.ddl.sqlpp
new file mode 100644
index 0000000..b4ebc49
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.1.ddl.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.2.update.sqlpp
new file mode 100644
index 0000000..e6545e0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.2.update.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+USE gby;
+
+INSERT INTO Employee (
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   }
+);
+
+INSERT INTO Incentive (
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  }
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp
new file mode 100644
index 0000000..b488a32
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM Employee e
+    JOIN Incentive i ON e.job_category = i.job_category
+    JOIN SuperStars s ON e.id = s.id
+GROUP BY e.department_id AS deptId
+SELECT deptId as deptId, sum(e.salary + i.bonus) AS star_cost;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.1.ddl.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.2.update.sqlpp
new file mode 100644
index 0000000..19f0c1f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.2.update.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   }
+);
+
+INSERT INTO Incentive (
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  }
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
new file mode 100644
index 0000000..49dd2c0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM Employee e
+    JOIN Incentive i ON e.job_category = i.job_category
+    JOIN SuperStars s ON e.id = s.id
+GROUP BY e.department_id AS deptId GROUP AS eis
+SELECT deptId as deptId,
+    avg(e.salary + i.bonus) AS avgpay,
+    (FROM eis AS v
+         SELECT v.e.id AS id, v.e.salary AS salary, v.i.bonus AS bonus
+         ORDER BY v.i.bonus DESC LIMIT 3
+    ) AS topstar_details
+    ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.1.ddl.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.2.update.sqlpp
new file mode 100644
index 0000000..52443b5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.2.update.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+  [
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   },
+   {
+    'id': '234',
+    'job_category': 'Teach',
+    'salary': 2500,
+    'department_id': 'K54'
+   }
+  ]
+);
+
+INSERT INTO Incentive (
+ [
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  },
+  { 'job_category': 'Teach',
+    'bonus': 2000
+  }
+ ]
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.3.query.sqlpp
new file mode 100644
index 0000000..d8fb8c9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.3.query.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM  Employee e, Incentive i
+WHERE e.job_category = i.job_category
+GROUP BY e.department_id AS deptId
+SELECT deptId AS deptId,
+     (  FROM i AS i
+        SELECT i.job_category AS category, i.bonus AS bonus
+        ORDER BY i.bonus DESC LIMIT 3
+      ) AS job_category_details
+ORDER BY deptId DESC;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.1.ddl.sqlpp
new file mode 100644
index 0000000..2030780
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.1.ddl.sqlpp
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE CarType AS {
+  cid : string
+}
+
+CREATE TYPE TireType AS {
+  tid: string
+}
+
+CREATE TABLE Car(CarType) PRIMARY KEY cid;
+CREATE TABLE Tire(TireType) PRIMARY KEY tid;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.2.update.sqlpp
new file mode 100644
index 0000000..275e4fc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.2.update.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Car (
+  [
+   {
+    'cid': '1',
+    'make': 'Honda',
+    'model': 'Civic',
+    'price': 28000,
+    'tire_size': 'P205/55R16'
+   },
+   {
+    'cid': '2',
+    'make': 'Toyota',
+    'model': 'Corolla',
+    'price': 27000,
+    'tire_size': 'P205/55R16'
+   }
+  ]
+);
+
+INSERT INTO Tire (
+ [
+   {
+        'tid': '1',
+        'mfr': 'Bridgestone',
+        'brand': 'Turanza',
+        'size': 'P205/55R16',
+        'price': 150
+    },
+    {
+        'tid': '2',
+        'mfr': 'Goodyear',
+        'brand': 'Eagle',
+        'size': 'P205/55R16',
+        'price': 100
+    }
+ ]
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
new file mode 100644
index 0000000..1a7a2bf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+SELECT ELEMENT {
+        'Vehicle prices including 4 tires':
+        (
+            FROM Car c JOIN Tire t ON c.tire_size = t.size
+            GROUP BY c.tire_size AS tire_size GROUP AS g
+            SELECT tire_size AS tire_size,
+                   avg(c.price + 4 * t.price) AS avg_total_price,
+                   ( FROM g AS g
+                     SELECT g.c.make AS make,
+                            g.c.model AS model,
+                            g.t.mfr AS mfr,
+                            g.t.brand AS brand,
+                            g.c.price + 4 * g.t.price AS price
+                     ORDER BY g.c.make, g.c.model, g.t.mfr, g.t.brand
+                   ) AS combinations
+        )
+    };
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 559dfc8..a8f29d3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -22,13 +22,14 @@
 
 select element (100.0 * tpch.sum((
       select element tpch."switch-case"(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
-      from  l as i
+      from  lp as i
   )) / tpch.sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
-      from  l as i
+      from  lp as i
   )))
 from  LineItem as l,
       Part as p
+let lp = {'p_type': p.p_type, 'l_extendedprice': l.l_extendedprice, 'l_discount': l.l_discount}
 where ((l.l_partkey = p.p_partkey) and (l.l_shipdate >= '1995-09-01') and (l.l_shipdate < '1995-10-01'))
 group by 1 as t
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.1.ddl.sqlpp
new file mode 100644
index 0000000..c5fcd3f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.1.ddl.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : double,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.2.update.sqlpp
new file mode 100644
index 0000000..ffd9143
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.3.query.sqlpp
new file mode 100644
index 0000000..843afa0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+SELECT DISTINCT
+       l.l_returnflag AS l_returnflag,
+       l.l_linestatus AS l_linestatus,
+       l.l_shipmode AS l_shipmode
+FROM  LineItem AS l
+ORDER BY l.l_returnflag,l.l_linestatus,l.l_shipmode
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.1.ddl.sqlpp
new file mode 100644
index 0000000..581b684
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.1.ddl.sqlpp
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Regions_group_no_agg(RegionType) primary key r_regionkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.2.update.sqlpp
new file mode 100644
index 0000000..a012a5b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table Regions_group_no_agg using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.3.query.sqlpp
new file mode 100644
index 0000000..b1e5a5b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.3.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+SELECT VALUE name
+FROM  Regions_group_no_agg AS r
+GROUP BY r.r_name AS name
+ORDER BY name
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.1.ddl.sqlpp
new file mode 100644
index 0000000..3b070de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.1.ddl.sqlpp
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.2.update.sqlpp
new file mode 100644
index 0000000..8e61b76
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+use tpch;
+
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using localfs (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.3.query.sqlpp
new file mode 100644
index 0000000..a4396d7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.3.query.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+USE tpch;
+
+
+SELECT  nation.n_nationkey AS nation_key,
+        nation.n_name AS name,
+        (
+            SELECT orderdate AS order_date, sum(orders.o_totalprice) AS sum_price
+            FROM  Orders AS orders,
+                  Customer AS customer
+            WHERE orders.o_custkey = customer.c_custkey AND customer.c_nationkey = nation.n_nationkey
+            GROUP BY orders.o_orderdate AS orderdate
+            ORDER BY sum_price
+            LIMIT 3
+        ) AS aggregates
+FROM  Nation AS nation,
+      SelectedNation AS sn
+WHERE nation.n_nationkey /*+ indexnl */ = sn.n_nationkey
+ORDER BY nation.n_nationkey
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp
new file mode 100644
index 0000000..3b070de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.2.update.sqlpp
new file mode 100644
index 0000000..8e61b76
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+use tpch;
+
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using localfs (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.3.query.sqlpp
new file mode 100644
index 0000000..2264407
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.3.query.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+USE tpch;
+
+
+
+SELECT  nation.n_nationkey AS nation_key,
+        nation.n_name AS name,
+        (
+            SELECT ELEMENT orderdate
+            FROM  Orders AS orders,
+                  Customer AS customer
+            WHERE orders.o_custkey = customer.c_custkey AND customer.c_nationkey = nation.n_nationkey
+            GROUP BY orders.o_orderdate AS orderdate
+            ORDER BY sum(orders.o_totalprice)
+            LIMIT 3
+        ) AS aggregates
+from  Nation as nation,
+      SelectedNation as sn
+where (nation.n_nationkey /*+ indexnl */ = sn.n_nationkey)
+order by nation.n_nationkey
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp
new file mode 100644
index 0000000..8649a3b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : double,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.2.update.sqlpp
new file mode 100644
index 0000000..ffd9143
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
new file mode 100644
index 0000000..c9e742d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+SELECT  l_returnflag AS l_returnflag,
+        l_linestatus AS l_linestatus,
+        sum(l.l_quantity) AS sum_qty,
+        sum(l.l_extendedprice) AS sum_base_price,
+        sum(l.l_extendedprice * (1 - l.l_discount)) AS sum_disc_price,
+        sum(l.l_extendedprice * (1 - l.l_discount) * (1 + l.l_tax)) AS sum_charge,
+        avg(l.l_quantity) AS ave_qty,
+        avg(l.l_extendedprice) AS ave_price,
+        avg(l.l_discount) AS ave_disc,
+        count(l) AS count_order
+FROM  LineItem AS l
+WHERE l.l_shipdate <= '1998-09-02'
+/* +hash */
+GROUP BY l.l_returnflag AS l_returnflag, l.l_linestatus AS l_linestatus
+ORDER BY l_returnflag, l_linestatus
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
new file mode 100644
index 0000000..636fb04
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+WITH q2_minimum_cost_supplier_tmp1 AS
+(select
+  s.s_acctbal AS s_acctbal,
+  s.s_name AS s_name,
+  n.n_name AS n_name,
+  p.p_partkey AS p_partkey,
+  ps.ps_supplycost AS ps_supplycost,
+  p.p_mfgr AS p_mfgr,
+  s.s_address AS s_address,
+  s.s_phone AS s_phone,
+  s.s_comment AS s_comment
+FROM
+  Nation n JOIN Region r
+  ON n.n_regionkey = r.r_regionkey and r.r_name = 'EUROPE'
+  JOIN Supplier s
+  ON s.s_nationkey = n.n_nationkey
+  JOIN Partsupp ps
+  ON s.s_suppkey = ps.ps_suppkey
+  JOIN Part p
+  ON p.p_partkey = ps.ps_partkey AND like(p.p_type, '%BRASS')
+),
+q2_minimum_cost_supplier_tmp2 AS
+(SELECT
+  p_partkey AS p_partkey, min(p.ps_supplycost) AS ps_min_supplycost
+ FROM
+  q2_minimum_cost_supplier_tmp1 p
+ GROUP BY p.p_partkey AS p_partkey
+)
+
+SELECT
+  t1.s_acctbal AS s_acctbal,
+  t1.s_name AS s_name,
+  t1.n_name AS n_name,
+  t1.p_partkey AS p_partkey,
+  t1.p_mfgr AS p_mfgr,
+  t1.s_address AS s_address,
+  t1.s_phone AS s_phone,
+  t1.s_comment AS s_comment
+FROM
+  q2_minimum_cost_supplier_tmp1 t1 JOIN q2_minimum_cost_supplier_tmp2 t2
+ON
+  t1.p_partkey = t2.p_partkey AND t1.ps_supplycost=t2.ps_min_supplycost
+ORDER BY t1.s_acctbal DESC, t1.n_name, t1.s_name, t1.p_partkey
+LIMIT 100;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.2.update.sqlpp
new file mode 100644
index 0000000..07983f0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.2.update.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
new file mode 100644
index 0000000..5e65cb7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+SELECT l_orderkey AS l_orderkey,
+       sum(l.l_extendedprice * (1 - l.l_discount)) AS revenue,
+       o_orderdate AS o_orderdate,
+       o_shippriority AS o_shippriority
+FROM  Customer AS c,
+      Orders AS o,
+      LineItem AS l
+where c.c_mktsegment = 'BUILDING' AND c.c_custkey = o.o_custkey AND l.l_orderkey = o.o_orderkey AND o.o_orderdate < '1995-03-15' AND l.l_shipdate > '1995-03-15'
+/* +hash */
+GROUP BY l.l_orderkey AS l_orderkey,
+         o.o_orderdate AS o_orderdate,
+         o.o_shippriority AS o_shippriority
+ORDER BY revenue DESC,o_orderdate
+LIMIT 10
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.3.query.sqlpp
new file mode 100644
index 0000000..41b94e0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.3.query.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+WITH tmp AS
+(
+    SELECT DISTINCT l.l_orderkey AS o_orderkey
+    FROM  LineItem AS l
+    WHERE l.l_commitdate < l.l_receiptdate
+)
+
+SELECT o_orderpriority AS order_priority,
+       count(o) AS count
+FROM Orders AS o
+JOIN tmp AS t
+ON o.o_orderkey = t.o_orderkey
+WHERE o.o_orderdate >= '1993-07-01' AND o.o_orderdate < '1993-10-01'
+GROUP BY o.o_orderpriority AS o_orderpriority
+ORDER BY o_orderpriority
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
new file mode 100644
index 0000000..7f84ccb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+SELECT  n_name AS n_name,
+        sum(o1.l_extendedprice * (1 - o1.l_discount)) AS revenue
+FROM
+  Customer c JOIN
+    ( SELECT l1.n_name AS n_name,
+             l1.l_extendedprice AS l_extendedprice,
+             l1.l_discount AS l_discount,
+             l1.s_nationkey AS s_nationkey,
+             o.o_custkey AS o_custkey
+      FROM Orders o JOIN
+      ( SELECT s1.n_name AS n_name,
+               l.l_extendedprice AS l_extendedprice,
+               l.l_discount AS l_discount,
+               l.l_orderkey AS l_orderkey,
+               s1.s_nationkey AS s_nationkey
+        FROM LineItem l JOIN
+            (   SELECT  n1.n_name AS n_name,
+                        s.s_suppkey AS s_suppkey,
+                        s.s_nationkey AS s_nationkey
+                FROM Supplier s JOIN
+                (   SELECT n.n_name AS n_name, n.n_nationkey AS n_nationkey
+                    FROM Nation n JOIN Region r
+                    ON n.n_regionkey = r.r_regionkey
+                ) n1 ON s.s_nationkey = n1.n_nationkey
+            ) s1
+        ON l.l_suppkey = s1.s_suppkey
+      ) l1 ON l1.l_orderkey = o.o_orderkey AND o.o_orderdate >= '1990-01-01'
+              AND o.o_orderdate < '1995-01-01'
+   ) o1
+ON c.c_nationkey = o1.s_nationkey AND c.c_custkey = o1.o_custkey
+GROUP BY o1.n_name AS n_name
+ORDER BY revenue DESC;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
new file mode 100644
index 0000000..ba4f3e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+{'revenue':sum(
+      (
+        SELECT ELEMENT l.l_extendedprice * l.l_discount
+        FROM  LineItem AS l
+        WHERE l.l_shipdate >= '1994-01-01'
+              and l.l_shipdate < '1995-01-01'
+              and l.l_discount >= 0.05
+              and l.l_discount <= 0.07
+              and l.l_quantity < 24
+      )
+    )
+};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
new file mode 100644
index 0000000..3ba3da8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function q7_volume_shipping_tmp() {
+(
+    SELECT n1.n_name AS supp_nation,
+           n2.n_name AS cust_nation,
+           n1.n_nationkey AS s_nationkey,
+           n2.n_nationkey AS c_nationkey
+    from  Nation as n1,
+          Nation as n2
+    where n2.n_name = 'GERMANY' or n1.n_name = 'GERMANY'
+)
+}
+
+SELECT supp_nation AS supp_nation,
+       cust_nation AS cust_nation,
+       l_year AS l_year,
+       sum(shipping.volume) AS revenue
+FROM
+  (
+    SELECT
+      t.supp_nation AS supp_nation,
+      t.cust_nation AS cust_nation,
+      "get-year"(l3.l_shipdate) AS l_year,
+      l3.l_extendedprice * (1 - l3.l_discount) AS volume
+    FROM
+      q7_volume_shipping_tmp() AS t JOIN
+        (SELECT l2.l_shipdate AS l_shipdate,
+                l2.l_extendedprice AS l_extendedprice,
+                l2.l_discount AS l_discount,
+                l2.c_nationkey AS c_nationkey,
+                s.s_nationkey AS s_nationkey
+         FROM Supplier s JOIN
+           (SELECT l1.l_shipdate AS l_shipdate,
+                   l1.l_extendedprice AS l_extendedprice,
+                   l1.l_discount AS l_discount,
+                   l1.l_suppkey AS l_suppkey,
+                   c.c_nationkey AS c_nationkey
+            FROM Customer c JOIN
+              (SELECT l.l_shipdate AS l_shipdate,
+                      l.l_extendedprice AS l_extendedprice,
+                      l.l_discount AS l_discount,
+                      l.l_suppkey AS l_suppkey,
+                      o.o_custkey AS o_custkey
+               FROM Orders o JOIN LineItem l
+               ON o.o_orderkey = l.l_orderkey AND l.l_shipdate >= '1992-01-01'
+                  AND l.l_shipdate <= '1996-12-31'
+               ) l1 ON c.c_custkey = l1.o_custkey
+            ) l2 ON s.s_suppkey = l2.l_suppkey
+         ) l3 ON l3.c_nationkey = t.c_nationkey AND l3.s_nationkey = t.s_nationkey
+   ) shipping
+GROUP BY shipping.supp_nation AS supp_nation,
+         shipping.cust_nation AS cust_nation,
+         shipping.l_year AS l_year
+ORDER BY supp_nation, cust_nation, l_year;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp
new file mode 100644
index 0000000..2d48b57
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+SELECT  year AS year,
+        sum( "switch-case"(t.s_name = 'BRAZIL', true, t.revenue, false, 0.0) )
+        / sum(t.revenue) AS mkt_share
+FROM  (
+        SELECT o_year AS year,
+               (slnrcop.l_extendedprice * (1 - slnrcop.l_discount)) AS revenue,
+               n2.n_name AS s_name
+        FROM  (
+                SELECT lnrcop.o_orderdate AS o_orderdate,
+                       lnrcop.l_discount AS l_discount,
+                       lnrcop.l_extendedprice AS l_extendedprice,
+                       lnrcop.l_suppkey AS l_suppkey,
+                       s.s_nationkey AS s_nationkey
+                FROM  Supplier AS s,
+                (
+                  SELECT lnrco.o_orderdate AS o_orderdate,
+                         lnrco.l_discount AS l_discount,
+                         lnrco.l_extendedprice AS l_extendedprice,
+                         lnrco.l_suppkey AS l_suppkey
+                  FROM  (
+                         SELECT nrco.o_orderdate AS o_orderdate,
+                                l.l_partkey AS l_partkey,
+                                l.l_discount AS l_discount,
+                                l.l_extendedprice AS l_extendedprice,
+                                l.l_suppkey AS l_suppkey
+                         FROM  LineItem AS l,
+                               (
+                                SELECT o.o_orderdate AS o_orderdate, o.o_orderkey AS o_orderkey
+                                FROM  Orders AS o,
+                                      (
+                                        SELECT c.c_custkey AS c_custkey
+                                        FROM  Customer AS c,
+                                              (
+                                                SELECT n1.n_nationkey AS n_nationkey
+                                                FROM  Nation AS n1,
+                                                Region AS r1
+                                                WHERE n1.n_regionkey = r1.r_regionkey AND r1.r_name = 'AMERICA'
+                                                ) AS nr
+                                         WHERE (c.c_nationkey = nr.n_nationkey)
+                                       ) AS nrc
+                                WHERE (nrc.c_custkey = o.o_custkey)
+                                ) AS nrco
+                        WHERE l.l_orderkey = nrco.o_orderkey and nrco.o_orderdate >= '1995-01-01' and nrco.o_orderdate < '1996-12-31'
+                        ) AS lnrco,
+                        Part AS p
+                        WHERE p.p_partkey = lnrco.l_partkey and p.p_type = 'ECONOMY ANODIZED STEEL'
+                    ) AS lnrcop
+                WHERE (s.s_suppkey = lnrcop.l_suppkey)
+                ) AS slnrcop,
+                Nation AS n2
+                WITH  o_year AS tpch."get-year"(slnrcop.o_orderdate)
+             WHERE slnrcop.s_nationkey = n2.n_nationkey
+             ) as t
+GROUP BY t.year AS year
+ORDER BY year
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
new file mode 100644
index 0000000..2ede3c0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+SELECT nation AS nation, o_year AS o_year, sum(profit.amount) AS sum_profit
+FROM
+  (
+    SELECT   l3.n_name AS nation,
+             "get-year"(o.o_orderdate) AS o_year,
+             l3.l_extendedprice * (1 - l3.l_discount) -  l3.ps_supplycost * l3.l_quantity AS amount
+    FROM
+      Orders o JOIN
+      (
+       SELECT l2.l_extendedprice AS l_extendedprice,
+              l2.l_discount AS l_discount,
+              l2.l_quantity AS l_quantity,
+              l2.l_orderkey AS l_orderkey,
+              l2.n_name AS n_name,
+              l2.ps_supplycost AS ps_supplycost
+       FROM Part p JOIN
+         (SELECT l1.l_extendedprice AS l_extendedprice,
+                 l1.l_discount AS l_discount,
+                 l1.l_quantity AS l_quantity,
+                 l1.l_partkey AS l_partkey,
+                 l1.l_orderkey AS l_orderkey,
+                 l1.n_name AS n_name,
+                 ps.ps_supplycost AS ps_supplycost
+          FROM Partsupp ps join
+            (SELECT l.l_suppkey AS l_suppkey,
+                    l.l_extendedprice AS l_extendedprice,
+                    l.l_discount AS l_discount,
+                    l.l_quantity AS l_quantity,
+                    l.l_partkey AS l_partkey,
+                    l.l_orderkey AS l_orderkey,
+                    s1.n_name AS n_name
+             FROM
+               (SELECT s.s_suppkey AS s_suppkey, n.n_name AS n_name
+                FROM Nation n join Supplier s on n.n_nationkey = s.s_nationkey
+               ) s1 JOIN LineItem l ON s1.s_suppkey = l.l_suppkey
+            ) l1 ON ((ps.ps_suppkey = l1.l_suppkey) and (ps.ps_partkey = l1.l_partkey))
+         ) l2 ON contains(p.p_name,'green') AND p.p_partkey = l2.l_partkey
+     ) l3 ON o.o_orderkey = l3.l_orderkey
+  ) profit
+GROUP BY profit.nation AS nation, profit.o_year AS o_year
+ORDER BY nation, o_year desc;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.2.update.sqlpp
new file mode 100644
index 0000000..ed34b74
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.3.query.sqlpp
new file mode 100644
index 0000000..286a593
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.3.query.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+SELECT c_custkey AS c_custkey,
+       c_name AS c_name,
+       sum(locn.l_extendedprice * (1 - locn.l_discount)) AS revenue,
+       c_acctbal AS c_acctbal,
+       n_name AS n_name,
+       c_address AS c_address,
+       c_phone AS c_phone,
+       c_comment AS c_comment
+FROM  (
+        SELECT ocn.c_custkey AS c_custkey,
+               ocn.c_name AS c_name,
+               ocn.c_acctbal AS c_acctbal,
+               ocn.n_name AS n_name,
+               ocn.c_address AS c_address,
+               ocn.c_phone AS c_phone,
+               ocn.c_comment AS c_comment,
+               l.l_extendedprice AS l_extendedprice,
+               l.l_discount AS l_discount
+        FROM  LineItem AS l,
+          (
+            SELECT  c.c_custkey AS c_custkey,
+                    c.c_name AS c_name,
+                    c.c_acctbal AS c_acctbal,
+                    n.n_name AS n_name,
+                    c.c_address AS c_address,
+                    c.c_phone AS c_phone,
+                    c.c_comment AS c_comment,
+                    o.o_orderkey AS o_orderkey
+            from  Orders as o,
+                  Customer as c,
+                  Nation as n
+            WHERE c.c_custkey = o.o_custkey AND o.o_orderdate >= '1993-10-01'
+                  AND o.o_orderdate < '1994-01-01' AND c.c_nationkey = n.n_nationkey
+          ) AS ocn
+        WHERE l.l_orderkey = ocn.o_orderkey and l.l_returnflag = 'R'
+      ) AS locn
+GROUP BY locn.c_custkey AS c_custkey,
+         locn.c_name AS c_name,
+         locn.c_acctbal AS c_acctbal,
+         locn.c_phone AS c_phone,
+         locn.n_name AS n_name,
+         locn.c_address AS c_address,
+         locn.c_comment AS c_comment
+ORDER BY revenue DESC
+LIMIT 20
+;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
new file mode 100644
index 0000000..fd24025
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+USE tpch;
+
+
+SELECT c_custkey AS c_custkey,
+       c_name AS c_name,
+       sum(locn.l_extendedprice * (1 - locn.l_discount)) AS revenue,
+       c_acctbal AS c_acctbal,
+       n_name AS n_name,
+       c_address AS c_address,
+       c_phone AS c_phone,
+       c_comment AS c_comment
+FROM  (
+        SELECT ocn.c_custkey AS c_custkey,
+               ocn.c_name AS c_name,
+               ocn.c_acctbal AS c_acctbal,
+               ocn.n_name AS n_name,
+               ocn.c_address AS c_address,
+               ocn.c_phone AS c_phone,
+               ocn.c_comment AS c_comment,
+               l.l_extendedprice AS l_extendedprice,
+               l.l_discount AS l_discount
+        FROM  LineItem AS l,
+          (
+            SELECT  c.c_custkey AS c_custkey,
+                    c.c_name AS c_name,
+                    c.c_acctbal AS c_acctbal,
+                    n.n_name AS n_name,
+                    c.c_address AS c_address,
+                    c.c_phone AS c_phone,
+                    c.c_comment AS c_comment,
+                    o.o_orderkey AS o_orderkey
+            from  Orders as o,
+                  Customer as c,
+                  Nation as n
+            WHERE c.c_custkey = o.o_custkey AND o.o_orderdate >= '1993-10-01'
+                  AND o.o_orderdate < '1994-01-01' AND c.c_nationkey = n.n_nationkey
+          ) AS ocn
+        WHERE l.l_orderkey = ocn.o_orderkey and l.l_returnflag = 'R'
+      ) AS locn
+GROUP BY locn.c_custkey AS c_custkey,
+         locn.c_name AS c_name,
+         locn.c_acctbal AS c_acctbal,
+         locn.c_phone AS c_phone,
+         locn.n_name AS n_name,
+         locn.c_address AS c_address,
+         locn.c_comment AS c_comment
+ORDER BY revenue DESC
+LIMIT 20
+;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.3.query.sqlpp
new file mode 100644
index 0000000..0e84e68
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.3.query.sqlpp
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+WITH sum as sum(
+     (
+      SELECT ELEMENT ps.ps_supplycost * ps.ps_availqty
+      FROM  Partsupp AS ps,
+            (
+                SELECT s.s_suppkey s_suppkey
+                FROM  Supplier as s,
+                      Nation as n
+                WHERE s.s_nationkey = n.n_nationkey
+            ) AS sn
+      WHERE ps.ps_suppkey = sn.s_suppkey
+     )
+)
+
+SELECT t1.ps_partkey AS partkey,
+       t1.part_value AS part_value
+FROM  (
+        SELECT ps_partkey AS ps_partkey,
+               tpch.sum(ps.ps_supplycost * ps.ps_availqty) AS part_value
+        FROM  Partsupp ps,
+          (
+        SELECT s.s_suppkey s_suppkey
+        FROM  Supplier AS s,
+              Nation as n
+        WHERE s.s_nationkey = n.n_nationkey
+    ) sn
+    WHERE ps.ps_suppkey = sn.s_suppkey
+    GROUP BY ps.ps_partkey AS ps_partkey
+) t1
+WHERE t1.part_value > sum * 0.00001
+ORDER BY t1.part_value DESC
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.3.query.sqlpp
new file mode 100644
index 0000000..0d63443
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.3.query.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+SELECT l_shipmode l_shipmode,
+       sum("switch-case"(o.o_orderpriority = '1-URGENT' or o.o_orderpriority = '2-HIGH',true,1,false,0)) high_line_count,
+       sum("switch-case"(o.o_orderpriority = '1-URGENT' or o.o_orderpriority = '2-HIGH',true,0,false,1)) low_line_count
+FROM  LineItem l,
+      Orders o
+WHERE o.o_orderkey = l.l_orderkey AND l.l_commitdate < l.l_receiptdate AND
+      l.l_shipdate < l.l_commitdate AND l.l_receiptdate >= '1994-01-01' AND
+      l.l_receiptdate < '1995-01-01' AND (l.l_shipmode = 'MAIL' OR l.l_shipmode = 'SHIP')
+GROUP BY l.l_shipmode as l_shipmode
+ORDER BY l_shipmode
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
new file mode 100644
index 0000000..24794de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+SELECT c_count AS c_count, count(gco) AS custdist
+FROM  (
+        SELECT c_custkey AS c_custkey, sum(co.o_orderkey_count) AS c_count
+        FROM  (
+                SELECT c.c_custkey AS c_custkey,
+                       count(
+                           (
+                            select element o.o_orderkey
+                            from  Orders as o
+                            where c.c_custkey = o.o_custkey and not(like(o.o_comment,'%special%requests%'))
+                           )
+                         ) AS o_orderkey_count
+                from  Customer c
+        ) co
+        GROUP BY co.c_custkey c_custkey
+) gco
+GROUP BY gco.c_count as c_count
+ORDER BY custdist desc,c_count DESC
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
new file mode 100644
index 0000000..db669d6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element 100.0 *
+     sum("switch-case"(like(p.p_type,'PROMO%'),true,(l.l_extendedprice * (1 - l.l_discount)),false,0.0))
+     / sum(l.l_extendedprice * (1 - l.l_discount))
+FROM  LineItem l,
+      Part p
+WHERE l.l_partkey = p.p_partkey AND l.l_shipdate >= '1995-09-01' AND l.l_shipdate < '1995-10-01'
+GROUP BY 1 AS t
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.3.query.sqlpp
new file mode 100644
index 0000000..1a036cc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.3.query.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+declare function revenue() {
+(
+    SELECT l_suppkey AS supplier_no,
+           sum(l.l_extendedprice * (1 - l.l_discount)) AS total_revenue
+    FROM  LineItem l
+    WHERE l.l_shipdate >= '1996-01-01' and l.l_shipdate < '1996-04-01'
+    GROUP BY l.l_suppkey l_suppkey
+)
+};
+
+WITH  m AS max((
+      SELECT ELEMENT r2.total_revenue
+      FROM revenue() r2
+))
+SELECT s.s_suppkey s_suppkey,
+       s.s_name s_name,
+       s.s_address s_address,
+       s.s_phone s_phone,
+       r.total_revenue total_revenue
+FROM  Supplier s,
+      revenue() r
+WHERE s.s_suppkey = r.supplier_no AND r.total_revenue < m + 0.000000001
+      AND r.total_revenue > m - 0.000000001
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
new file mode 100644
index 0000000..1d154a6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+declare function tmp() {
+(
+    SELECT psp.p_brand p_brand, psp.p_type p_type, psp.p_size p_size, psp.ps_suppkey ps_suppkey
+    FROM  (
+            SELECT p.p_brand p_brand, p.p_type p_type, p.p_size p_size, ps.ps_suppkey ps_suppkey
+            FROM  Partsupp AS ps,
+                  Part AS p
+            WHERE p.p_partkey = ps.ps_partkey AND p.p_brand != 'Brand#45' AND
+              not(tpch.like(p.p_type,'MEDIUM POLISHED%'))
+           ) AS psp,
+           Supplier AS s
+    WHERE psp.ps_suppkey = s.s_suppkey AND not(like(s.s_comment,'%Customer%Complaints%'))
+)
+};
+
+SELECT p_brand p_brand, p_type p_type, p_size p_size, count(t2.ps_suppkey) supplier_cnt
+FROM  (
+    SELECT p_brand1 p_brand, p_type1 p_type, p_size1 p_size, ps_suppkey1 ps_suppkey
+    FROM  tpch.tmp() t
+    WHERE t.p_size = 49 OR t.p_size = 14 OR t.p_size = 23 OR t.p_size = 45 OR t.p_size = 19
+          OR t.p_size = 3 OR t.p_size = 36 OR t.p_size = 9
+    GROUP BY t.p_brand as p_brand1,t.p_type as p_type1,t.p_size as p_size1,t.ps_suppkey as ps_suppkey1
+) AS t2
+GROUP BY t2.p_brand p_brand,t2.p_type p_type,t2.p_size p_size
+ORDER BY supplier_cnt DESC,p_brand,p_type,p_size
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
new file mode 100644
index 0000000..471a145
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+SELECT l_partkey t_partkey,
+       count(l) t_count,
+       0.2 * avg(l.l_quantity) t_avg_quantity,
+       max(l.l_suppkey) t_max_suppkey,
+       max(l.l_linenumber) t_max_linenumber,
+       avg(l.l_extendedprice) t_avg_extendedprice,
+       avg(l.l_discount) t_avg_discount,
+       avg(l.l_tax) t_avg_tax,
+       max(l.l_shipdate) t_max_shipdate,
+       min(l.l_commitdate) t_min_commitdate,
+       min(l.l_receiptdate) t_min_receiptdate,
+       max(l.l_comment) t_max_comment
+FROM  LineItem AS l
+GROUP BY l.l_partkey AS l_partkey
+ORDER BY l_partkey
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
new file mode 100644
index 0000000..4519fa6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+WITH tmp AS
+(
+    SELECT l_partkey t_partkey, 0.2 * avg(l.l_quantity) t_avg_quantity
+    FROM LineItem AS l
+    GROUP BY l.l_partkey AS l_partkey
+)
+
+SELECT ELEMENT sum((
+      SELECT ELEMENT l.l_extendedprice
+      FROM  tmp t,
+            LineItem l,
+            Part p
+      WHERE p.p_partkey = l.l_partkey AND p.p_container = 'MED BOX'
+            AND l.l_partkey = t.t_partkey AND l.l_quantity < t.t_avg_quantity
+  )) / 7.0;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
new file mode 100644
index 0000000..2e2a632
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+WITH tmp AS
+(
+    SELECT l_orderkey l_orderkey, sum(l.l_quantity) t_sum_quantity
+    FROM  LineItem AS l
+    GROUP BY l.l_orderkey as l_orderkey
+)
+
+SELECT c_name c_name, c_custkey c_custkey, o_orderkey o_orderkey,
+       o_orderdate o_orderdate, o_totalprice o_totalprice,
+       sum(l.l_quantity) sum_quantity
+FROM  Customer c,
+      Orders o,
+      tmp t,
+      LineItem l
+WHERE c.c_custkey = o.o_custkey AND o.o_orderkey = t.l_orderkey AND t.t_sum_quantity > 30
+      AND l.l_orderkey = t.l_orderkey
+GROUP BY c.c_name AS c_name,c.c_custkey AS c_custkey,
+         o.o_orderkey AS o_orderkey,o.o_orderdate AS o_orderdate,
+         o.o_totalprice AS o_totalprice
+ORDER BY o_totalprice DESC,o_orderdate
+LIMIT 100
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
new file mode 100644
index 0000000..558786c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+set "import-private-functions" "true";
+
+sum(
+(
+  SELECT ELEMENT l.l_extendedprice * (1 - l.l_discount)
+  FROM LineItem l
+  JOIN Part p
+  ON p.p_partkey = l.l_partkey
+  WHERE
+  (
+    p.p_brand = 'Brand#12'
+    AND "reg-exp"(p.p_container, 'SM CASE||SM BOX||SM PACK||SM PKG')
+    AND l.l_quantity >= 1 and l.l_quantity <= 11
+    AND p.p_size >= 1 and p.p_size <= 5
+    AND "reg-exp"(l.l_shipmode, 'AIR||AIR REG')
+    AND l.l_shipinstruct = 'DELIVER IN PERSON'
+  )
+  OR
+  (
+    p.p_brand = 'Brand#23'
+    AND "reg-exp"(p.p_container, 'MED BAG||MED BOX||MED PKG||MED PACK')
+    AND l.l_quantity >= 10 and l.l_quantity <= 20
+    AND p.p_size >= 1 and p.p_size <= 10
+    AND "reg-exp"(l.l_shipmode, 'AIR||AIR REG')
+    AND l.l_shipinstruct = 'DELIVER IN PERSON'
+  )
+  OR
+  (
+    p.p_brand = 'Brand#34'
+    AND "reg-exp"(p.p_container, 'LG CASE||LG BOX||LG PACK||LG PKG')
+    AND l.l_quantity >= 20 and l.l_quantity <= 30
+    AND p.p_size >= 1 and p.p_size <= 15
+    AND "reg-exp"(l.l_shipmode, 'AIR||AIR REG')
+    AND l.l_shipinstruct = 'DELIVER IN PERSON'
+  )
+ )
+);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
new file mode 100644
index 0000000..4e71cc7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+declare function q20_tmp1() {
+(
+  SELECT DISTINCT p.p_partkey as p_partkey
+  FROM Part p
+)
+};
+
+declare function q20_tmp2() {
+(
+  SELECT l_partkey AS l_partkey, l_suppkey AS l_suppkey, 0.5 * sum(l.l_quantity) AS sum_quantity
+  FROM LineItem l
+  GROUP BY l.l_partkey l_partkey, l.l_suppkey l_suppkey
+)
+};
+
+declare function q20_tmp3() {
+(
+  SELECT ps.ps_suppkey ps_suppkey, ps.ps_availqty ps_availqty, t2.sum_quantity sum_quantity
+  FROM Partsupp ps
+  JOIN q20_tmp1() t1
+  ON ps.ps_partkey = t1.p_partkey
+  JOIN q20_tmp2() t2
+  ON ps.ps_partkey = t2.l_partkey and ps.ps_suppkey = t2.l_suppkey
+)
+};
+
+declare function q20_tmp4() {
+(
+  SELECT ps_suppkey AS ps_suppkey
+  FROM q20_tmp3() t
+  WHERE t.ps_availqty > t.sum_quantity
+  GROUP BY t.ps_suppkey as ps_suppkey
+)
+};
+
+SELECT s.s_name AS s_name, s.s_address AS s_address
+FROM Supplier s
+JOIN Nation n
+ON s.s_nationkey = n.n_nationkey
+JOIN q20_tmp4() t4
+ON s.s_suppkey = t4.ps_suppkey
+ORDER BY s.s_name;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp
new file mode 100644
index 0000000..c916481
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+declare function tmp1() {
+(
+    SELECT l_orderkey AS l_orderkey,
+           count(l2.l_suppkey) AS count_suppkey,
+           max(l2.l_suppkey) AS max_suppkey
+    FROM  (
+        SELECT l_orderkey1 AS l_orderkey, l_suppkey1 AS l_suppkey
+        from  LineItem AS l
+        group by l.l_orderkey AS l_orderkey1,l.l_suppkey AS l_suppkey1
+    ) AS l2
+    GROUP BY l2.l_orderkey AS l_orderkey
+)
+};
+
+declare function tmp2() {
+(
+    SELECT l_orderkey AS l_orderkey,
+           count(l2.l_suppkey) AS count_suppkey,
+           max(l2.l_suppkey) AS max_suppkey
+    FROM  (
+        SELECT l_orderkey1 AS l_orderkey, l_suppkey1 AS l_suppkey
+        FROM LineItem AS l
+        WHERE l.l_receiptdate > l.l_commitdate
+        GROUP BY l.l_orderkey AS l_orderkey1,l.l_suppkey AS l_suppkey1
+    ) AS l2
+    GROUP BY l2.l_orderkey as l_orderkey
+)
+};
+
+SELECT s_name AS s_name, count(t4) AS numwait
+FROM  (
+    SELECT t3.s_name AS s_name,
+           t3.l_suppkey AS l_suppkey,
+           t2.l_orderkey AS l_orderkey,
+           t2.count_suppkey AS count_suppkey,
+           t2.max_suppkey AS max_suppkey
+    FROM  (
+            SELECT ns.s_name AS s_name,
+                   t1.l_orderkey AS l_orderkey,
+                   l.l_suppkey AS l_suppkey
+            FROM  LineItem AS l,
+                  (
+                        SELECT s.s_name AS s_name, s.s_suppkey AS s_suppkey
+                        FROM Nation AS n,
+                        Supplier AS s
+                        WHERE s.s_nationkey = n.n_nationkey
+                   ) AS ns,
+                   Orders AS o,
+                   tpch.tmp1() AS t1
+            WHERE ns.s_suppkey = l.l_suppkey AND l.l_receiptdate > l.l_commitdate
+                  AND o.o_orderkey = l.l_orderkey AND l.l_orderkey = t1.l_orderkey
+        ) AS t3,
+        tmp2() AS t2
+    WHERE t2.count_suppkey >= 0 AND t3.l_orderkey = t2.l_orderkey
+) AS t4
+GROUP BY t4.s_name AS s_name
+ORDER BY numwait DESC,s_name
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
new file mode 100644
index 0000000..3630541
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function q22_customer_tmp() {
+(
+    SELECT c.c_acctbal AS c_acctbal, c.c_custkey AS c_custkey, substring(c.c_phone,1,2) AS cntrycode
+    FROM  Customer AS c
+)
+};
+
+WITH  avg AS avg((
+      SELECT ELEMENT c.c_acctbal
+      FROM  Customer AS c
+      WHERE c.c_acctbal > 0.0
+  ))
+SELECT  cntrycode AS cntrycode, count(ct) AS numcust, tpch.sum(ct.c_acctbal) AS totacctbal
+FROM  q22_customer_tmp() AS ct
+WHERE ct.c_acctbal > avg
+GROUP BY ct.cntrycode AS cntrycode
+ORDER BY cntrycode
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.1.ddl.sqlpp
new file mode 100644
index 0000000..9447c79
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.1.ddl.sqlpp
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue562
+ * https://code.google.com/p/asterixdb/issues/detail?id=562
+ * Expected Res : SUCCESS
+ * Date         : 15th Jan. 2015
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.2.update.sqlpp
new file mode 100644
index 0000000..e3a990e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.2.update.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue562
+ * https://code.google.com/p/asterixdb/issues/detail?id=562
+ * Expected Res : SUCCESS
+ * Date         : 15th Jan. 2015
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.3.query.sqlpp
new file mode 100644
index 0000000..753b5d3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.3.query.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue562
+ * https://code.google.com/p/asterixdb/issues/detail?id=562
+ * Expected Res : SUCCESS
+ * Date         : 15th Jan. 2015
+ */
+
+USE tpch;
+
+
+declare function q22_customer_tmp() {
+(
+    SELECT c.c_acctbal AS c_acctbal, c.c_custkey AS c_custkey, phone_substr AS cntrycode
+    FROM  Customer AS c
+    WITH  phone_substr AS substring(c.c_phone,1,2)
+    WHERE phone_substr = '13' OR phone_substr = '31' OR phone_substr = '23' OR phone_substr = '29'
+          OR phone_substr = '30' OR phone_substr = '18' OR phone_substr = '17'
+)
+};
+
+SELECT cntrycode AS cntrycode, count(ct) AS numcust, sum(ct.c_acctbal) AS totacctbal
+FROM  q22_customer_tmp() as ct
+WHERE count((
+                SELECT ELEMENT o
+                FROM  Orders AS o
+                WHERE ct.c_custkey = o.o_custkey
+            )) = 0
+GROUP BY ct.cntrycode AS cntrycode
+ORDER BY cntrycode
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue601/query-issue601.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue601/query-issue601.1.ddl.sqlpp
new file mode 100644
index 0000000..8a4e320
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue601/query-issue601.1.ddl.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue601
+ * https://code.google.com/p/asterixdb/issues/detail?id=601
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : double,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue601/query-issue601.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue601/query-issue601.2.update.sqlpp
new file mode 100644
index 0000000..8f6ad53
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue601/query-issue601.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue601
+ * https://code.google.com/p/asterixdb/issues/detail?id=601
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue601/query-issue601.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue601/query-issue601.3.query.sqlpp
new file mode 100644
index 0000000..bd88d13
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue601/query-issue601.3.query.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue601
+ * https://code.google.com/p/asterixdb/issues/detail?id=601
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct 2014
+ */
+
+USE tpch;
+
+
+SELECT l_linenumber AS l_linenumber, count(l) AS count_order
+FROM  LineItem AS l
+GROUP BY l.l_linenumber AS l_linenumber
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue638/query-issue638.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue638/query-issue638.1.ddl.sqlpp
new file mode 100644
index 0000000..07b9107
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue638/query-issue638.1.ddl.sqlpp
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue638
+ * https://code.google.com/p/asterixdb/issues/detail?id=638
+ * Expected Res : SUCCESS
+ * Date         : 24th Oct. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : int32,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create external  table LineItem(LineItemType) using "localfs"(("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+create external  table Orders(OrderType) using "localfs"(("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+create external  table Supplier(SupplierType) using "localfs"(("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+create external  table Region(RegionType) using "localfs"(("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+create external  table Nation(NationType) using "localfs"(("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+create external  table Part(PartType) using "localfs"(("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+create external  table Partsupp(PartSuppType) using "localfs"(("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+create external  table Customer(CustomerType) using "localfs"(("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue638/query-issue638.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue638/query-issue638.2.update.sqlpp
new file mode 100644
index 0000000..86538e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue638/query-issue638.2.update.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue638
+ * https://code.google.com/p/asterixdb/issues/detail?id=638
+ * Expected Res : SUCCESS
+ * Date         : 24th Oct. 2014
+ */
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue638/query-issue638.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue638/query-issue638.3.query.sqlpp
new file mode 100644
index 0000000..45310aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue638/query-issue638.3.query.sqlpp
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue638
+ * https://code.google.com/p/asterixdb/issues/detail?id=638
+ * Expected Res : SUCCESS
+ * Date         : 24th Oct. 2014
+ */
+
+USE tpch;
+
+
+SELECT nation AS nation, o_year AS o_year, sum(profit.amount) AS sum_profit
+FROM
+  (
+    SELECT   l3.n_name AS nation,
+             "get-year"(o.o_orderdate) AS o_year,
+             l3.l_extendedprice * (1 - l3.l_discount) -  l3.ps_supplycost * l3.l_quantity AS amount
+    FROM
+      Orders o JOIN
+      (
+       SELECT l2.l_extendedprice AS l_extendedprice,
+              l2.l_discount AS l_discount,
+              l2.l_quantity AS l_quantity,
+              l2.l_orderkey AS l_orderkey,
+              l2.n_name AS n_name,
+              l2.ps_supplycost AS ps_supplycost
+       FROM Part p JOIN
+         (SELECT l1.l_extendedprice AS l_extendedprice,
+                 l1.l_discount AS l_discount,
+                 l1.l_quantity AS l_quantity,
+                 l1.l_partkey AS l_partkey,
+                 l1.l_orderkey AS l_orderkey,
+                 l1.n_name AS n_name,
+                 ps.ps_supplycost AS ps_supplycost
+          FROM Partsupp ps join
+            (SELECT l.l_suppkey AS l_suppkey,
+                    l.l_extendedprice AS l_extendedprice,
+                    l.l_discount AS l_discount,
+                    l.l_quantity AS l_quantity,
+                    l.l_partkey AS l_partkey,
+                    l.l_orderkey AS l_orderkey,
+                    s1.n_name AS n_name
+             FROM
+               (SELECT s.s_suppkey AS s_suppkey, n.n_name AS n_name
+                FROM Nation n join Supplier s on n.n_nationkey = s.s_nationkey
+               ) s1 JOIN LineItem l ON s1.s_suppkey = l.l_suppkey
+            ) l1 ON ((ps.ps_suppkey = l1.l_suppkey) and (ps.ps_partkey = l1.l_partkey))
+         ) l2 ON contains(p.p_name,'green') AND p.p_partkey = l2.l_partkey
+     ) l3 ON o.o_orderkey = l3.l_orderkey
+  ) profit
+GROUP BY profit.nation AS nation, profit.o_year AS o_year
+ORDER BY nation, o_year desc;
+
+
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785-2/query-issue785-2.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785-2/query-issue785-2.1.ddl.sqlpp
new file mode 100644
index 0000000..18e3fa1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785-2/query-issue785-2.1.ddl.sqlpp
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785-2/query-issue785-2.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785-2/query-issue785-2.2.update.sqlpp
new file mode 100644
index 0000000..bc3766e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785-2/query-issue785-2.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+use tpch;
+
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using localfs (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785-2/query-issue785-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785-2/query-issue785-2.3.query.sqlpp
new file mode 100644
index 0000000..8ac3963
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785-2/query-issue785-2.3.query.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+USE tpch;
+
+
+WITH  t AS (
+      SELECT nation.n_nationkey AS n_nationkey, nation.n_name AS n_name
+      FROM  Nation AS nation,
+            SelectedNation AS sn
+      WHERE nation.n_nationkey = sn.n_nationkey
+),
+X as (
+      SELECT nation_key AS nation_key, orderdate AS order_date, sum(orders.o_totalprice) AS sum_price
+      FROM  t AS n,
+            Customer AS customer,
+            Orders AS orders
+      WHERE orders.o_custkey = customer.c_custkey and customer.c_nationkey = n.n_nationkey
+      GROUP BY orders.o_orderdate AS orderdate, n.n_nationkey AS nation_key
+)
+
+SELECT nation_key As nation_key,
+       (
+            SELECT y.order_date AS orderdate, y.sum_price As sum_price
+            FROM  x AS y
+            ORDER BY y.sum_price desc
+            LIMIT 3
+        ) AS sum_price
+FROM  X AS x
+GROUP BY x.nation_key AS nation_key
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785/query-issue785.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785/query-issue785.1.ddl.sqlpp
new file mode 100644
index 0000000..18e3fa1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785/query-issue785.1.ddl.sqlpp
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785/query-issue785.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785/query-issue785.2.update.sqlpp
new file mode 100644
index 0000000..bc3766e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785/query-issue785.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+use tpch;
+
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using localfs (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785/query-issue785.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785/query-issue785.3.query.sqlpp
new file mode 100644
index 0000000..a142f2a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue785/query-issue785.3.query.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+USE tpch;
+
+
+SELECT  nation_key AS nation_key,
+        (
+            SELECT od AS orderdate, sum_price AS sum_price
+            FROM x as i
+            GROUP BY i.order_date AS od
+            WITH sum_price AS sum(i.sum_price)
+            ORDER BY sum_price desc
+            LIMIT 3
+        ) AS sum_price
+FROM  (
+        SELECT nation_key AS nation_key, orderdate AS order_date, sum(orders.o_totalprice) AS sum_price
+        FROM  Nation AS n,
+              Customer AS customer,
+              Orders AS orders
+        WHERE orders.o_custkey = customer.c_custkey AND customer.c_nationkey = n.n_nationkey
+        GROUP BY orders.o_orderdate as orderdate,n.n_nationkey as nation_key
+) AS x
+GROUP BY x.nation_key AS nation_key
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue786/query-issue786.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue786/query-issue786.1.ddl.sqlpp
new file mode 100644
index 0000000..33f5419
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue786/query-issue786.1.ddl.sqlpp
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue786
+ * https://code.google.com/p/asterixdb/issues/detail?id=786
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int32,
+  o_custkey : int32,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int32,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue786/query-issue786.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue786/query-issue786.2.update.sqlpp
new file mode 100644
index 0000000..4289c4a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue786/query-issue786.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue786
+ * https://code.google.com/p/asterixdb/issues/detail?id=786
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct. 2014
+ */
+
+use tpch;
+
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using localfs (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue786/query-issue786.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue786/query-issue786.3.query.sqlpp
new file mode 100644
index 0000000..65c1219
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue786/query-issue786.3.query.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue786
+ * https://code.google.com/p/asterixdb/issues/detail?id=786
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct. 2014
+ */
+
+USE tpch;
+
+
+SELECT  nation.n_nationkey AS nation_key,
+        nation.n_name AS name,
+        (
+            SELECT orderdate AS order_date, sum(orders.o_totalprice) AS sum_price
+            FROM  Orders AS orders,
+                  Customer AS customer
+            WHERE orders.o_custkey = customer.c_custkey AND customer.c_nationkey = nation.n_nationkey
+            GROUP BY orders.o_orderdate as orderdate
+            ORDER BY sum_price DESC
+            LIMIT 3
+        ) AS aggregates
+FROM  Nation AS nation,
+      SelectedNation AS sn
+WHERE nation.n_nationkey = sn.sn_nationkey
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.1.ddl.sqlpp
new file mode 100644
index 0000000..b26ac3d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.1.ddl.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : double,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.2.update.sqlpp
new file mode 100644
index 0000000..b315f19
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.3.query.sqlpp
new file mode 100644
index 0000000..5fe9965
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.3.query.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+SELECT l_returnflag AS l_returnflag,
+       l_linestatus AS l_linestatus,
+       count(cheaps) AS count_cheaps,
+       total_charges AS total_charges
+FROM  LineItem as l
+WHERE l.l_shipdate <= '1998-09-02'
+/* +hash */
+GROUP BY l.l_returnflag AS l_returnflag,l.l_linestatus AS l_linestatus
+WITH  cheaps AS (
+      SELECT ELEMENT m
+      FROM  l AS m
+      WHERE m.l_discount > 0.05
+  ),
+total_charges AS sum(l.l_extendedprice * (1 - l.l_discount) * (1 + l.l_tax))
+ORDER BY l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.1.ddl.sqlpp
new file mode 100644
index 0000000..b26ac3d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.1.ddl.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : double,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.2.update.sqlpp
new file mode 100644
index 0000000..b315f19
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.3.query.sqlpp
new file mode 100644
index 0000000..db4a46c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.3.query.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+USE tpch;
+
+
+SELECT  l_returnflag AS l_returnflag,
+        l_linestatus AS l_linestatus,
+        count(cheaps) AS count_cheaps,
+        avg(expensives) AS avg_expensive_discounts,
+        sum_disc_prices AS sum_disc_prices,
+        total_charges AS total_charges
+FROM  LineItem AS l
+WHERE l.l_shipdate <= '1998-09-02'
+/* +hash */
+GROUP BY l.l_returnflag AS l_returnflag,l.l_linestatus AS l_linestatus
+WITH  expensives AS (
+      SELECT ELEMENT i.l_discount
+      FROM  l AS i
+      WHERE i.l_discount <= 0.05
+      ),
+cheaps as (
+      SELECT ELEMENT i
+      FROM  l AS i
+      WHERE i.l_discount > 0.05
+  ),
+sum_disc_prices AS sum(l.l_extendedprice * (1 - l.l_discount)),
+total_charges AS sum(l.l_extendedprice * (1 - l.l_discount) * (1 + l.l_tax))
+ORDER BY l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.1.ddl.sqlpp
new file mode 100644
index 0000000..b26ac3d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.1.ddl.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : double,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.2.update.sqlpp
new file mode 100644
index 0000000..b315f19
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.3.query.sqlpp
new file mode 100644
index 0000000..7e5cb54
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.3.query.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+USE tpch;
+
+
+SELECT l_returnflag AS l_returnflag,
+       l_linestatus AS l_linestatus,
+       count(cheap) AS count_cheaps,
+       count(expensive) AS count_expensives
+FROM LineItem AS l
+WHERE l.l_shipdate <= '1998-09-02'
+/* +hash */
+GROUP BY l.l_returnflag AS l_returnflag,l.l_linestatus AS l_linestatus
+with  cheap as (
+      SELECT ELEMENT m
+      FROM l AS m
+      WHERE m.l_discount > 0.05
+),
+expensive AS (
+      SELECT ELEMENT a
+      FROM l AS a
+      WHERE a.l_discount <= 0.05
+)
+ORDER BY l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 559dfc8..a8f29d3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -22,13 +22,14 @@
 
 select element (100.0 * tpch.sum((
       select element tpch."switch-case"(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
-      from  l as i
+      from  lp as i
   )) / tpch.sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
-      from  l as i
+      from  lp as i
   )))
 from  LineItem as l,
       Part as p
+let lp = {'p_type': p.p_type, 'l_extendedprice': l.l_extendedprice, 'l_discount': l.l_discount}
 where ((l.l_partkey = p.p_partkey) and (l.l_shipdate >= '1995-09-01') and (l.l_shipdate < '1995-10-01'))
 group by 1 as t
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 559dfc8..a8f29d3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -22,13 +22,14 @@
 
 select element (100.0 * tpch.sum((
       select element tpch."switch-case"(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
-      from  l as i
+      from  lp as i
   )) / tpch.sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
-      from  l as i
+      from  lp as i
   )))
 from  LineItem as l,
       Part as p
+let lp = {'p_type': p.p_type, 'l_extendedprice': l.l_extendedprice, 'l_discount': l.l_discount}
 where ((l.l_partkey = p.p_partkey) and (l.l_shipdate >= '1995-09-01') and (l.l_shipdate < '1995-10-01'))
 group by 1 as t
 ;
diff --git a/asterix-app/src/test/resources/runtimets/results/group-by/core-01/core-01.1.adm b/asterix-app/src/test/resources/runtimets/results/group-by/core-01/core-01.1.adm
new file mode 100644
index 0000000..cb3287a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/group-by/core-01/core-01.1.adm
@@ -0,0 +1 @@
+{ "avgpay": 2500.0d, "workers": [ { "name": "Bill", "salary": 2000 }, { "name": "Fred", "salary": 3000 } ], "deptno": "K55" }
diff --git a/asterix-app/src/test/resources/runtimets/results/group-by/core-02/core-02.1.adm b/asterix-app/src/test/resources/runtimets/results/group-by/core-02/core-02.1.adm
new file mode 100644
index 0000000..4281a7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/group-by/core-02/core-02.1.adm
@@ -0,0 +1 @@
+{ "deptId": "K55", "star_cost": 3000 }
diff --git a/asterix-app/src/test/resources/runtimets/results/group-by/core-03/core-03.1.adm b/asterix-app/src/test/resources/runtimets/results/group-by/core-03/core-03.1.adm
new file mode 100644
index 0000000..0cba302
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/group-by/core-03/core-03.1.adm
@@ -0,0 +1 @@
+{ "avgpay": 3000.0d, "topstar_details": [ { "id": "123", "salary": 2000, "bonus": 1000 } ], "deptId": "K55" }
diff --git a/asterix-app/src/test/resources/runtimets/results/group-by/core-04/core-04.1.adm b/asterix-app/src/test/resources/runtimets/results/group-by/core-04/core-04.1.adm
new file mode 100644
index 0000000..6427c6e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/group-by/core-04/core-04.1.adm
@@ -0,0 +1,2 @@
+{ "job_category_details": [ { "category": "Cook", "bonus": 1000 } ], "deptId": "K55" }
+{ "job_category_details": [ { "category": "Teach", "bonus": 2000 } ], "deptId": "K54" }
diff --git a/asterix-app/src/test/resources/runtimets/results/group-by/core-05/core-05.1.adm b/asterix-app/src/test/resources/runtimets/results/group-by/core-05/core-05.1.adm
new file mode 100644
index 0000000..2c6dc3a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/group-by/core-05/core-05.1.adm
@@ -0,0 +1 @@
+{ "Vehicle prices including 4 tires": [ { "avg_total_price": 28000.0d, "combinations": [ { "make": "Honda", "model": "Civic", "mfr": "Bridgestone", "brand": "Turanza", "price": 28600 }, { "make": "Honda", "model": "Civic", "mfr": "Goodyear", "brand": "Eagle", "price": 28400 }, { "make": "Toyota", "model": "Corolla", "mfr": "Bridgestone", "brand": "Turanza", "price": 27600 }, { "make": "Toyota", "model": "Corolla", "mfr": "Goodyear", "brand": "Eagle", "price": 27400 } ], "tire_size": "P205/55R16" } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.1.adm
index da45d73..ed5098a 100644
--- a/asterix-app/src/test/resources/runtimets/results/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.1.adm
@@ -1 +1 @@
-0.0d
+15.23021261159725d
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/distinct_by/distinct_by.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/distinct_by/distinct_by.1.adm
new file mode 100644
index 0000000..472cb64
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/distinct_by/distinct_by.1.adm
@@ -0,0 +1,28 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "AIR" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "FOB" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "MAIL" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "RAIL" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "REG AIR" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "SHIP" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "TRUCK" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "AIR" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "FOB" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "MAIL" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "RAIL" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "REG AIR" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "SHIP" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "TRUCK" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "AIR" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "FOB" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "MAIL" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "RAIL" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "REG AIR" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "SHIP" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "TRUCK" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "AIR" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "FOB" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "MAIL" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "RAIL" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "REG AIR" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "SHIP" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "TRUCK" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/group_no_agg/group_no_agg.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/group_no_agg/group_no_agg.1.adm
new file mode 100644
index 0000000..4b43fed
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/group_no_agg/group_no_agg.1.adm
@@ -0,0 +1,5 @@
+"AFRICA"
+"AMERICA"
+"ASIA"
+"EUROPE"
+"MIDDLE EAST"
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/nest_aggregate/nest_aggregate.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/nest_aggregate/nest_aggregate.1.adm
new file mode 100644
index 0000000..428af08
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/nest_aggregate/nest_aggregate.1.adm
@@ -0,0 +1,11 @@
+{ "nation_key": 0, "name": "ALGERIA", "aggregates": [ { "order_date": "1994-05-27", "sum_price": 1051.15d }, { "order_date": "1994-05-08", "sum_price": 4819.91d }, { "order_date": "1993-08-27", "sum_price": 10500.27d } ] }
+{ "nation_key": 1, "name": "ARGENTINA", "aggregates": [ { "order_date": "1997-08-14", "sum_price": 16763.95d }, { "order_date": "1997-11-26", "sum_price": 18653.09d }, { "order_date": "1998-04-20", "sum_price": 24637.96d } ] }
+{ "nation_key": 2, "name": "BRAZIL", "aggregates": [ { "order_date": "1993-03-05", "sum_price": 8225.96d }, { "order_date": "1994-08-31", "sum_price": 19056.99d }, { "order_date": "1997-05-04", "sum_price": 23984.88d } ] }
+{ "nation_key": 3, "name": "CANADA", "aggregates": [ { "order_date": "1992-02-22", "sum_price": 1084.38d }, { "order_date": "1992-11-28", "sum_price": 4766.19d }, { "order_date": "1995-02-17", "sum_price": 4913.06d } ] }
+{ "nation_key": 4, "name": "EGYPT", "aggregates": [ { "order_date": "1998-04-19", "sum_price": 3089.42d }, { "order_date": "1996-03-12", "sum_price": 3892.77d }, { "order_date": "1997-07-25", "sum_price": 11405.4d } ] }
+{ "nation_key": 19, "name": "ROMANIA", "aggregates": [ { "order_date": "1994-07-05", "sum_price": 7108.12d }, { "order_date": "1994-11-17", "sum_price": 13282.23d }, { "order_date": "1997-02-07", "sum_price": 16689.19d } ] }
+{ "nation_key": 20, "name": "SAUDI ARABIA", "aggregates": [ { "order_date": "1994-04-30", "sum_price": 6406.29d }, { "order_date": "1992-05-10", "sum_price": 45695.84d }, { "order_date": "1994-01-31", "sum_price": 62316.61d } ] }
+{ "nation_key": 21, "name": "VIETNAM", "aggregates": [ { "order_date": "1994-02-17", "sum_price": 1984.14d }, { "order_date": "1995-08-05", "sum_price": 16922.51d }, { "order_date": "1994-06-01", "sum_price": 21088.59d } ] }
+{ "nation_key": 22, "name": "RUSSIA", "aggregates": [ { "order_date": "1993-11-16", "sum_price": 7471.75d }, { "order_date": "1996-01-11", "sum_price": 8720.45d }, { "order_date": "1995-07-15", "sum_price": 27016.74d } ] }
+{ "nation_key": 23, "name": "UNITED KINGDOM", "aggregates": [ { "order_date": "1997-12-18", "sum_price": 10934.84d }, { "order_date": "1995-05-26", "sum_price": 11474.95d }, { "order_date": "1997-05-13", "sum_price": 18307.45d } ] }
+{ "nation_key": 24, "name": "UNITED STATES", "aggregates": [  ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/nest_aggregate2/nest_aggregate2.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/nest_aggregate2/nest_aggregate2.1.adm
new file mode 100644
index 0000000..3834939
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/nest_aggregate2/nest_aggregate2.1.adm
@@ -0,0 +1,11 @@
+{ "nation_key": 0, "name": "ALGERIA", "aggregates": [ "1994-05-27", "1994-05-08", "1993-08-27" ] }
+{ "nation_key": 1, "name": "ARGENTINA", "aggregates": [ "1997-08-14", "1997-11-26", "1998-04-20" ] }
+{ "nation_key": 2, "name": "BRAZIL", "aggregates": [ "1993-03-05", "1994-08-31", "1997-05-04" ] }
+{ "nation_key": 3, "name": "CANADA", "aggregates": [ "1992-02-22", "1992-11-28", "1995-02-17" ] }
+{ "nation_key": 4, "name": "EGYPT", "aggregates": [ "1998-04-19", "1996-03-12", "1997-07-25" ] }
+{ "nation_key": 19, "name": "ROMANIA", "aggregates": [ "1994-07-05", "1994-11-17", "1997-02-07" ] }
+{ "nation_key": 20, "name": "SAUDI ARABIA", "aggregates": [ "1994-04-30", "1992-05-10", "1994-01-31" ] }
+{ "nation_key": 21, "name": "VIETNAM", "aggregates": [ "1994-02-17", "1995-08-05", "1994-06-01" ] }
+{ "nation_key": 22, "name": "RUSSIA", "aggregates": [ "1993-11-16", "1996-01-11", "1995-07-15" ] }
+{ "nation_key": 23, "name": "UNITED KINGDOM", "aggregates": [ "1997-12-18", "1995-05-26", "1997-05-13" ] }
+{ "nation_key": 24, "name": "UNITED STATES", "aggregates": [  ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.adm
new file mode 100644
index 0000000..8acdda4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.adm
@@ -0,0 +1,4 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "sum_qty": 37474.0d, "sum_base_price": 3.7569624640000015E7d, "sum_disc_price": 3.567619209699997E7d, "sum_charge": 3.7101416222424E7d, "ave_qty": 25.354533152909337d, "ave_price": 25419.231826792973d, "ave_disc": 0.05086603518267936d, "count_order": 1478 }
+{ "l_returnflag": "N", "l_linestatus": "F", "sum_qty": 1041.0d, "sum_base_price": 1041301.0700000001d, "sum_disc_price": 999060.898d, "sum_charge": 1036450.8022800002d, "ave_qty": 27.394736842105264d, "ave_price": 27402.659736842106d, "ave_disc": 0.04289473684210526d, "count_order": 38 }
+{ "l_returnflag": "N", "l_linestatus": "O", "sum_qty": 75168.0d, "sum_base_price": 7.538495537000003E7d, "sum_disc_price": 7.165316630340004E7d, "sum_charge": 7.449879813307303E7d, "ave_qty": 25.558653519211152d, "ave_price": 25632.422771166282d, "ave_disc": 0.04969738184291074d, "count_order": 2941 }
+{ "l_returnflag": "R", "l_linestatus": "F", "sum_qty": 36511.0d, "sum_base_price": 3.657084124000002E7d, "sum_disc_price": 3.473847287579997E7d, "sum_charge": 3.616906011219299E7d, "ave_qty": 25.059025394646532d, "ave_price": 25100.09693891559d, "ave_disc": 0.05002745367192867d, "count_order": 1457 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.adm
new file mode 100644
index 0000000..a7d5b93
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.adm
@@ -0,0 +1,13 @@
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 2, "p_mfgr": "Manufacturer#1", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 4, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 22, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 35, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 38, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 62, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 79, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 94, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 102, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 106, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 131, "p_mfgr": "Manufacturer#5", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 159, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 193, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.adm
new file mode 100644
index 0000000..625a418
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.adm
@@ -0,0 +1,8 @@
+{ "l_orderkey": 1637, "revenue": 164224.9253d, "o_orderdate": "1995-02-08", "o_shippriority": 0 }
+{ "l_orderkey": 5191, "revenue": 49378.309400000006d, "o_orderdate": "1994-12-11", "o_shippriority": 0 }
+{ "l_orderkey": 742, "revenue": 43728.048d, "o_orderdate": "1994-12-23", "o_shippriority": 0 }
+{ "l_orderkey": 3492, "revenue": 43716.072400000005d, "o_orderdate": "1994-11-24", "o_shippriority": 0 }
+{ "l_orderkey": 2883, "revenue": 36666.9612d, "o_orderdate": "1995-01-23", "o_shippriority": 0 }
+{ "l_orderkey": 998, "revenue": 11785.548600000002d, "o_orderdate": "1994-11-26", "o_shippriority": 0 }
+{ "l_orderkey": 3430, "revenue": 4726.6775d, "o_orderdate": "1994-12-12", "o_shippriority": 0 }
+{ "l_orderkey": 4423, "revenue": 3055.9365d, "o_orderdate": "1995-02-17", "o_shippriority": 0 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q04_order_priority/q04_order_priority.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q04_order_priority/q04_order_priority.1.adm
new file mode 100644
index 0000000..5e38c96
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q04_order_priority/q04_order_priority.1.adm
@@ -0,0 +1,5 @@
+{ "order_priority": "1-URGENT", "count": 9 }
+{ "order_priority": "2-HIGH", "count": 7 }
+{ "order_priority": "3-MEDIUM", "count": 9 }
+{ "order_priority": "4-NOT SPECIFIED", "count": 8 }
+{ "order_priority": "5-LOW", "count": 12 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.adm
new file mode 100644
index 0000000..ac68fb3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.adm
@@ -0,0 +1,8 @@
+{ "n_name": "PERU", "revenue": 1099912.8209000002d }
+{ "n_name": "MOROCCO", "revenue": 520107.17919999996d }
+{ "n_name": "IRAN", "revenue": 375610.964d }
+{ "n_name": "IRAQ", "revenue": 364417.398d }
+{ "n_name": "ETHIOPIA", "revenue": 253825.76219999997d }
+{ "n_name": "ARGENTINA", "revenue": 102659.0106d }
+{ "n_name": "UNITED KINGDOM", "revenue": 61065.8711d }
+{ "n_name": "KENYA", "revenue": 29679.393200000002d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.adm
new file mode 100644
index 0000000..06f9a78
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.adm
@@ -0,0 +1 @@
+{ "revenue": 77949.9186d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.adm
new file mode 100644
index 0000000..37138fc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.adm
@@ -0,0 +1,37 @@
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 63089.1006d }
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 64024.4532d }
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 32719.877199999995d }
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 63729.862400000005d }
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 1801.8198d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 74693.317d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 13733.706600000001d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 83631.40359999999d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 69329.67199999999d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 42017.435999999994d }
+{ "supp_nation": "IRAN", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 38014.335399999996d }
+{ "supp_nation": "IRAN", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 252152.5927d }
+{ "supp_nation": "IRAN", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 9106.957199999999d }
+{ "supp_nation": "IRAQ", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 68040.7747d }
+{ "supp_nation": "IRAQ", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 3676.8004d }
+{ "supp_nation": "IRAQ", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 85948.85280000001d }
+{ "supp_nation": "IRAQ", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 66380.2488d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 77164.5422d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 63792.8736d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 74537.6256d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 37851.309d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 18467.316d }
+{ "supp_nation": "MOROCCO", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 89669.69080000001d }
+{ "supp_nation": "MOROCCO", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 173726.0087d }
+{ "supp_nation": "MOROCCO", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 37169.8497d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 226624.7652d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 58359.3076d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 345376.29829999997d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 52968.9424d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 7960.72d }
+{ "supp_nation": "UNITED KINGDOM", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 100143.32139999999d }
+{ "supp_nation": "UNITED KINGDOM", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 41582.5227d }
+{ "supp_nation": "UNITED KINGDOM", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 164740.32710000002d }
+{ "supp_nation": "UNITED KINGDOM", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 50909.551999999996d }
+{ "supp_nation": "UNITED STATES", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 52480.9528d }
+{ "supp_nation": "UNITED STATES", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 115566.8388d }
+{ "supp_nation": "UNITED STATES", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 80489.69949999999d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q08_national_market_share/q08_national_market_share.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q08_national_market_share/q08_national_market_share.1.adm
new file mode 100644
index 0000000..5a0b1da
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q08_national_market_share/q08_national_market_share.1.adm
@@ -0,0 +1,2 @@
+{ "year": 1995, "mkt_share": 0.0d }
+{ "year": 1996, "mkt_share": 0.0d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.adm
new file mode 100644
index 0000000..e9f3f47
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.adm
@@ -0,0 +1,59 @@
+{ "nation": "ARGENTINA", "o_year": 1997, "sum_profit": 18247.873399999993d }
+{ "nation": "ARGENTINA", "o_year": 1996, "sum_profit": 7731.089399999995d }
+{ "nation": "ARGENTINA", "o_year": 1995, "sum_profit": 134490.5697d }
+{ "nation": "ARGENTINA", "o_year": 1994, "sum_profit": 36767.101500000004d }
+{ "nation": "ARGENTINA", "o_year": 1993, "sum_profit": 35857.08d }
+{ "nation": "ARGENTINA", "o_year": 1992, "sum_profit": 35740.0d }
+{ "nation": "ETHIOPIA", "o_year": 1998, "sum_profit": 2758.7801999999992d }
+{ "nation": "ETHIOPIA", "o_year": 1997, "sum_profit": 19419.294599999994d }
+{ "nation": "ETHIOPIA", "o_year": 1995, "sum_profit": 51231.87439999999d }
+{ "nation": "ETHIOPIA", "o_year": 1994, "sum_profit": 3578.9478999999974d }
+{ "nation": "ETHIOPIA", "o_year": 1992, "sum_profit": 1525.8234999999986d }
+{ "nation": "IRAN", "o_year": 1998, "sum_profit": 37817.229600000006d }
+{ "nation": "IRAN", "o_year": 1997, "sum_profit": 52643.77359999999d }
+{ "nation": "IRAN", "o_year": 1996, "sum_profit": 70143.77609999999d }
+{ "nation": "IRAN", "o_year": 1995, "sum_profit": 84094.58260000001d }
+{ "nation": "IRAN", "o_year": 1994, "sum_profit": 18140.925599999995d }
+{ "nation": "IRAN", "o_year": 1993, "sum_profit": 78655.1676d }
+{ "nation": "IRAN", "o_year": 1992, "sum_profit": 87142.2396d }
+{ "nation": "IRAQ", "o_year": 1998, "sum_profit": 22860.8082d }
+{ "nation": "IRAQ", "o_year": 1997, "sum_profit": 93676.24359999999d }
+{ "nation": "IRAQ", "o_year": 1996, "sum_profit": 45103.3242d }
+{ "nation": "IRAQ", "o_year": 1994, "sum_profit": 36010.728599999995d }
+{ "nation": "IRAQ", "o_year": 1993, "sum_profit": 33221.9399d }
+{ "nation": "IRAQ", "o_year": 1992, "sum_profit": 47755.05900000001d }
+{ "nation": "KENYA", "o_year": 1998, "sum_profit": 44194.831999999995d }
+{ "nation": "KENYA", "o_year": 1997, "sum_profit": 57578.3626d }
+{ "nation": "KENYA", "o_year": 1996, "sum_profit": 59195.9021d }
+{ "nation": "KENYA", "o_year": 1995, "sum_profit": 79262.6278d }
+{ "nation": "KENYA", "o_year": 1994, "sum_profit": 102360.66609999999d }
+{ "nation": "KENYA", "o_year": 1993, "sum_profit": 128422.01959999999d }
+{ "nation": "KENYA", "o_year": 1992, "sum_profit": 181517.20890000003d }
+{ "nation": "MOROCCO", "o_year": 1998, "sum_profit": 41797.823199999984d }
+{ "nation": "MOROCCO", "o_year": 1997, "sum_profit": 23685.801799999997d }
+{ "nation": "MOROCCO", "o_year": 1996, "sum_profit": 62115.19579999999d }
+{ "nation": "MOROCCO", "o_year": 1995, "sum_profit": 42442.64300000001d }
+{ "nation": "MOROCCO", "o_year": 1994, "sum_profit": 48655.87800000001d }
+{ "nation": "MOROCCO", "o_year": 1993, "sum_profit": 22926.744400000003d }
+{ "nation": "MOROCCO", "o_year": 1992, "sum_profit": 32239.8088d }
+{ "nation": "PERU", "o_year": 1998, "sum_profit": 86999.36459999997d }
+{ "nation": "PERU", "o_year": 1997, "sum_profit": 121110.41070000001d }
+{ "nation": "PERU", "o_year": 1996, "sum_profit": 177040.40759999998d }
+{ "nation": "PERU", "o_year": 1995, "sum_profit": 122247.94519999999d }
+{ "nation": "PERU", "o_year": 1994, "sum_profit": 88046.2533d }
+{ "nation": "PERU", "o_year": 1993, "sum_profit": 49379.813799999996d }
+{ "nation": "PERU", "o_year": 1992, "sum_profit": 80646.86050000001d }
+{ "nation": "UNITED KINGDOM", "o_year": 1998, "sum_profit": 50577.25560000001d }
+{ "nation": "UNITED KINGDOM", "o_year": 1997, "sum_profit": 114288.86049999998d }
+{ "nation": "UNITED KINGDOM", "o_year": 1996, "sum_profit": 147684.46480000002d }
+{ "nation": "UNITED KINGDOM", "o_year": 1995, "sum_profit": 225267.6576d }
+{ "nation": "UNITED KINGDOM", "o_year": 1994, "sum_profit": 140595.58639999997d }
+{ "nation": "UNITED KINGDOM", "o_year": 1993, "sum_profit": 322548.49210000003d }
+{ "nation": "UNITED KINGDOM", "o_year": 1992, "sum_profit": 67747.88279999999d }
+{ "nation": "UNITED STATES", "o_year": 1998, "sum_profit": 3957.0431999999996d }
+{ "nation": "UNITED STATES", "o_year": 1997, "sum_profit": 94729.5704d }
+{ "nation": "UNITED STATES", "o_year": 1996, "sum_profit": 79297.8567d }
+{ "nation": "UNITED STATES", "o_year": 1995, "sum_profit": 62201.23360000001d }
+{ "nation": "UNITED STATES", "o_year": 1994, "sum_profit": 43075.62989999999d }
+{ "nation": "UNITED STATES", "o_year": 1993, "sum_profit": 27168.486199999996d }
+{ "nation": "UNITED STATES", "o_year": 1992, "sum_profit": 34092.366d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q10_returned_item/q10_returned_ite.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q10_returned_item/q10_returned_ite.1.adm
new file mode 100644
index 0000000..6df13e2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q10_returned_item/q10_returned_ite.1.adm
@@ -0,0 +1,20 @@
+{ "c_custkey": 121i32, "c_name": "Customer#000000121", "revenue": 282635.1719d, "c_acctbal": 6428.32d, "n_name": "PERU", "c_address": "tv nCR2YKupGN73mQudO", "c_phone": "27-411-990-2959", "c_comment": "uriously stealthy ideas. carefully final courts use carefully" }
+{ "c_custkey": 124i32, "c_name": "Customer#000000124", "revenue": 222182.51880000002d, "c_acctbal": 1842.49d, "n_name": "CHINA", "c_address": "aTbyVAW5tCd,v09O", "c_phone": "28-183-750-7809", "c_comment": "le fluffily even dependencies. quietly s" }
+{ "c_custkey": 106i32, "c_name": "Customer#000000106", "revenue": 190241.3334d, "c_acctbal": 3288.42d, "n_name": "ARGENTINA", "c_address": "xGCOEAUjUNG", "c_phone": "11-751-989-4627", "c_comment": "lose slyly. ironic accounts along the evenly regular theodolites wake about the special, final gifts. " }
+{ "c_custkey": 16i32, "c_name": "Customer#000000016", "revenue": 161422.04609999998d, "c_acctbal": 4681.03d, "n_name": "IRAN", "c_address": "cYiaeMLZSMAOQ2 d0W,", "c_phone": "20-781-609-3107", "c_comment": "kly silent courts. thinly regular theodolites sleep fluffily after " }
+{ "c_custkey": 44i32, "c_name": "Customer#000000044", "revenue": 149364.5652d, "c_acctbal": 7315.94d, "n_name": "MOZAMBIQUE", "c_address": "Oi,dOSPwDu4jo4x,,P85E0dmhZGvNtBwi", "c_phone": "26-190-260-5375", "c_comment": "r requests around the unusual, bold a" }
+{ "c_custkey": 71i32, "c_name": "Customer#000000071", "revenue": 129481.0245d, "c_acctbal": -611.19d, "n_name": "GERMANY", "c_address": "TlGalgdXWBmMV,6agLyWYDyIz9MKzcY8gl,w6t1B", "c_phone": "17-710-812-5403", "c_comment": "g courts across the regular, final pinto beans are blithely pending ac" }
+{ "c_custkey": 89i32, "c_name": "Customer#000000089", "revenue": 121663.1243d, "c_acctbal": 1530.76d, "n_name": "KENYA", "c_address": "dtR, y9JQWUO6FoJExyp8whOU", "c_phone": "24-394-451-5404", "c_comment": "counts are slyly beyond the slyly final accounts. quickly final ideas wake. r" }
+{ "c_custkey": 112i32, "c_name": "Customer#000000112", "revenue": 111137.7141d, "c_acctbal": 2953.35d, "n_name": "ROMANIA", "c_address": "RcfgG3bO7QeCnfjqJT1", "c_phone": "29-233-262-8382", "c_comment": "rmanently unusual multipliers. blithely ruthless deposits are furiously along the" }
+{ "c_custkey": 62i32, "c_name": "Customer#000000062", "revenue": 106368.0153d, "c_acctbal": 595.61d, "n_name": "GERMANY", "c_address": "upJK2Dnw13,", "c_phone": "17-361-978-7059", "c_comment": "kly special dolphins. pinto beans are slyly. quickly regular accounts are furiously a" }
+{ "c_custkey": 146i32, "c_name": "Customer#000000146", "revenue": 103265.98879999999d, "c_acctbal": 3328.68d, "n_name": "CANADA", "c_address": "GdxkdXG9u7iyI1,,y5tq4ZyrcEy", "c_phone": "13-835-723-3223", "c_comment": "ffily regular dinos are slyly unusual requests. slyly specia" }
+{ "c_custkey": 19i32, "c_name": "Customer#000000019", "revenue": 99306.0127d, "c_acctbal": 8914.71d, "n_name": "CHINA", "c_address": "uc,3bHIx84H,wdrmLOjVsiqXCq2tr", "c_phone": "28-396-526-5053", "c_comment": " nag. furiously careful packages are slyly at the accounts. furiously regular in" }
+{ "c_custkey": 145i32, "c_name": "Customer#000000145", "revenue": 99256.9018d, "c_acctbal": 9748.93d, "n_name": "JORDAN", "c_address": "kQjHmt2kcec cy3hfMh969u", "c_phone": "23-562-444-8454", "c_comment": "ests? express, express instructions use. blithely fina" }
+{ "c_custkey": 103i32, "c_name": "Customer#000000103", "revenue": 97311.77240000002d, "c_acctbal": 2757.45d, "n_name": "INDONESIA", "c_address": "8KIsQX4LJ7QMsj6DrtFtXu0nUEdV,8a", "c_phone": "19-216-107-2107", "c_comment": "furiously pending notornis boost slyly around the blithely ironic ideas? final, even instructions cajole fl" }
+{ "c_custkey": 136i32, "c_name": "Customer#000000136", "revenue": 95855.39799999999d, "c_acctbal": -842.39d, "n_name": "GERMANY", "c_address": "QoLsJ0v5C1IQbh,DS1", "c_phone": "17-501-210-4726", "c_comment": "ackages sleep ironic, final courts. even requests above the blithely bold requests g" }
+{ "c_custkey": 53i32, "c_name": "Customer#000000053", "revenue": 92568.9124d, "c_acctbal": 4113.64d, "n_name": "MOROCCO", "c_address": "HnaxHzTfFTZs8MuCpJyTbZ47Cm4wFOOgib", "c_phone": "25-168-852-5363", "c_comment": "ar accounts are. even foxes are blithely. fluffily pending deposits boost" }
+{ "c_custkey": 49i32, "c_name": "Customer#000000049", "revenue": 90965.7262d, "c_acctbal": 4573.94d, "n_name": "IRAN", "c_address": "cNgAeX7Fqrdf7HQN9EwjUa4nxT,68L FKAxzl", "c_phone": "20-908-631-4424", "c_comment": "nusual foxes! fluffily pending packages maintain to the regular " }
+{ "c_custkey": 37i32, "c_name": "Customer#000000037", "revenue": 88065.74579999999d, "c_acctbal": -917.75d, "n_name": "INDIA", "c_address": "7EV4Pwh,3SboctTWt", "c_phone": "18-385-235-7162", "c_comment": "ilent packages are carefully among the deposits. furiousl" }
+{ "c_custkey": 82i32, "c_name": "Customer#000000082", "revenue": 86998.9644d, "c_acctbal": 9468.34d, "n_name": "CHINA", "c_address": "zhG3EZbap4c992Gj3bK,3Ne,Xn", "c_phone": "28-159-442-5305", "c_comment": "s wake. bravely regular accounts are furiously. regula" }
+{ "c_custkey": 125i32, "c_name": "Customer#000000125", "revenue": 84808.068d, "c_acctbal": -234.12d, "n_name": "ROMANIA", "c_address": ",wSZXdVR xxIIfm9s8ITyLl3kgjT6UC07GY0Y", "c_phone": "29-261-996-3120", "c_comment": "x-ray finally after the packages? regular requests c" }
+{ "c_custkey": 59i32, "c_name": "Customer#000000059", "revenue": 84655.5711d, "c_acctbal": 3458.6d, "n_name": "ARGENTINA", "c_address": "zLOCP0wh92OtBihgspOGl4", "c_phone": "11-355-584-3112", "c_comment": "ously final packages haggle blithely after the express deposits. furiou" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.1.adm
new file mode 100644
index 0000000..ed5dae4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q10_returned_item_int64/q10_returned_item_int64.1.adm
@@ -0,0 +1,20 @@
+{ "c_custkey": 121, "c_name": "Customer#000000121", "revenue": 282635.1719d, "c_acctbal": 6428.32d, "n_name": "PERU", "c_address": "tv nCR2YKupGN73mQudO", "c_phone": "27-411-990-2959", "c_comment": "uriously stealthy ideas. carefully final courts use carefully" }
+{ "c_custkey": 124, "c_name": "Customer#000000124", "revenue": 222182.5188d, "c_acctbal": 1842.49d, "n_name": "CHINA", "c_address": "aTbyVAW5tCd,v09O", "c_phone": "28-183-750-7809", "c_comment": "le fluffily even dependencies. quietly s" }
+{ "c_custkey": 106, "c_name": "Customer#000000106", "revenue": 190241.3334d, "c_acctbal": 3288.42d, "n_name": "ARGENTINA", "c_address": "xGCOEAUjUNG", "c_phone": "11-751-989-4627", "c_comment": "lose slyly. ironic accounts along the evenly regular theodolites wake about the special, final gifts. " }
+{ "c_custkey": 16, "c_name": "Customer#000000016", "revenue": 161422.04609999998d, "c_acctbal": 4681.03d, "n_name": "IRAN", "c_address": "cYiaeMLZSMAOQ2 d0W,", "c_phone": "20-781-609-3107", "c_comment": "kly silent courts. thinly regular theodolites sleep fluffily after " }
+{ "c_custkey": 44, "c_name": "Customer#000000044", "revenue": 149364.5652d, "c_acctbal": 7315.94d, "n_name": "MOZAMBIQUE", "c_address": "Oi,dOSPwDu4jo4x,,P85E0dmhZGvNtBwi", "c_phone": "26-190-260-5375", "c_comment": "r requests around the unusual, bold a" }
+{ "c_custkey": 71, "c_name": "Customer#000000071", "revenue": 129481.02450000001d, "c_acctbal": -611.19d, "n_name": "GERMANY", "c_address": "TlGalgdXWBmMV,6agLyWYDyIz9MKzcY8gl,w6t1B", "c_phone": "17-710-812-5403", "c_comment": "g courts across the regular, final pinto beans are blithely pending ac" }
+{ "c_custkey": 89, "c_name": "Customer#000000089", "revenue": 121663.1243d, "c_acctbal": 1530.76d, "n_name": "KENYA", "c_address": "dtR, y9JQWUO6FoJExyp8whOU", "c_phone": "24-394-451-5404", "c_comment": "counts are slyly beyond the slyly final accounts. quickly final ideas wake. r" }
+{ "c_custkey": 112, "c_name": "Customer#000000112", "revenue": 111137.7141d, "c_acctbal": 2953.35d, "n_name": "ROMANIA", "c_address": "RcfgG3bO7QeCnfjqJT1", "c_phone": "29-233-262-8382", "c_comment": "rmanently unusual multipliers. blithely ruthless deposits are furiously along the" }
+{ "c_custkey": 62, "c_name": "Customer#000000062", "revenue": 106368.0153d, "c_acctbal": 595.61d, "n_name": "GERMANY", "c_address": "upJK2Dnw13,", "c_phone": "17-361-978-7059", "c_comment": "kly special dolphins. pinto beans are slyly. quickly regular accounts are furiously a" }
+{ "c_custkey": 146, "c_name": "Customer#000000146", "revenue": 103265.98879999999d, "c_acctbal": 3328.68d, "n_name": "CANADA", "c_address": "GdxkdXG9u7iyI1,,y5tq4ZyrcEy", "c_phone": "13-835-723-3223", "c_comment": "ffily regular dinos are slyly unusual requests. slyly specia" }
+{ "c_custkey": 19, "c_name": "Customer#000000019", "revenue": 99306.0127d, "c_acctbal": 8914.71d, "n_name": "CHINA", "c_address": "uc,3bHIx84H,wdrmLOjVsiqXCq2tr", "c_phone": "28-396-526-5053", "c_comment": " nag. furiously careful packages are slyly at the accounts. furiously regular in" }
+{ "c_custkey": 145, "c_name": "Customer#000000145", "revenue": 99256.9018d, "c_acctbal": 9748.93d, "n_name": "JORDAN", "c_address": "kQjHmt2kcec cy3hfMh969u", "c_phone": "23-562-444-8454", "c_comment": "ests? express, express instructions use. blithely fina" }
+{ "c_custkey": 103, "c_name": "Customer#000000103", "revenue": 97311.77240000002d, "c_acctbal": 2757.45d, "n_name": "INDONESIA", "c_address": "8KIsQX4LJ7QMsj6DrtFtXu0nUEdV,8a", "c_phone": "19-216-107-2107", "c_comment": "furiously pending notornis boost slyly around the blithely ironic ideas? final, even instructions cajole fl" }
+{ "c_custkey": 136, "c_name": "Customer#000000136", "revenue": 95855.39799999999d, "c_acctbal": -842.39d, "n_name": "GERMANY", "c_address": "QoLsJ0v5C1IQbh,DS1", "c_phone": "17-501-210-4726", "c_comment": "ackages sleep ironic, final courts. even requests above the blithely bold requests g" }
+{ "c_custkey": 53, "c_name": "Customer#000000053", "revenue": 92568.9124d, "c_acctbal": 4113.64d, "n_name": "MOROCCO", "c_address": "HnaxHzTfFTZs8MuCpJyTbZ47Cm4wFOOgib", "c_phone": "25-168-852-5363", "c_comment": "ar accounts are. even foxes are blithely. fluffily pending deposits boost" }
+{ "c_custkey": 49, "c_name": "Customer#000000049", "revenue": 90965.7262d, "c_acctbal": 4573.94d, "n_name": "IRAN", "c_address": "cNgAeX7Fqrdf7HQN9EwjUa4nxT,68L FKAxzl", "c_phone": "20-908-631-4424", "c_comment": "nusual foxes! fluffily pending packages maintain to the regular " }
+{ "c_custkey": 37, "c_name": "Customer#000000037", "revenue": 88065.74579999999d, "c_acctbal": -917.75d, "n_name": "INDIA", "c_address": "7EV4Pwh,3SboctTWt", "c_phone": "18-385-235-7162", "c_comment": "ilent packages are carefully among the deposits. furiousl" }
+{ "c_custkey": 82, "c_name": "Customer#000000082", "revenue": 86998.9644d, "c_acctbal": 9468.34d, "n_name": "CHINA", "c_address": "zhG3EZbap4c992Gj3bK,3Ne,Xn", "c_phone": "28-159-442-5305", "c_comment": "s wake. bravely regular accounts are furiously. regula" }
+{ "c_custkey": 125, "c_name": "Customer#000000125", "revenue": 84808.068d, "c_acctbal": -234.12d, "n_name": "ROMANIA", "c_address": ",wSZXdVR xxIIfm9s8ITyLl3kgjT6UC07GY0Y", "c_phone": "29-261-996-3120", "c_comment": "x-ray finally after the packages? regular requests c" }
+{ "c_custkey": 59, "c_name": "Customer#000000059", "revenue": 84655.5711d, "c_acctbal": 3458.6d, "n_name": "ARGENTINA", "c_address": "zLOCP0wh92OtBihgspOGl4", "c_phone": "11-355-584-3112", "c_comment": "ously final packages haggle blithely after the express deposits. furiou" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q11_important_stock/q11_important_stock.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q11_important_stock/q11_important_stock.1.adm
new file mode 100644
index 0000000..0fc28fb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q11_important_stock/q11_important_stock.1.adm
@@ -0,0 +1,200 @@
+{ "partkey": 25, "part_value": 2.832302068E7d }
+{ "partkey": 124, "part_value": 2.59627599E7d }
+{ "partkey": 175, "part_value": 2.385395363E7d }
+{ "partkey": 197, "part_value": 2.248551967E7d }
+{ "partkey": 163, "part_value": 2.099460571E7d }
+{ "partkey": 160, "part_value": 2.00232846E7d }
+{ "partkey": 82, "part_value": 1.991921335E7d }
+{ "partkey": 169, "part_value": 1.898734723E7d }
+{ "partkey": 29, "part_value": 1.867279344E7d }
+{ "partkey": 26, "part_value": 1.861245827E7d }
+{ "partkey": 73, "part_value": 1.827170729E7d }
+{ "partkey": 161, "part_value": 1.7987463009999998E7d }
+{ "partkey": 75, "part_value": 1.7959598009999998E7d }
+{ "partkey": 34, "part_value": 1.778083836E7d }
+{ "partkey": 98, "part_value": 1.7763191509999998E7d }
+{ "partkey": 69, "part_value": 1.728526943E7d }
+{ "partkey": 111, "part_value": 1.7083882619999997E7d }
+{ "partkey": 171, "part_value": 1.635442066E7d }
+{ "partkey": 166, "part_value": 1.6351893740000002E7d }
+{ "partkey": 77, "part_value": 1.598059909E7d }
+{ "partkey": 78, "part_value": 1.58768992E7d }
+{ "partkey": 143, "part_value": 1.585686159E7d }
+{ "partkey": 17, "part_value": 1.547426112E7d }
+{ "partkey": 109, "part_value": 1.5054682620000001E7d }
+{ "partkey": 105, "part_value": 1.5053163809999999E7d }
+{ "partkey": 96, "part_value": 1.495213259E7d }
+{ "partkey": 146, "part_value": 1.481075944E7d }
+{ "partkey": 136, "part_value": 1.465496775E7d }
+{ "partkey": 116, "part_value": 1.4432091339999998E7d }
+{ "partkey": 128, "part_value": 1.4393555259999998E7d }
+{ "partkey": 142, "part_value": 1.422039904E7d }
+{ "partkey": 121, "part_value": 1.420032605E7d }
+{ "partkey": 30, "part_value": 1.416313241E7d }
+{ "partkey": 16, "part_value": 1.413646503E7d }
+{ "partkey": 198, "part_value": 1.413535335E7d }
+{ "partkey": 79, "part_value": 1.38652287E7d }
+{ "partkey": 90, "part_value": 1.373279748E7d }
+{ "partkey": 32, "part_value": 1.369962979E7d }
+{ "partkey": 74, "part_value": 1.338871111E7d }
+{ "partkey": 1, "part_value": 1.337870724E7d }
+{ "partkey": 89, "part_value": 1.337148041E7d }
+{ "partkey": 22, "part_value": 1.3354991740000002E7d }
+{ "partkey": 186, "part_value": 1.317604077E7d }
+{ "partkey": 189, "part_value": 1.305492542E7d }
+{ "partkey": 14, "part_value": 1.299397721E7d }
+{ "partkey": 93, "part_value": 1.299298218E7d }
+{ "partkey": 168, "part_value": 1.299041501E7d }
+{ "partkey": 99, "part_value": 1.2750046790000001E7d }
+{ "partkey": 167, "part_value": 1.268255069E7d }
+{ "partkey": 2, "part_value": 1.258471636E7d }
+{ "partkey": 182, "part_value": 1.256239411E7d }
+{ "partkey": 61, "part_value": 1.253677656E7d }
+{ "partkey": 112, "part_value": 1.234957975E7d }
+{ "partkey": 178, "part_value": 1.2260301739999998E7d }
+{ "partkey": 172, "part_value": 1.219775193E7d }
+{ "partkey": 165, "part_value": 1.219746506E7d }
+{ "partkey": 184, "part_value": 1.216784393E7d }
+{ "partkey": 187, "part_value": 1.214970141E7d }
+{ "partkey": 153, "part_value": 1.2119354219999999E7d }
+{ "partkey": 95, "part_value": 1.20468895E7d }
+{ "partkey": 11, "part_value": 1.2007151559999999E7d }
+{ "partkey": 125, "part_value": 1.2003476109999998E7d }
+{ "partkey": 154, "part_value": 1.185113385E7d }
+{ "partkey": 15, "part_value": 1.1798438790000001E7d }
+{ "partkey": 67, "part_value": 1.178579951E7d }
+{ "partkey": 8, "part_value": 1.1707892620000001E7d }
+{ "partkey": 87, "part_value": 1.168637671E7d }
+{ "partkey": 134, "part_value": 1.1683586929999998E7d }
+{ "partkey": 130, "part_value": 1.1682461489999998E7d }
+{ "partkey": 43, "part_value": 1.161150462E7d }
+{ "partkey": 102, "part_value": 1.151554211E7d }
+{ "partkey": 21, "part_value": 1.141066856E7d }
+{ "partkey": 62, "part_value": 1.138927324E7d }
+{ "partkey": 9, "part_value": 1.126484373E7d }
+{ "partkey": 80, "part_value": 1.118329032E7d }
+{ "partkey": 173, "part_value": 1.102677486E7d }
+{ "partkey": 94, "part_value": 1.092440116E7d }
+{ "partkey": 3, "part_value": 1.075814545E7d }
+{ "partkey": 103, "part_value": 1.06912216E7d }
+{ "partkey": 158, "part_value": 1.067861635E7d }
+{ "partkey": 49, "part_value": 1.06445572E7d }
+{ "partkey": 139, "part_value": 1.044045371E7d }
+{ "partkey": 192, "part_value": 1.035745974E7d }
+{ "partkey": 24, "part_value": 1.033911936E7d }
+{ "partkey": 39, "part_value": 1.03210148E7d }
+{ "partkey": 156, "part_value": 1.014364082E7d }
+{ "partkey": 188, "part_value": 1.011906085E7d }
+{ "partkey": 12, "part_value": 1.01085874E7d }
+{ "partkey": 33, "part_value": 1.005296264E7d }
+{ "partkey": 28, "part_value": 1.005234286E7d }
+{ "partkey": 40, "part_value": 9927827.77d }
+{ "partkey": 199, "part_value": 9907803.559999999d }
+{ "partkey": 193, "part_value": 9869674.77d }
+{ "partkey": 106, "part_value": 9869361.73d }
+{ "partkey": 108, "part_value": 9868370.309999999d }
+{ "partkey": 183, "part_value": 9855564.82d }
+{ "partkey": 70, "part_value": 9700431.94d }
+{ "partkey": 48, "part_value": 9655921.88d }
+{ "partkey": 118, "part_value": 9622756.15d }
+{ "partkey": 13, "part_value": 9592610.32d }
+{ "partkey": 83, "part_value": 9543465.08d }
+{ "partkey": 159, "part_value": 9519909.44d }
+{ "partkey": 147, "part_value": 9513932.18d }
+{ "partkey": 45, "part_value": 9423874.47d }
+{ "partkey": 117, "part_value": 9408426.72d }
+{ "partkey": 135, "part_value": 9311247.280000001d }
+{ "partkey": 185, "part_value": 9305341.780000001d }
+{ "partkey": 131, "part_value": 9223742.49d }
+{ "partkey": 7, "part_value": 9175528.21d }
+{ "partkey": 71, "part_value": 9167712.04d }
+{ "partkey": 100, "part_value": 9131099.530000001d }
+{ "partkey": 76, "part_value": 9092927.11d }
+{ "partkey": 53, "part_value": 8979121.97d }
+{ "partkey": 141, "part_value": 8686511.120000001d }
+{ "partkey": 64, "part_value": 8627897.290000001d }
+{ "partkey": 101, "part_value": 8521762.0d }
+{ "partkey": 176, "part_value": 8510175.88d }
+{ "partkey": 19, "part_value": 8481679.5d }
+{ "partkey": 194, "part_value": 8464559.54d }
+{ "partkey": 91, "part_value": 8460636.52d }
+{ "partkey": 132, "part_value": 8416851.239999998d }
+{ "partkey": 113, "part_value": 8405217.96d }
+{ "partkey": 51, "part_value": 8247118.499999999d }
+{ "partkey": 41, "part_value": 8187897.16d }
+{ "partkey": 55, "part_value": 8092552.890000001d }
+{ "partkey": 72, "part_value": 8007155.3d }
+{ "partkey": 115, "part_value": 7954624.0d }
+{ "partkey": 170, "part_value": 7895241.609999999d }
+{ "partkey": 114, "part_value": 7832023.28d }
+{ "partkey": 37, "part_value": 7809598.659999999d }
+{ "partkey": 54, "part_value": 7578243.79d }
+{ "partkey": 180, "part_value": 7531794.4799999995d }
+{ "partkey": 60, "part_value": 7508961.69d }
+{ "partkey": 31, "part_value": 7433034.240000001d }
+{ "partkey": 35, "part_value": 7132671.49d }
+{ "partkey": 140, "part_value": 7122050.08d }
+{ "partkey": 150, "part_value": 7106237.92d }
+{ "partkey": 107, "part_value": 7082828.68d }
+{ "partkey": 123, "part_value": 7049500.720000001d }
+{ "partkey": 190, "part_value": 7017966.9d }
+{ "partkey": 120, "part_value": 6920857.090000001d }
+{ "partkey": 196, "part_value": 6905182.43d }
+{ "partkey": 177, "part_value": 6887257.27d }
+{ "partkey": 126, "part_value": 6813302.029999999d }
+{ "partkey": 122, "part_value": 6812763.34d }
+{ "partkey": 200, "part_value": 6780024.53d }
+{ "partkey": 157, "part_value": 6766365.680000001d }
+{ "partkey": 63, "part_value": 6724960.14d }
+{ "partkey": 38, "part_value": 6667789.55d }
+{ "partkey": 58, "part_value": 6640619.380000001d }
+{ "partkey": 145, "part_value": 6633786.59d }
+{ "partkey": 144, "part_value": 6546945.92d }
+{ "partkey": 20, "part_value": 6533101.39d }
+{ "partkey": 127, "part_value": 6483139.620000001d }
+{ "partkey": 10, "part_value": 6433776.51d }
+{ "partkey": 47, "part_value": 6407355.369999999d }
+{ "partkey": 191, "part_value": 6347187.43d }
+{ "partkey": 137, "part_value": 6180452.85d }
+{ "partkey": 56, "part_value": 6145826.6d }
+{ "partkey": 104, "part_value": 6134341.85d }
+{ "partkey": 44, "part_value": 6038126.66d }
+{ "partkey": 97, "part_value": 6036047.1899999995d }
+{ "partkey": 181, "part_value": 5853464.149999999d }
+{ "partkey": 162, "part_value": 5829410.54d }
+{ "partkey": 86, "part_value": 5746713.88d }
+{ "partkey": 52, "part_value": 5680644.4799999995d }
+{ "partkey": 155, "part_value": 5552007.57d }
+{ "partkey": 92, "part_value": 5489588.279999999d }
+{ "partkey": 5, "part_value": 5461046.930000001d }
+{ "partkey": 18, "part_value": 5456316.21d }
+{ "partkey": 149, "part_value": 5367514.63d }
+{ "partkey": 110, "part_value": 5261352.11d }
+{ "partkey": 4, "part_value": 5162989.07d }
+{ "partkey": 6, "part_value": 5120392.470000001d }
+{ "partkey": 148, "part_value": 5061589.27d }
+{ "partkey": 42, "part_value": 4957032.47d }
+{ "partkey": 119, "part_value": 4954403.4799999995d }
+{ "partkey": 84, "part_value": 4891082.38d }
+{ "partkey": 65, "part_value": 4834763.09d }
+{ "partkey": 66, "part_value": 4719253.369999999d }
+{ "partkey": 179, "part_value": 4610607.919999999d }
+{ "partkey": 23, "part_value": 4531731.12d }
+{ "partkey": 68, "part_value": 4504770.61d }
+{ "partkey": 27, "part_value": 4371849.52d }
+{ "partkey": 36, "part_value": 4036576.8999999994d }
+{ "partkey": 129, "part_value": 3997604.78d }
+{ "partkey": 195, "part_value": 3817436.31d }
+{ "partkey": 59, "part_value": 3765210.2100000004d }
+{ "partkey": 57, "part_value": 3739347.12d }
+{ "partkey": 138, "part_value": 3567425.75d }
+{ "partkey": 174, "part_value": 3484708.3100000005d }
+{ "partkey": 164, "part_value": 3462215.0d }
+{ "partkey": 81, "part_value": 3421610.42d }
+{ "partkey": 46, "part_value": 3398443.33d }
+{ "partkey": 85, "part_value": 3338711.3899999997d }
+{ "partkey": 50, "part_value": 3145791.9699999997d }
+{ "partkey": 88, "part_value": 3117730.2399999998d }
+{ "partkey": 151, "part_value": 2727444.22d }
+{ "partkey": 152, "part_value": 1837809.1700000002d }
+{ "partkey": 133, "part_value": 1517282.3299999998d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q12_shipping/q12_shipping.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q12_shipping/q12_shipping.1.adm
new file mode 100644
index 0000000..e0eeaf8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q12_shipping/q12_shipping.1.adm
@@ -0,0 +1,2 @@
+{ "l_shipmode": "MAIL", "high_line_count": 5, "low_line_count": 5 }
+{ "l_shipmode": "SHIP", "high_line_count": 5, "low_line_count": 10 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q13_customer_distribution/q13_customer_distribution.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q13_customer_distribution/q13_customer_distribution.1.adm
new file mode 100644
index 0000000..9257a84
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q13_customer_distribution/q13_customer_distribution.1.adm
@@ -0,0 +1,27 @@
+{ "c_count": 0, "custdist": 50 }
+{ "c_count": 16, "custdist": 8 }
+{ "c_count": 17, "custdist": 7 }
+{ "c_count": 20, "custdist": 6 }
+{ "c_count": 13, "custdist": 6 }
+{ "c_count": 12, "custdist": 6 }
+{ "c_count": 9, "custdist": 6 }
+{ "c_count": 23, "custdist": 5 }
+{ "c_count": 14, "custdist": 5 }
+{ "c_count": 10, "custdist": 5 }
+{ "c_count": 21, "custdist": 4 }
+{ "c_count": 18, "custdist": 4 }
+{ "c_count": 11, "custdist": 4 }
+{ "c_count": 8, "custdist": 4 }
+{ "c_count": 7, "custdist": 4 }
+{ "c_count": 26, "custdist": 3 }
+{ "c_count": 22, "custdist": 3 }
+{ "c_count": 6, "custdist": 3 }
+{ "c_count": 5, "custdist": 3 }
+{ "c_count": 4, "custdist": 3 }
+{ "c_count": 29, "custdist": 2 }
+{ "c_count": 24, "custdist": 2 }
+{ "c_count": 19, "custdist": 2 }
+{ "c_count": 15, "custdist": 2 }
+{ "c_count": 28, "custdist": 1 }
+{ "c_count": 25, "custdist": 1 }
+{ "c_count": 3, "custdist": 1 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q14_promotion_effect/q14_promotion_effect.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q14_promotion_effect/q14_promotion_effect.1.adm
new file mode 100644
index 0000000..ed5098a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q14_promotion_effect/q14_promotion_effect.1.adm
@@ -0,0 +1 @@
+15.23021261159725d
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q15_top_supplier/q15_top_supplier.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q15_top_supplier/q15_top_supplier.1.adm
new file mode 100644
index 0000000..817794b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q15_top_supplier/q15_top_supplier.1.adm
@@ -0,0 +1 @@
+{ "s_suppkey": 10, "s_name": "Supplier#000000010", "s_address": "Saygah3gYWMp72i PY", "s_phone": "34-852-489-8585", "total_revenue": 797313.3838d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.adm
new file mode 100644
index 0000000..045b764
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.adm
@@ -0,0 +1,34 @@
+{ "p_brand": "Brand#11", "p_type": "PROMO ANODIZED TIN", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#11", "p_type": "SMALL PLATED COPPER", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#11", "p_type": "STANDARD POLISHED TIN", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#13", "p_type": "MEDIUM ANODIZED STEEL", "p_size": 36, "supplier_cnt": 4 }
+{ "p_brand": "Brand#13", "p_type": "SMALL BRUSHED NICKEL", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#14", "p_type": "SMALL ANODIZED NICKEL", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#15", "p_type": "LARGE ANODIZED BRASS", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#21", "p_type": "LARGE BURNISHED COPPER", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#23", "p_type": "ECONOMY BRUSHED COPPER", "p_size": 9, "supplier_cnt": 4 }
+{ "p_brand": "Brand#24", "p_type": "MEDIUM PLATED STEEL", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#25", "p_type": "MEDIUM PLATED BRASS", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#31", "p_type": "ECONOMY PLATED STEEL", "p_size": 23, "supplier_cnt": 4 }
+{ "p_brand": "Brand#31", "p_type": "PROMO POLISHED TIN", "p_size": 23, "supplier_cnt": 4 }
+{ "p_brand": "Brand#32", "p_type": "MEDIUM BURNISHED BRASS", "p_size": 49, "supplier_cnt": 4 }
+{ "p_brand": "Brand#33", "p_type": "LARGE BRUSHED TIN", "p_size": 36, "supplier_cnt": 4 }
+{ "p_brand": "Brand#33", "p_type": "SMALL BURNISHED NICKEL", "p_size": 3, "supplier_cnt": 4 }
+{ "p_brand": "Brand#34", "p_type": "LARGE PLATED BRASS", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#34", "p_type": "MEDIUM BRUSHED COPPER", "p_size": 9, "supplier_cnt": 4 }
+{ "p_brand": "Brand#34", "p_type": "SMALL PLATED BRASS", "p_size": 14, "supplier_cnt": 4 }
+{ "p_brand": "Brand#35", "p_type": "STANDARD ANODIZED STEEL", "p_size": 23, "supplier_cnt": 4 }
+{ "p_brand": "Brand#43", "p_type": "MEDIUM ANODIZED BRASS", "p_size": 14, "supplier_cnt": 4 }
+{ "p_brand": "Brand#43", "p_type": "PROMO POLISHED BRASS", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#43", "p_type": "SMALL BRUSHED NICKEL", "p_size": 9, "supplier_cnt": 4 }
+{ "p_brand": "Brand#44", "p_type": "SMALL PLATED COPPER", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#51", "p_type": "ECONOMY POLISHED STEEL", "p_size": 49, "supplier_cnt": 4 }
+{ "p_brand": "Brand#52", "p_type": "MEDIUM BURNISHED TIN", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#52", "p_type": "SMALL BURNISHED NICKEL", "p_size": 14, "supplier_cnt": 4 }
+{ "p_brand": "Brand#53", "p_type": "LARGE BURNISHED NICKEL", "p_size": 23, "supplier_cnt": 4 }
+{ "p_brand": "Brand#53", "p_type": "MEDIUM BRUSHED COPPER", "p_size": 3, "supplier_cnt": 4 }
+{ "p_brand": "Brand#53", "p_type": "STANDARD PLATED STEEL", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#54", "p_type": "ECONOMY ANODIZED BRASS", "p_size": 9, "supplier_cnt": 4 }
+{ "p_brand": "Brand#55", "p_type": "STANDARD ANODIZED BRASS", "p_size": 36, "supplier_cnt": 4 }
+{ "p_brand": "Brand#55", "p_type": "STANDARD BRUSHED COPPER", "p_size": 3, "supplier_cnt": 4 }
+{ "p_brand": "Brand#25", "p_type": "SMALL BURNISHED COPPER", "p_size": 3, "supplier_cnt": 3 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.3.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.3.adm
new file mode 100644
index 0000000..a109ef1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q17_large_gby_variant/q17_large_gby_variant.3.adm
@@ -0,0 +1,200 @@
+{ "t_partkey": 1, "t_count": 35, "t_avg_quantity": 5.28d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 23786.4d, "t_avg_discount": 0.044000000000000004d, "t_avg_tax": 0.049142857142857155d, "t_max_shipdate": "1997-08-08", "t_min_commitdate": "1992-04-02", "t_min_receiptdate": "1992-02-28", "t_max_comment": "y ironic requests. bold, final ideas a" }
+{ "t_partkey": 2, "t_count": 34, "t_avg_quantity": 4.347058823529411d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 19605.235294117647d, "t_avg_discount": 0.049705882352941176d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-05-31", "t_min_commitdate": "1992-07-12", "t_min_receiptdate": "1992-07-08", "t_max_comment": "yly final dolphins? quickly ironic frets" }
+{ "t_partkey": 3, "t_count": 27, "t_avg_quantity": 4.896296296296296d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 22106.777777777777d, "t_avg_discount": 0.05481481481481482d, "t_avg_tax": 0.04185185185185186d, "t_max_shipdate": "1998-05-22", "t_min_commitdate": "1992-03-20", "t_min_receiptdate": "1992-05-04", "t_max_comment": "yly blithely pending packages" }
+{ "t_partkey": 4, "t_count": 26, "t_avg_quantity": 4.2615384615384615d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 19262.153846153848d, "t_avg_discount": 0.056538461538461544d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-08-26", "t_min_commitdate": "1992-03-21", "t_min_receiptdate": "1992-05-27", "t_max_comment": "y regular packages haggle furiously alongs" }
+{ "t_partkey": 5, "t_count": 32, "t_avg_quantity": 5.4750000000000005d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24774.375d, "t_avg_discount": 0.04125d, "t_avg_tax": 0.0390625d, "t_max_shipdate": "1998-07-19", "t_min_commitdate": "1992-05-12", "t_min_receiptdate": "1992-05-10", "t_max_comment": "y. careful" }
+{ "t_partkey": 6, "t_count": 34, "t_avg_quantity": 5.2058823529411775d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23582.647058823528d, "t_avg_discount": 0.05676470588235293d, "t_avg_tax": 0.04176470588235294d, "t_max_shipdate": "1998-09-05", "t_min_commitdate": "1992-04-24", "t_min_receiptdate": "1992-04-08", "t_max_comment": "yly express " }
+{ "t_partkey": 7, "t_count": 22, "t_avg_quantity": 4.7d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 21314.5d, "t_avg_discount": 0.05772727272727273d, "t_avg_tax": 0.041818181818181824d, "t_max_shipdate": "1998-07-27", "t_min_commitdate": "1992-05-31", "t_min_receiptdate": "1992-04-21", "t_max_comment": "ss the ironic, regular asymptotes cajole " }
+{ "t_partkey": 8, "t_count": 24, "t_avg_quantity": 4.783333333333334d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 21716.333333333332d, "t_avg_discount": 0.055d, "t_avg_tax": 0.04958333333333333d, "t_max_shipdate": "1998-07-04", "t_min_commitdate": "1992-10-24", "t_min_receiptdate": "1992-10-11", "t_max_comment": "uctions. furiously regular ins" }
+{ "t_partkey": 9, "t_count": 29, "t_avg_quantity": 5.331034482758621d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24229.55172413793d, "t_avg_discount": 0.04206896551724139d, "t_avg_tax": 0.03896551724137932d, "t_max_shipdate": "1998-06-12", "t_min_commitdate": "1992-03-30", "t_min_receiptdate": "1992-05-23", "t_max_comment": "yly ironic" }
+{ "t_partkey": 10, "t_count": 31, "t_avg_quantity": 5.509677419354839d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 25069.307741935485d, "t_avg_discount": 0.052903225806451626d, "t_avg_tax": 0.04548387096774194d, "t_max_shipdate": "1998-10-02", "t_min_commitdate": "1992-07-21", "t_min_receiptdate": "1992-05-18", "t_max_comment": "y quickly ironic accounts." }
+{ "t_partkey": 11, "t_count": 28, "t_avg_quantity": 5.521428571428572d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25150.383214285714d, "t_avg_discount": 0.05d, "t_avg_tax": 0.046071428571428576d, "t_max_shipdate": "1998-07-12", "t_min_commitdate": "1992-03-15", "t_min_receiptdate": "1992-02-26", "t_max_comment": "ven dependencies x-ray. quic" }
+{ "t_partkey": 12, "t_count": 24, "t_avg_quantity": 4.966666666666667d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 22648.248333333333d, "t_avg_discount": 0.04791666666666667d, "t_avg_tax": 0.05083333333333334d, "t_max_shipdate": "1998-04-14", "t_min_commitdate": "1992-05-03", "t_min_receiptdate": "1992-07-29", "t_max_comment": "xpress grouc" }
+{ "t_partkey": 13, "t_count": 26, "t_avg_quantity": 5.038461538461539d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23000.828846153847d, "t_avg_discount": 0.04153846153846154d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-10-04", "t_min_commitdate": "1992-03-31", "t_min_receiptdate": "1992-04-21", "t_max_comment": "wake at the carefully speci" }
+{ "t_partkey": 14, "t_count": 25, "t_avg_quantity": 4.5840000000000005d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 20949.1092d, "t_avg_discount": 0.055600000000000004d, "t_avg_tax": 0.0436d, "t_max_shipdate": "1998-10-17", "t_min_commitdate": "1992-07-16", "t_min_receiptdate": "1992-08-05", "t_max_comment": "thely. furio" }
+{ "t_partkey": 15, "t_count": 21, "t_avg_quantity": 5.133333333333334d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23485.256666666664d, "t_avg_discount": 0.051428571428571435d, "t_avg_tax": 0.03142857142857143d, "t_max_shipdate": "1998-02-14", "t_min_commitdate": "1992-04-01", "t_min_receiptdate": "1992-05-26", "t_max_comment": "ymptotes nag furiously slyly even inst" }
+{ "t_partkey": 16, "t_count": 29, "t_avg_quantity": 4.731034482758621d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 21668.37448275862d, "t_avg_discount": 0.049310344827586214d, "t_avg_tax": 0.034482758620689655d, "t_max_shipdate": "1998-11-02", "t_min_commitdate": "1992-08-06", "t_min_receiptdate": "1992-09-12", "t_max_comment": "yly blithely stealthy deposits. carefu" }
+{ "t_partkey": 17, "t_count": 31, "t_avg_quantity": 5.270967741935484d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 24167.650645161288d, "t_avg_discount": 0.05387096774193549d, "t_avg_tax": 0.04709677419354839d, "t_max_shipdate": "1998-10-04", "t_min_commitdate": "1992-08-07", "t_min_receiptdate": "1992-08-13", "t_max_comment": "uriously thin pinto beans " }
+{ "t_partkey": 18, "t_count": 32, "t_avg_quantity": 5.4437500000000005d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 24987.0846875d, "t_avg_discount": 0.05500000000000001d, "t_avg_tax": 0.039375d, "t_max_shipdate": "1998-11-13", "t_min_commitdate": "1992-04-14", "t_min_receiptdate": "1992-04-13", "t_max_comment": "y special packages. carefully ironic instru" }
+{ "t_partkey": 19, "t_count": 29, "t_avg_quantity": 5.151724137931034d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23672.43d, "t_avg_discount": 0.05275862068965517d, "t_avg_tax": 0.03896551724137932d, "t_max_shipdate": "1998-08-04", "t_min_commitdate": "1992-07-07", "t_min_receiptdate": "1992-08-15", "t_max_comment": "y along the excuses." }
+{ "t_partkey": 20, "t_count": 27, "t_avg_quantity": 4.955555555555556d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 22796.05111111111d, "t_avg_discount": 0.042222222222222223d, "t_avg_tax": 0.035555555555555556d, "t_max_shipdate": "1998-06-11", "t_min_commitdate": "1992-07-13", "t_min_receiptdate": "1992-06-21", "t_max_comment": "y. blithely r" }
+{ "t_partkey": 21, "t_count": 26, "t_avg_quantity": 4.730769230769231d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 21785.665384615386d, "t_avg_discount": 0.054615384615384614d, "t_avg_tax": 0.04076923076923077d, "t_max_shipdate": "1998-02-27", "t_min_commitdate": "1992-09-11", "t_min_receiptdate": "1992-08-08", "t_max_comment": "ymptotes haggle across the ca" }
+{ "t_partkey": 22, "t_count": 28, "t_avg_quantity": 5.300000000000001d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 24433.53d, "t_avg_discount": 0.057857142857142864d, "t_avg_tax": 0.045d, "t_max_shipdate": "1998-09-03", "t_min_commitdate": "1992-05-23", "t_min_receiptdate": "1992-07-12", "t_max_comment": "y final gifts are. carefully pe" }
+{ "t_partkey": 23, "t_count": 23, "t_avg_quantity": 5.22608695652174d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 24118.913913043478d, "t_avg_discount": 0.051304347826086956d, "t_avg_tax": 0.03173913043478261d, "t_max_shipdate": "1998-09-25", "t_min_commitdate": "1992-04-05", "t_min_receiptdate": "1992-05-02", "t_max_comment": "y unusual foxe" }
+{ "t_partkey": 24, "t_count": 35, "t_avg_quantity": 5.154285714285715d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23813.31542857143d, "t_avg_discount": 0.046d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-06-23", "t_min_commitdate": "1992-05-07", "t_min_receiptdate": "1992-04-21", "t_max_comment": "the slyly ironic pinto beans. fi" }
+{ "t_partkey": 25, "t_count": 26, "t_avg_quantity": 5.061538461538461d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23410.121538461535d, "t_avg_discount": 0.054615384615384614d, "t_avg_tax": 0.034999999999999996d, "t_max_shipdate": "1998-06-26", "t_min_commitdate": "1992-03-18", "t_min_receiptdate": "1992-02-24", "t_max_comment": "y alongside of the special requests." }
+{ "t_partkey": 26, "t_count": 23, "t_avg_quantity": 4.6521739130434785d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21540.030434782606d, "t_avg_discount": 0.03956521739130436d, "t_avg_tax": 0.043043478260869565d, "t_max_shipdate": "1998-10-09", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-03-20", "t_max_comment": "y special pinto beans cajole " }
+{ "t_partkey": 27, "t_count": 18, "t_avg_quantity": 5.9222222222222225d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 27450.092222222225d, "t_avg_discount": 0.061111111111111116d, "t_avg_tax": 0.045000000000000005d, "t_max_shipdate": "1998-09-19", "t_min_commitdate": "1992-06-12", "t_min_receiptdate": "1992-07-31", "t_max_comment": "y regular foxes. slyly ironic deposits " }
+{ "t_partkey": 28, "t_count": 21, "t_avg_quantity": 5.476190476190476d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 25410.071428571428d, "t_avg_discount": 0.04285714285714286d, "t_avg_tax": 0.032857142857142856d, "t_max_shipdate": "1998-01-02", "t_min_commitdate": "1992-05-31", "t_min_receiptdate": "1992-04-05", "t_max_comment": "ular accounts about" }
+{ "t_partkey": 29, "t_count": 35, "t_avg_quantity": 5.171428571428572d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24021.802857142855d, "t_avg_discount": 0.05657142857142857d, "t_avg_tax": 0.03942857142857143d, "t_max_shipdate": "1998-11-17", "t_min_commitdate": "1992-05-19", "t_min_receiptdate": "1992-06-06", "t_max_comment": "xcuses? quickly stealthy dependenci" }
+{ "t_partkey": 30, "t_count": 22, "t_avg_quantity": 4.754545454545455d, "t_max_suppkey": 9, "t_max_linenumber": 5, "t_avg_extendedprice": 22109.349545454545d, "t_avg_discount": 0.04727272727272727d, "t_avg_tax": 0.03318181818181818d, "t_max_shipdate": "1998-07-18", "t_min_commitdate": "1992-04-06", "t_min_receiptdate": "1992-05-01", "t_max_comment": "y. fluffily pending d" }
+{ "t_partkey": 31, "t_count": 31, "t_avg_quantity": 5.858064516129033d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 27270.16903225807d, "t_avg_discount": 0.050645161290322586d, "t_avg_tax": 0.035483870967741936d, "t_max_shipdate": "1998-08-08", "t_min_commitdate": "1992-05-23", "t_min_receiptdate": "1992-07-25", "t_max_comment": "xpress ideas detect b" }
+{ "t_partkey": 32, "t_count": 28, "t_avg_quantity": 5.050000000000001d, "t_max_suppkey": 8, "t_max_linenumber": 5, "t_avg_extendedprice": 23533.7575d, "t_avg_discount": 0.05249999999999999d, "t_avg_tax": 0.03321428571428571d, "t_max_shipdate": "1998-03-22", "t_min_commitdate": "1992-07-21", "t_min_receiptdate": "1992-09-27", "t_max_comment": "yers. accounts affix somet" }
+{ "t_partkey": 33, "t_count": 25, "t_avg_quantity": 5.04d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 23512.356d, "t_avg_discount": 0.044000000000000004d, "t_avg_tax": 0.03440000000000001d, "t_max_shipdate": "1998-08-01", "t_min_commitdate": "1992-04-26", "t_min_receiptdate": "1992-04-16", "t_max_comment": "yly enticing requ" }
+{ "t_partkey": 34, "t_count": 33, "t_avg_quantity": 4.575757575757576d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 21369.474242424243d, "t_avg_discount": 0.04666666666666667d, "t_avg_tax": 0.04363636363636364d, "t_max_shipdate": "1998-10-22", "t_min_commitdate": "1992-05-10", "t_min_receiptdate": "1992-07-24", "t_max_comment": "warthogs wake carefully acro" }
+{ "t_partkey": 35, "t_count": 26, "t_avg_quantity": 4.753846153846154d, "t_max_suppkey": 6, "t_max_linenumber": 6, "t_avg_extendedprice": 22224.94384615385d, "t_avg_discount": 0.05615384615384615d, "t_avg_tax": 0.04307692307692308d, "t_max_shipdate": "1998-08-13", "t_min_commitdate": "1992-04-12", "t_min_receiptdate": "1992-03-30", "t_max_comment": "y pending packages sleep blithely regular r" }
+{ "t_partkey": 36, "t_count": 25, "t_avg_quantity": 4.192d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 19619.188800000004d, "t_avg_discount": 0.054000000000000006d, "t_avg_tax": 0.034d, "t_max_shipdate": "1998-05-07", "t_min_commitdate": "1992-03-24", "t_min_receiptdate": "1992-03-20", "t_max_comment": "y slyly express deposits. final i" }
+{ "t_partkey": 37, "t_count": 17, "t_avg_quantity": 4.564705882352942d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 21386.331764705883d, "t_avg_discount": 0.06058823529411765d, "t_avg_tax": 0.05d, "t_max_shipdate": "1998-08-30", "t_min_commitdate": "1992-07-25", "t_min_receiptdate": "1992-09-10", "t_max_comment": "unts promise across the requests. blith" }
+{ "t_partkey": 38, "t_count": 26, "t_avg_quantity": 6.0076923076923086d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 28176.978076923075d, "t_avg_discount": 0.05653846153846154d, "t_avg_tax": 0.030384615384615385d, "t_max_shipdate": "1998-06-07", "t_min_commitdate": "1992-02-24", "t_min_receiptdate": "1992-04-26", "t_max_comment": "yly. blithely bold theodolites wa" }
+{ "t_partkey": 39, "t_count": 22, "t_avg_quantity": 4.454545454545455d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 20914.75909090909d, "t_avg_discount": 0.05318181818181819d, "t_avg_tax": 0.034999999999999996d, "t_max_shipdate": "1998-08-31", "t_min_commitdate": "1992-05-25", "t_min_receiptdate": "1992-06-03", "t_max_comment": "y. furiously ironic ideas gr" }
+{ "t_partkey": 40, "t_count": 34, "t_avg_quantity": 4.61764705882353d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 21703.864705882355d, "t_avg_discount": 0.0511764705882353d, "t_avg_tax": 0.03735294117647059d, "t_max_shipdate": "1998-06-12", "t_min_commitdate": "1992-03-04", "t_min_receiptdate": "1992-02-10", "t_max_comment": "y special a" }
+{ "t_partkey": 41, "t_count": 25, "t_avg_quantity": 5.936d, "t_max_suppkey": 10, "t_max_linenumber": 5, "t_avg_extendedprice": 27930.0672d, "t_avg_discount": 0.0484d, "t_avg_tax": 0.0444d, "t_max_shipdate": "1998-09-18", "t_min_commitdate": "1992-11-13", "t_min_receiptdate": "1993-01-09", "t_max_comment": "uffily even accounts. packages sleep blithe" }
+{ "t_partkey": 42, "t_count": 31, "t_avg_quantity": 3.7806451612903227d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 17807.594838709676d, "t_avg_discount": 0.05193548387096774d, "t_avg_tax": 0.0364516129032258d, "t_max_shipdate": "1998-08-12", "t_min_commitdate": "1992-10-29", "t_min_receiptdate": "1992-11-02", "t_max_comment": "y final platelets sublate among the " }
+{ "t_partkey": 43, "t_count": 32, "t_avg_quantity": 6.03125d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 28438.550000000003d, "t_avg_discount": 0.045000000000000005d, "t_avg_tax": 0.047812499999999994d, "t_max_shipdate": "1998-11-01", "t_min_commitdate": "1992-07-09", "t_min_receiptdate": "1992-07-07", "t_max_comment": "y regular packages. b" }
+{ "t_partkey": 44, "t_count": 23, "t_avg_quantity": 5.852173913043479d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 27623.43130434783d, "t_avg_discount": 0.05565217391304349d, "t_avg_tax": 0.04391304347826087d, "t_max_shipdate": "1998-08-12", "t_min_commitdate": "1992-02-16", "t_min_receiptdate": "1992-03-01", "t_max_comment": "unts. furiously silent" }
+{ "t_partkey": 45, "t_count": 34, "t_avg_quantity": 5.305882352941177d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25071.35529411765d, "t_avg_discount": 0.05147058823529413d, "t_avg_tax": 0.039411764705882354d, "t_max_shipdate": "1998-09-09", "t_min_commitdate": "1992-05-07", "t_min_receiptdate": "1992-07-23", "t_max_comment": "y. bold pinto beans use " }
+{ "t_partkey": 46, "t_count": 34, "t_avg_quantity": 4.405882352941177d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 20840.704705882352d, "t_avg_discount": 0.05823529411764706d, "t_avg_tax": 0.0411764705882353d, "t_max_shipdate": "1998-10-25", "t_min_commitdate": "1992-04-21", "t_min_receiptdate": "1992-05-18", "t_max_comment": "xpress pinto beans. accounts a" }
+{ "t_partkey": 47, "t_count": 31, "t_avg_quantity": 5.129032258064516d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24286.993548387094d, "t_avg_discount": 0.05064516129032258d, "t_avg_tax": 0.03967741935483871d, "t_max_shipdate": "1998-07-31", "t_min_commitdate": "1992-04-09", "t_min_receiptdate": "1992-04-05", "t_max_comment": "y ironic requests above the fluffily d" }
+{ "t_partkey": 48, "t_count": 37, "t_avg_quantity": 4.8756756756756765d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23111.67783783784d, "t_avg_discount": 0.04054054054054054d, "t_avg_tax": 0.03918918918918919d, "t_max_shipdate": "1998-08-17", "t_min_commitdate": "1992-05-30", "t_min_receiptdate": "1992-05-11", "t_max_comment": "y according to " }
+{ "t_partkey": 49, "t_count": 28, "t_avg_quantity": 5.4071428571428575d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 25657.97428571429d, "t_avg_discount": 0.0475d, "t_avg_tax": 0.04107142857142857d, "t_max_shipdate": "1998-09-03", "t_min_commitdate": "1992-02-27", "t_min_receiptdate": "1992-05-26", "t_max_comment": "unts alongs" }
+{ "t_partkey": 50, "t_count": 39, "t_avg_quantity": 4.4974358974358974d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21363.944871794873d, "t_avg_discount": 0.04820512820512821d, "t_avg_tax": 0.04025641025641026d, "t_max_shipdate": "1998-09-12", "t_min_commitdate": "1992-05-13", "t_min_receiptdate": "1992-04-29", "t_max_comment": "yly pending theodolites." }
+{ "t_partkey": 51, "t_count": 35, "t_avg_quantity": 4.908571428571429d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23341.484285714283d, "t_avg_discount": 0.04914285714285715d, "t_avg_tax": 0.039428571428571424d, "t_max_shipdate": "1998-08-01", "t_min_commitdate": "1992-03-30", "t_min_receiptdate": "1992-03-31", "t_max_comment": "y ironic pin" }
+{ "t_partkey": 52, "t_count": 32, "t_avg_quantity": 5.91875d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 28174.7296875d, "t_avg_discount": 0.051250000000000004d, "t_avg_tax": 0.049375d, "t_max_shipdate": "1998-09-09", "t_min_commitdate": "1992-05-09", "t_min_receiptdate": "1992-06-02", "t_max_comment": "y pending orbits boost after the slyly" }
+{ "t_partkey": 53, "t_count": 24, "t_avg_quantity": 5.175000000000001d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 24660.16875d, "t_avg_discount": 0.04875000000000001d, "t_avg_tax": 0.04583333333333333d, "t_max_shipdate": "1998-11-10", "t_min_commitdate": "1992-02-23", "t_min_receiptdate": "1992-01-25", "t_max_comment": "y orbits. final depos" }
+{ "t_partkey": 54, "t_count": 34, "t_avg_quantity": 5.01764705882353d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 23935.430882352943d, "t_avg_discount": 0.05205882352941177d, "t_avg_tax": 0.04147058823529412d, "t_max_shipdate": "1998-05-26", "t_min_commitdate": "1992-03-28", "t_min_receiptdate": "1992-04-09", "t_max_comment": "y pending notornis ab" }
+{ "t_partkey": 55, "t_count": 30, "t_avg_quantity": 6.553333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 31293.805d, "t_avg_discount": 0.050666666666666665d, "t_avg_tax": 0.03933333333333334d, "t_max_shipdate": "1998-06-06", "t_min_commitdate": "1992-03-12", "t_min_receiptdate": "1992-02-06", "t_max_comment": "yly regular i" }
+{ "t_partkey": 56, "t_count": 24, "t_avg_quantity": 4.825d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 23064.70625d, "t_avg_discount": 0.05583333333333334d, "t_avg_tax": 0.037916666666666675d, "t_max_shipdate": "1998-07-22", "t_min_commitdate": "1992-03-01", "t_min_receiptdate": "1992-02-06", "t_max_comment": "ts. ironic, fina" }
+{ "t_partkey": 57, "t_count": 37, "t_avg_quantity": 5.5297297297297305d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 26461.139189189194d, "t_avg_discount": 0.05297297297297297d, "t_avg_tax": 0.03945945945945946d, "t_max_shipdate": "1998-08-16", "t_min_commitdate": "1992-03-20", "t_min_receiptdate": "1992-01-17", "t_max_comment": "y. doggedly pend" }
+{ "t_partkey": 58, "t_count": 28, "t_avg_quantity": 4.764285714285715d, "t_max_suppkey": 10, "t_max_linenumber": 5, "t_avg_extendedprice": 22822.119642857146d, "t_avg_discount": 0.05571428571428571d, "t_avg_tax": 0.04535714285714286d, "t_max_shipdate": "1998-11-27", "t_min_commitdate": "1992-02-23", "t_min_receiptdate": "1992-05-17", "t_max_comment": "xpress, bo" }
+{ "t_partkey": 59, "t_count": 37, "t_avg_quantity": 5.567567567567568d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 26697.87837837838d, "t_avg_discount": 0.042702702702702704d, "t_avg_tax": 0.049459459459459454d, "t_max_shipdate": "1998-07-12", "t_min_commitdate": "1992-02-26", "t_min_receiptdate": "1992-02-11", "t_max_comment": "y. ironic deposits haggle sl" }
+{ "t_partkey": 60, "t_count": 28, "t_avg_quantity": 5.0d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 24001.5d, "t_avg_discount": 0.05428571428571429d, "t_avg_tax": 0.042499999999999996d, "t_max_shipdate": "1998-07-08", "t_min_commitdate": "1992-03-02", "t_min_receiptdate": "1992-03-02", "t_max_comment": "y across the express accounts. fluff" }
+{ "t_partkey": 61, "t_count": 29, "t_avg_quantity": 5.593103448275862d, "t_max_suppkey": 10, "t_max_linenumber": 5, "t_avg_extendedprice": 26876.539999999997d, "t_avg_discount": 0.04931034482758621d, "t_avg_tax": 0.04103448275862069d, "t_max_shipdate": "1998-08-06", "t_min_commitdate": "1993-06-25", "t_min_receiptdate": "1993-08-03", "t_max_comment": "y even asymptotes. courts are unusual pa" }
+{ "t_partkey": 62, "t_count": 24, "t_avg_quantity": 5.175000000000001d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 24893.3025d, "t_avg_discount": 0.048749999999999995d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-05-27", "t_min_commitdate": "1992-02-17", "t_min_receiptdate": "1992-02-08", "t_max_comment": "yly final accounts hag" }
+{ "t_partkey": 63, "t_count": 26, "t_avg_quantity": 4.992307692307692d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24039.45923076923d, "t_avg_discount": 0.052307692307692305d, "t_avg_tax": 0.04884615384615386d, "t_max_shipdate": "1998-05-08", "t_min_commitdate": "1992-03-07", "t_min_receiptdate": "1992-02-19", "t_max_comment": "y special packages wak" }
+{ "t_partkey": 64, "t_count": 31, "t_avg_quantity": 4.838709677419356d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23324.032258064515d, "t_avg_discount": 0.050645161290322586d, "t_avg_tax": 0.03709677419354839d, "t_max_shipdate": "1998-10-10", "t_min_commitdate": "1992-02-05", "t_min_receiptdate": "1992-02-29", "t_max_comment": "uietly regular foxes wake quick" }
+{ "t_partkey": 65, "t_count": 36, "t_avg_quantity": 5.033333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24287.343333333338d, "t_avg_discount": 0.049166666666666664d, "t_avg_tax": 0.04083333333333334d, "t_max_shipdate": "1998-06-17", "t_min_commitdate": "1992-04-14", "t_min_receiptdate": "1992-03-13", "t_max_comment": "y unusual packages. packages" }
+{ "t_partkey": 66, "t_count": 29, "t_avg_quantity": 4.23448275862069d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 20453.82206896552d, "t_avg_discount": 0.05068965517241379d, "t_avg_tax": 0.051034482758620686d, "t_max_shipdate": "1998-05-23", "t_min_commitdate": "1992-06-18", "t_min_receiptdate": "1992-05-10", "t_max_comment": "y. pinto beans haggle after the" }
+{ "t_partkey": 67, "t_count": 21, "t_avg_quantity": 4.523809523809525d, "t_max_suppkey": 8, "t_max_linenumber": 5, "t_avg_extendedprice": 21873.976190476194d, "t_avg_discount": 0.05428571428571429d, "t_avg_tax": 0.04476190476190477d, "t_max_shipdate": "1998-08-27", "t_min_commitdate": "1992-06-07", "t_min_receiptdate": "1992-05-26", "t_max_comment": "theodolite" }
+{ "t_partkey": 68, "t_count": 36, "t_avg_quantity": 4.388888888888888d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21243.53888888889d, "t_avg_discount": 0.059444444444444446d, "t_avg_tax": 0.04305555555555555d, "t_max_shipdate": "1998-09-10", "t_min_commitdate": "1992-06-03", "t_min_receiptdate": "1992-05-11", "t_max_comment": "y final ac" }
+{ "t_partkey": 69, "t_count": 24, "t_avg_quantity": 4.708333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 22813.287499999995d, "t_avg_discount": 0.059166666666666666d, "t_avg_tax": 0.03958333333333333d, "t_max_shipdate": "1998-09-02", "t_min_commitdate": "1992-06-04", "t_min_receiptdate": "1992-06-03", "t_max_comment": "yly furiously even id" }
+{ "t_partkey": 70, "t_count": 34, "t_avg_quantity": 5.029411764705883d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 24394.407352941176d, "t_avg_discount": 0.04558823529411765d, "t_avg_tax": 0.04352941176470588d, "t_max_shipdate": "1998-07-19", "t_min_commitdate": "1992-04-10", "t_min_receiptdate": "1992-04-29", "t_max_comment": "ts affix slyly accordi" }
+{ "t_partkey": 71, "t_count": 33, "t_avg_quantity": 5.024242424242424d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24394.455454545456d, "t_avg_discount": 0.04515151515151515d, "t_avg_tax": 0.03818181818181819d, "t_max_shipdate": "1998-10-03", "t_min_commitdate": "1992-10-19", "t_min_receiptdate": "1992-12-05", "t_max_comment": "y regular foxes wake among the final" }
+{ "t_partkey": 72, "t_count": 36, "t_avg_quantity": 4.833333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23491.691666666666d, "t_avg_discount": 0.053888888888888896d, "t_avg_tax": 0.038055555555555565d, "t_max_shipdate": "1998-07-21", "t_min_commitdate": "1992-09-04", "t_min_receiptdate": "1992-10-14", "t_max_comment": "yly along the ironic, fi" }
+{ "t_partkey": 73, "t_count": 27, "t_avg_quantity": 4.5851851851851855d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 22308.530740740738d, "t_avg_discount": 0.04481481481481482d, "t_avg_tax": 0.03333333333333333d, "t_max_shipdate": "1998-10-12", "t_min_commitdate": "1992-03-01", "t_min_receiptdate": "1992-01-09", "t_max_comment": "y even packages promise" }
+{ "t_partkey": 74, "t_count": 25, "t_avg_quantity": 6.016d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 29300.025600000004d, "t_avg_discount": 0.0528d, "t_avg_tax": 0.0388d, "t_max_shipdate": "1998-03-23", "t_min_commitdate": "1992-03-22", "t_min_receiptdate": "1992-03-25", "t_max_comment": "uests. blithely unus" }
+{ "t_partkey": 75, "t_count": 29, "t_avg_quantity": 5.131034482758621d, "t_max_suppkey": 6, "t_max_linenumber": 6, "t_avg_extendedprice": 25015.58896551724d, "t_avg_discount": 0.06310344827586208d, "t_avg_tax": 0.02896551724137931d, "t_max_shipdate": "1998-10-19", "t_min_commitdate": "1992-02-18", "t_min_receiptdate": "1992-03-31", "t_max_comment": "usly across the slyly busy accounts! fin" }
+{ "t_partkey": 76, "t_count": 21, "t_avg_quantity": 4.9714285714285715d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 24262.31142857143d, "t_avg_discount": 0.04d, "t_avg_tax": 0.041428571428571426d, "t_max_shipdate": "1998-05-31", "t_min_commitdate": "1992-08-25", "t_min_receiptdate": "1992-11-16", "t_max_comment": "y even accounts thrash care" }
+{ "t_partkey": 77, "t_count": 20, "t_avg_quantity": 6.08d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 29702.927999999996d, "t_avg_discount": 0.053500000000000006d, "t_avg_tax": 0.037d, "t_max_shipdate": "1998-06-16", "t_min_commitdate": "1992-09-20", "t_min_receiptdate": "1992-08-19", "t_max_comment": "usly at the blithely pending pl" }
+{ "t_partkey": 78, "t_count": 35, "t_avg_quantity": 4.485714285714286d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21936.71285714286d, "t_avg_discount": 0.05942857142857143d, "t_avg_tax": 0.042285714285714295d, "t_max_shipdate": "1998-08-03", "t_min_commitdate": "1992-03-24", "t_min_receiptdate": "1992-03-21", "t_max_comment": "yly after the fluffily regul" }
+{ "t_partkey": 79, "t_count": 37, "t_avg_quantity": 5.65945945945946d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27705.03486486486d, "t_avg_discount": 0.04810810810810811d, "t_avg_tax": 0.042432432432432436d, "t_max_shipdate": "1998-10-09", "t_min_commitdate": "1992-05-23", "t_min_receiptdate": "1992-08-24", "t_max_comment": "y slyly final" }
+{ "t_partkey": 80, "t_count": 29, "t_avg_quantity": 6.172413793103448d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 30247.296551724135d, "t_avg_discount": 0.04655172413793104d, "t_avg_tax": 0.03413793103448276d, "t_max_shipdate": "1998-10-08", "t_min_commitdate": "1992-07-01", "t_min_receiptdate": "1992-06-07", "t_max_comment": "yly ironic frets. pending foxes after " }
+{ "t_partkey": 81, "t_count": 21, "t_avg_quantity": 5.371428571428572d, "t_max_suppkey": 2, "t_max_linenumber": 7, "t_avg_extendedprice": 26349.005714285708d, "t_avg_discount": 0.044285714285714296d, "t_avg_tax": 0.04095238095238095d, "t_max_shipdate": "1998-06-02", "t_min_commitdate": "1992-04-18", "t_min_receiptdate": "1992-04-22", "t_max_comment": "yly even accounts. spe" }
+{ "t_partkey": 82, "t_count": 23, "t_avg_quantity": 4.3130434782608695d, "t_max_suppkey": 3, "t_max_linenumber": 7, "t_avg_extendedprice": 21178.768695652176d, "t_avg_discount": 0.05260869565217391d, "t_avg_tax": 0.043043478260869565d, "t_max_shipdate": "1998-04-09", "t_min_commitdate": "1992-08-17", "t_min_receiptdate": "1992-07-22", "t_max_comment": "ut the carefully special foxes. idle," }
+{ "t_partkey": 83, "t_count": 33, "t_avg_quantity": 5.115151515151515d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 25143.01575757576d, "t_avg_discount": 0.05303030303030303d, "t_avg_tax": 0.043030303030303044d, "t_max_shipdate": "1998-10-12", "t_min_commitdate": "1992-07-05", "t_min_receiptdate": "1992-06-25", "t_max_comment": "yly. slyly regular courts use silentl" }
+{ "t_partkey": 84, "t_count": 28, "t_avg_quantity": 5.585714285714285d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 27483.948571428573d, "t_avg_discount": 0.05464285714285715d, "t_avg_tax": 0.039999999999999994d, "t_max_shipdate": "1998-10-03", "t_min_commitdate": "1992-08-25", "t_min_receiptdate": "1992-09-16", "t_max_comment": "yly brave theod" }
+{ "t_partkey": 85, "t_count": 28, "t_avg_quantity": 4.121428571428572d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 20299.684285714284d, "t_avg_discount": 0.041785714285714294d, "t_avg_tax": 0.041785714285714294d, "t_max_shipdate": "1998-07-23", "t_min_commitdate": "1992-04-24", "t_min_receiptdate": "1992-03-10", "t_max_comment": "y. enticingly final depos" }
+{ "t_partkey": 86, "t_count": 36, "t_avg_quantity": 5.427777777777778d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 26761.115555555552d, "t_avg_discount": 0.049999999999999996d, "t_avg_tax": 0.04555555555555556d, "t_max_shipdate": "1998-07-10", "t_min_commitdate": "1992-04-14", "t_min_receiptdate": "1992-06-23", "t_max_comment": "unts. furiously express accounts w" }
+{ "t_partkey": 87, "t_count": 34, "t_avg_quantity": 4.658823529411765d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 22993.157647058822d, "t_avg_discount": 0.052352941176470595d, "t_avg_tax": 0.036470588235294116d, "t_max_shipdate": "1998-09-18", "t_min_commitdate": "1992-10-18", "t_min_receiptdate": "1992-10-15", "t_max_comment": "y final de" }
+{ "t_partkey": 88, "t_count": 29, "t_avg_quantity": 4.613793103448276d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 22793.983448275863d, "t_avg_discount": 0.04724137931034483d, "t_avg_tax": 0.039655172413793106d, "t_max_shipdate": "1998-10-27", "t_min_commitdate": "1992-06-03", "t_min_receiptdate": "1992-05-16", "t_max_comment": "y slyly ironic accounts. foxes haggle slyl" }
+{ "t_partkey": 89, "t_count": 28, "t_avg_quantity": 4.864285714285715d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24055.838571428576d, "t_avg_discount": 0.04642857142857143d, "t_avg_tax": 0.05035714285714286d, "t_max_shipdate": "1998-10-23", "t_min_commitdate": "1992-03-18", "t_min_receiptdate": "1992-05-07", "t_max_comment": "y carefully final ideas. f" }
+{ "t_partkey": 90, "t_count": 48, "t_avg_quantity": 5.4d, "t_max_suppkey": 1, "t_max_linenumber": 7, "t_avg_extendedprice": 26732.430000000004d, "t_avg_discount": 0.044583333333333336d, "t_avg_tax": 0.04229166666666667d, "t_max_shipdate": "1998-10-09", "t_min_commitdate": "1992-04-25", "t_min_receiptdate": "1992-03-17", "t_max_comment": "y regular notornis k" }
+{ "t_partkey": 91, "t_count": 28, "t_avg_quantity": 4.1571428571428575d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 20600.513571428568d, "t_avg_discount": 0.055714285714285716d, "t_avg_tax": 0.04107142857142858d, "t_max_shipdate": "1998-09-07", "t_min_commitdate": "1992-06-08", "t_min_receiptdate": "1992-06-20", "t_max_comment": "ven deposits about the regular, ironi" }
+{ "t_partkey": 92, "t_count": 30, "t_avg_quantity": 5.466666666666667d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 27117.126666666667d, "t_avg_discount": 0.060666666666666674d, "t_avg_tax": 0.044000000000000004d, "t_max_shipdate": "1997-11-30", "t_min_commitdate": "1992-03-15", "t_min_receiptdate": "1992-02-14", "t_max_comment": "warhorses wake never for the care" }
+{ "t_partkey": 93, "t_count": 31, "t_avg_quantity": 5.219354838709678d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 25916.445483870968d, "t_avg_discount": 0.05903225806451613d, "t_avg_tax": 0.04096774193548387d, "t_max_shipdate": "1998-11-25", "t_min_commitdate": "1992-05-29", "t_min_receiptdate": "1992-06-02", "t_max_comment": "ut the slyly bold pinto beans; fi" }
+{ "t_partkey": 94, "t_count": 32, "t_avg_quantity": 5.7d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 28331.565d, "t_avg_discount": 0.05d, "t_avg_tax": 0.040625d, "t_max_shipdate": "1998-03-09", "t_min_commitdate": "1992-04-09", "t_min_receiptdate": "1992-05-23", "t_max_comment": "y furious depen" }
+{ "t_partkey": 95, "t_count": 31, "t_avg_quantity": 4.7290322580645165d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23529.063548387097d, "t_avg_discount": 0.050967741935483875d, "t_avg_tax": 0.038387096774193545d, "t_max_shipdate": "1998-10-07", "t_min_commitdate": "1992-02-14", "t_min_receiptdate": "1992-03-23", "t_max_comment": "y final excuses. ironic, special requests a" }
+{ "t_partkey": 96, "t_count": 38, "t_avg_quantity": 5.368421052631579d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26737.15263157895d, "t_avg_discount": 0.04315789473684212d, "t_avg_tax": 0.04026315789473684d, "t_max_shipdate": "1998-11-03", "t_min_commitdate": "1992-05-16", "t_min_receiptdate": "1992-07-02", "t_max_comment": "y. slyly iron" }
+{ "t_partkey": 97, "t_count": 39, "t_avg_quantity": 4.774358974358974d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 23802.327948717946d, "t_avg_discount": 0.04717948717948718d, "t_avg_tax": 0.03794871794871795d, "t_max_shipdate": "1998-05-15", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-02-19", "t_max_comment": "y slyly express theodolites. slyly bo" }
+{ "t_partkey": 98, "t_count": 29, "t_avg_quantity": 4.441379310344828d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 22164.481379310342d, "t_avg_discount": 0.0506896551724138d, "t_avg_tax": 0.03862068965517241d, "t_max_shipdate": "1998-10-04", "t_min_commitdate": "1992-08-20", "t_min_receiptdate": "1992-10-08", "t_max_comment": "ven requests should sleep along " }
+{ "t_partkey": 99, "t_count": 22, "t_avg_quantity": 4.609090909090909d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 23024.48318181818d, "t_avg_discount": 0.05318181818181818d, "t_avg_tax": 0.038181818181818185d, "t_max_shipdate": "1998-02-16", "t_min_commitdate": "1992-03-03", "t_min_receiptdate": "1992-05-24", "t_max_comment": "yly pending excu" }
+{ "t_partkey": 100, "t_count": 41, "t_avg_quantity": 5.51219512195122d, "t_max_suppkey": 4, "t_max_linenumber": 6, "t_avg_extendedprice": 27563.731707317078d, "t_avg_discount": 0.05048780487804879d, "t_avg_tax": 0.04048780487804878d, "t_max_shipdate": "1998-06-24", "t_min_commitdate": "1992-03-06", "t_min_receiptdate": "1992-04-13", "t_max_comment": "xpress accounts sleep slyly re" }
+{ "t_partkey": 101, "t_count": 28, "t_avg_quantity": 5.707142857142857d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 28567.103571428568d, "t_avg_discount": 0.054285714285714284d, "t_avg_tax": 0.04571428571428572d, "t_max_shipdate": "1998-02-25", "t_min_commitdate": "1992-07-26", "t_min_receiptdate": "1992-08-20", "t_max_comment": "uses are care" }
+{ "t_partkey": 102, "t_count": 38, "t_avg_quantity": 4.263157894736842d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21360.552631578947d, "t_avg_discount": 0.05052631578947368d, "t_avg_tax": 0.04315789473684211d, "t_max_shipdate": "1998-09-01", "t_min_commitdate": "1992-09-09", "t_min_receiptdate": "1992-08-28", "t_max_comment": "y unusual packa" }
+{ "t_partkey": 103, "t_count": 25, "t_avg_quantity": 6.16d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 30895.48d, "t_avg_discount": 0.0408d, "t_avg_tax": 0.0432d, "t_max_shipdate": "1998-11-16", "t_min_commitdate": "1992-05-16", "t_min_receiptdate": "1992-04-20", "t_max_comment": "yly. unusu" }
+{ "t_partkey": 104, "t_count": 19, "t_avg_quantity": 5.178947368421053d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 26000.9052631579d, "t_avg_discount": 0.04263157894736842d, "t_avg_tax": 0.034210526315789476d, "t_max_shipdate": "1998-04-17", "t_min_commitdate": "1992-03-29", "t_min_receiptdate": "1992-04-13", "t_max_comment": "yly even gifts after the sl" }
+{ "t_partkey": 105, "t_count": 36, "t_avg_quantity": 5.194444444444445d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26104.68055555556d, "t_avg_discount": 0.05055555555555556d, "t_avg_tax": 0.03888888888888889d, "t_max_shipdate": "1998-08-25", "t_min_commitdate": "1992-03-19", "t_min_receiptdate": "1992-02-25", "t_max_comment": "yly into the carefully even " }
+{ "t_partkey": 106, "t_count": 27, "t_avg_quantity": 4.451851851851852d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 22395.040740740744d, "t_avg_discount": 0.039259259259259265d, "t_avg_tax": 0.039259259259259265d, "t_max_shipdate": "1998-07-25", "t_min_commitdate": "1992-05-18", "t_min_receiptdate": "1992-07-21", "t_max_comment": "y ironic foxes caj" }
+{ "t_partkey": 107, "t_count": 27, "t_avg_quantity": 4.733333333333333d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 23834.7d, "t_avg_discount": 0.04518518518518518d, "t_avg_tax": 0.037037037037037035d, "t_max_shipdate": "1998-09-29", "t_min_commitdate": "1992-06-25", "t_min_receiptdate": "1992-06-11", "t_max_comment": "y ruthless dolphins to " }
+{ "t_partkey": 108, "t_count": 28, "t_avg_quantity": 4.692857142857143d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 23654.346428571425d, "t_avg_discount": 0.05750000000000001d, "t_avg_tax": 0.046071428571428576d, "t_max_shipdate": "1998-09-07", "t_min_commitdate": "1992-06-14", "t_min_receiptdate": "1992-08-03", "t_max_comment": "y pending platelets x-ray ironically! pend" }
+{ "t_partkey": 109, "t_count": 35, "t_avg_quantity": 5.331428571428572d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26899.722857142857d, "t_avg_discount": 0.048571428571428564d, "t_avg_tax": 0.044571428571428574d, "t_max_shipdate": "1997-08-27", "t_min_commitdate": "1992-06-18", "t_min_receiptdate": "1992-07-05", "t_max_comment": "ts wake furiously " }
+{ "t_partkey": 110, "t_count": 29, "t_avg_quantity": 4.86896551724138d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 24590.95379310345d, "t_avg_discount": 0.05344827586206897d, "t_avg_tax": 0.03517241379310345d, "t_max_shipdate": "1998-05-03", "t_min_commitdate": "1992-10-29", "t_min_receiptdate": "1992-09-27", "t_max_comment": "xcuses sleep quickly along th" }
+{ "t_partkey": 111, "t_count": 26, "t_avg_quantity": 6.130769230769231d, "t_max_suppkey": 8, "t_max_linenumber": 5, "t_avg_extendedprice": 30994.410384615392d, "t_avg_discount": 0.05038461538461539d, "t_avg_tax": 0.03576923076923077d, "t_max_shipdate": "1998-06-18", "t_min_commitdate": "1992-05-11", "t_min_receiptdate": "1992-07-29", "t_max_comment": "usy pinto beans b" }
+{ "t_partkey": 112, "t_count": 28, "t_avg_quantity": 5.457142857142857d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 27616.144285714287d, "t_avg_discount": 0.038571428571428576d, "t_avg_tax": 0.041785714285714294d, "t_max_shipdate": "1998-10-18", "t_min_commitdate": "1992-10-23", "t_min_receiptdate": "1992-09-29", "t_max_comment": "zle carefully sauternes. quickly" }
+{ "t_partkey": 113, "t_count": 28, "t_avg_quantity": 5.078571428571429d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 25725.7575d, "t_avg_discount": 0.04785714285714287d, "t_avg_tax": 0.048571428571428564d, "t_max_shipdate": "1998-06-28", "t_min_commitdate": "1992-08-10", "t_min_receiptdate": "1992-06-14", "t_max_comment": "yly silent deposit" }
+{ "t_partkey": 114, "t_count": 24, "t_avg_quantity": 5.041666666666667d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25564.02291666667d, "t_avg_discount": 0.057916666666666665d, "t_avg_tax": 0.03958333333333334d, "t_max_shipdate": "1998-09-27", "t_min_commitdate": "1992-10-25", "t_min_receiptdate": "1992-12-04", "t_max_comment": "y unusual, ironic" }
+{ "t_partkey": 115, "t_count": 34, "t_avg_quantity": 4.594117647058823d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23317.673823529414d, "t_avg_discount": 0.045588235294117645d, "t_avg_tax": 0.03588235294117647d, "t_max_shipdate": "1998-04-27", "t_min_commitdate": "1992-04-19", "t_min_receiptdate": "1992-03-30", "t_max_comment": "y. final pearls kindle. accounts " }
+{ "t_partkey": 116, "t_count": 25, "t_avg_quantity": 5.5200000000000005d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 28044.635999999995d, "t_avg_discount": 0.0512d, "t_avg_tax": 0.046d, "t_max_shipdate": "1998-06-24", "t_min_commitdate": "1992-03-10", "t_min_receiptdate": "1992-04-14", "t_max_comment": "yly even epitaphs for the " }
+{ "t_partkey": 117, "t_count": 35, "t_avg_quantity": 5.337142857142858d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 27142.306857142856d, "t_avg_discount": 0.05742857142857143d, "t_avg_tax": 0.044285714285714296d, "t_max_shipdate": "1998-10-30", "t_min_commitdate": "1992-05-06", "t_min_receiptdate": "1992-05-11", "t_max_comment": "y ironic accounts. furiously even packa" }
+{ "t_partkey": 118, "t_count": 38, "t_avg_quantity": 4.321052631578947d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21996.53447368421d, "t_avg_discount": 0.05342105263157895d, "t_avg_tax": 0.035526315789473684d, "t_max_shipdate": "1998-08-31", "t_min_commitdate": "1992-05-19", "t_min_receiptdate": "1992-07-02", "t_max_comment": "y. furiously even pinto be" }
+{ "t_partkey": 119, "t_count": 30, "t_avg_quantity": 5.4d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27515.970000000005d, "t_avg_discount": 0.058333333333333334d, "t_avg_tax": 0.043000000000000003d, "t_max_shipdate": "1998-08-15", "t_min_commitdate": "1992-05-19", "t_min_receiptdate": "1992-06-05", "t_max_comment": "y regular theodolites w" }
+{ "t_partkey": 120, "t_count": 36, "t_avg_quantity": 5.75d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 29328.449999999997d, "t_avg_discount": 0.05222222222222223d, "t_avg_tax": 0.045000000000000005d, "t_max_shipdate": "1998-08-25", "t_min_commitdate": "1992-04-04", "t_min_receiptdate": "1992-04-02", "t_max_comment": "yly regular p" }
+{ "t_partkey": 121, "t_count": 34, "t_avg_quantity": 4.576470588235295d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23365.628235294116d, "t_avg_discount": 0.052352941176470595d, "t_avg_tax": 0.03470588235294118d, "t_max_shipdate": "1998-08-22", "t_min_commitdate": "1992-05-22", "t_min_receiptdate": "1992-05-03", "t_max_comment": "y quickly regular packages. car" }
+{ "t_partkey": 122, "t_count": 44, "t_avg_quantity": 4.677272727272728d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 23903.67d, "t_avg_discount": 0.05113636363636364d, "t_avg_tax": 0.03977272727272727d, "t_max_shipdate": "1998-10-29", "t_min_commitdate": "1992-03-23", "t_min_receiptdate": "1992-04-07", "t_max_comment": "y bold package" }
+{ "t_partkey": 123, "t_count": 30, "t_avg_quantity": 5.213333333333334d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 26669.327999999994d, "t_avg_discount": 0.04466666666666666d, "t_avg_tax": 0.04066666666666666d, "t_max_shipdate": "1998-09-23", "t_min_commitdate": "1992-03-18", "t_min_receiptdate": "1992-02-29", "t_max_comment": "y quickly regular theodolites. final t" }
+{ "t_partkey": 124, "t_count": 32, "t_avg_quantity": 4.9375d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 25282.962499999998d, "t_avg_discount": 0.0553125d, "t_avg_tax": 0.043125d, "t_max_shipdate": "1998-11-15", "t_min_commitdate": "1992-07-21", "t_min_receiptdate": "1992-06-18", "t_max_comment": "y express ideas impress" }
+{ "t_partkey": 125, "t_count": 20, "t_avg_quantity": 6.07d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 31112.392000000003d, "t_avg_discount": 0.035500000000000004d, "t_avg_tax": 0.034d, "t_max_shipdate": "1998-05-05", "t_min_commitdate": "1992-04-24", "t_min_receiptdate": "1992-04-12", "t_max_comment": "y final deposits wake furiously! slyl" }
+{ "t_partkey": 126, "t_count": 31, "t_avg_quantity": 4.812903225806452d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 24693.08129032258d, "t_avg_discount": 0.04387096774193548d, "t_avg_tax": 0.03483870967741936d, "t_max_shipdate": "1998-01-30", "t_min_commitdate": "1992-07-09", "t_min_receiptdate": "1992-08-21", "t_max_comment": "x furiously bold packages. expres" }
+{ "t_partkey": 127, "t_count": 25, "t_avg_quantity": 4.744d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24363.2864d, "t_avg_discount": 0.055600000000000004d, "t_avg_tax": 0.034d, "t_max_shipdate": "1998-05-25", "t_min_commitdate": "1992-06-30", "t_min_receiptdate": "1992-06-10", "t_max_comment": "ts integrate. courts haggl" }
+{ "t_partkey": 128, "t_count": 27, "t_avg_quantity": 5.155555555555556d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 26502.648888888885d, "t_avg_discount": 0.047407407407407405d, "t_avg_tax": 0.042222222222222223d, "t_max_shipdate": "1998-07-09", "t_min_commitdate": "1992-03-24", "t_min_receiptdate": "1992-03-15", "t_max_comment": "usly bold requests sleep dogge" }
+{ "t_partkey": 129, "t_count": 35, "t_avg_quantity": 5.262857142857143d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27080.557714285715d, "t_avg_discount": 0.05600000000000001d, "t_avg_tax": 0.03514285714285714d, "t_max_shipdate": "1998-08-25", "t_min_commitdate": "1992-04-17", "t_min_receiptdate": "1992-04-02", "t_max_comment": "ven theodolites nag quickly. fluffi" }
+{ "t_partkey": 130, "t_count": 28, "t_avg_quantity": 6.0d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 30903.9d, "t_avg_discount": 0.04464285714285714d, "t_avg_tax": 0.04357142857142858d, "t_max_shipdate": "1998-07-19", "t_min_commitdate": "1992-05-30", "t_min_receiptdate": "1992-04-05", "t_max_comment": "ven theodolites around the slyly" }
+{ "t_partkey": 131, "t_count": 33, "t_avg_quantity": 4.715151515151515d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 24309.67090909091d, "t_avg_discount": 0.04454545454545455d, "t_avg_tax": 0.03878787878787879d, "t_max_shipdate": "1998-08-20", "t_min_commitdate": "1992-02-24", "t_min_receiptdate": "1992-03-09", "t_max_comment": "usual pinto beans." }
+{ "t_partkey": 132, "t_count": 30, "t_avg_quantity": 4.0200000000000005d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 20745.813000000002d, "t_avg_discount": 0.04733333333333334d, "t_avg_tax": 0.03766666666666667d, "t_max_shipdate": "1998-07-21", "t_min_commitdate": "1992-02-12", "t_min_receiptdate": "1992-04-30", "t_max_comment": "yly ironic foxes. regular requests h" }
+{ "t_partkey": 133, "t_count": 28, "t_avg_quantity": 5.6000000000000005d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 28927.639999999996d, "t_avg_discount": 0.048571428571428564d, "t_avg_tax": 0.029285714285714283d, "t_max_shipdate": "1998-05-12", "t_min_commitdate": "1992-07-07", "t_min_receiptdate": "1992-07-08", "t_max_comment": "xcuses would boost against the fluffily eve" }
+{ "t_partkey": 134, "t_count": 32, "t_avg_quantity": 5.6312500000000005d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 29117.222812499997d, "t_avg_discount": 0.051875000000000004d, "t_avg_tax": 0.0346875d, "t_max_shipdate": "1998-07-22", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-06-06", "t_max_comment": "usly busy account" }
+{ "t_partkey": 135, "t_count": 29, "t_avg_quantity": 4.793103448275862d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 24807.42586206897d, "t_avg_discount": 0.054827586206896546d, "t_avg_tax": 0.03482758620689656d, "t_max_shipdate": "1998-08-03", "t_min_commitdate": "1992-04-10", "t_min_receiptdate": "1992-05-14", "t_max_comment": "y; excuses use. ironic, close instru" }
+{ "t_partkey": 136, "t_count": 35, "t_avg_quantity": 5.16d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 26732.154000000002d, "t_avg_discount": 0.04542857142857143d, "t_avg_tax": 0.036d, "t_max_shipdate": "1998-08-06", "t_min_commitdate": "1992-04-24", "t_min_receiptdate": "1992-05-24", "t_max_comment": "y final pinto " }
+{ "t_partkey": 137, "t_count": 38, "t_avg_quantity": 5.736842105263158d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 29749.2552631579d, "t_avg_discount": 0.04026315789473685d, "t_avg_tax": 0.04421052631578948d, "t_max_shipdate": "1997-08-19", "t_min_commitdate": "1992-06-29", "t_min_receiptdate": "1992-06-19", "t_max_comment": "uests cajole carefully." }
+{ "t_partkey": 138, "t_count": 42, "t_avg_quantity": 5.666666666666667d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 29413.68333333333d, "t_avg_discount": 0.05452380952380952d, "t_avg_tax": 0.03928571428571429d, "t_max_shipdate": "1998-08-29", "t_min_commitdate": "1992-04-12", "t_min_receiptdate": "1992-07-09", "t_max_comment": "yly idle deposits. final, final fox" }
+{ "t_partkey": 139, "t_count": 34, "t_avg_quantity": 5.364705882352942d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27873.13411764706d, "t_avg_discount": 0.050588235294117656d, "t_avg_tax": 0.047058823529411764d, "t_max_shipdate": "1998-03-01", "t_min_commitdate": "1992-04-15", "t_min_receiptdate": "1992-04-28", "t_max_comment": "y express accounts above the exp" }
+{ "t_partkey": 140, "t_count": 35, "t_avg_quantity": 5.034285714285715d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 26181.809714285715d, "t_avg_discount": 0.054571428571428576d, "t_avg_tax": 0.04257142857142857d, "t_max_shipdate": "1998-06-24", "t_min_commitdate": "1992-04-14", "t_min_receiptdate": "1992-03-21", "t_max_comment": "y among the furiously special" }
+{ "t_partkey": 141, "t_count": 38, "t_avg_quantity": 5.5473684210526315d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 28877.935789473686d, "t_avg_discount": 0.037368421052631585d, "t_avg_tax": 0.052105263157894745d, "t_max_shipdate": "1998-10-26", "t_min_commitdate": "1992-02-26", "t_min_receiptdate": "1992-01-20", "t_max_comment": "yly silent ideas affix furiousl" }
+{ "t_partkey": 142, "t_count": 26, "t_avg_quantity": 6.138461538461539d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 31985.681538461537d, "t_avg_discount": 0.05d, "t_avg_tax": 0.047692307692307694d, "t_max_shipdate": "1998-06-06", "t_min_commitdate": "1992-12-21", "t_min_receiptdate": "1992-10-16", "t_max_comment": "usly bold instructions affix idly unusual, " }
+{ "t_partkey": 143, "t_count": 36, "t_avg_quantity": 4.95d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 25817.715000000004d, "t_avg_discount": 0.045000000000000005d, "t_avg_tax": 0.03972222222222222d, "t_max_shipdate": "1998-07-16", "t_min_commitdate": "1992-04-26", "t_min_receiptdate": "1992-05-17", "t_max_comment": "y pending foxes nag blithely " }
+{ "t_partkey": 144, "t_count": 32, "t_avg_quantity": 4.91875d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 25679.318125d, "t_avg_discount": 0.0465625d, "t_avg_tax": 0.0434375d, "t_max_shipdate": "1998-09-22", "t_min_commitdate": "1992-07-19", "t_min_receiptdate": "1992-07-30", "t_max_comment": "ve the fluffily " }
+{ "t_partkey": 145, "t_count": 24, "t_avg_quantity": 5.566666666666666d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 29089.73d, "t_avg_discount": 0.04541666666666667d, "t_avg_tax": 0.03666666666666666d, "t_max_shipdate": "1998-07-23", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-01-27", "t_max_comment": "yly even platelets wake. " }
+{ "t_partkey": 146, "t_count": 27, "t_avg_quantity": 4.792592592592593d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 25068.614074074078d, "t_avg_discount": 0.05925925925925926d, "t_avg_tax": 0.04407407407407408d, "t_max_shipdate": "1998-07-09", "t_min_commitdate": "1992-05-18", "t_min_receiptdate": "1992-05-27", "t_max_comment": "ut the slyly specia" }
+{ "t_partkey": 147, "t_count": 31, "t_avg_quantity": 4.625806451612903d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24219.334838709678d, "t_avg_discount": 0.05451612903225806d, "t_avg_tax": 0.04741935483870968d, "t_max_shipdate": "1998-06-18", "t_min_commitdate": "1992-07-06", "t_min_receiptdate": "1992-06-23", "t_max_comment": "yly special excuses. fluffily " }
+{ "t_partkey": 148, "t_count": 43, "t_avg_quantity": 5.158139534883722d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 27032.261860465118d, "t_avg_discount": 0.0516279069767442d, "t_avg_tax": 0.04093023255813954d, "t_max_shipdate": "1998-07-21", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-01-27", "t_max_comment": "y special theodolites. carefully" }
+{ "t_partkey": 149, "t_count": 33, "t_avg_quantity": 4.363636363636363d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 22890.327272727274d, "t_avg_discount": 0.05d, "t_avg_tax": 0.03909090909090909d, "t_max_shipdate": "1998-06-06", "t_min_commitdate": "1992-03-06", "t_min_receiptdate": "1992-04-19", "t_max_comment": "y regular requests. furious" }
+{ "t_partkey": 150, "t_count": 29, "t_avg_quantity": 5.027586206896552d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 26398.598275862067d, "t_avg_discount": 0.05517241379310344d, "t_avg_tax": 0.04206896551724138d, "t_max_shipdate": "1998-08-06", "t_min_commitdate": "1992-05-26", "t_min_receiptdate": "1992-05-09", "t_max_comment": "thely around the bli" }
+{ "t_partkey": 151, "t_count": 24, "t_avg_quantity": 4.175d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 21942.756249999995d, "t_avg_discount": 0.045000000000000005d, "t_avg_tax": 0.03291666666666667d, "t_max_shipdate": "1998-08-09", "t_min_commitdate": "1992-02-05", "t_min_receiptdate": "1992-02-13", "t_max_comment": "y unusual foxes " }
+{ "t_partkey": 152, "t_count": 27, "t_avg_quantity": 4.970370370370371d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26147.875925925924d, "t_avg_discount": 0.050370370370370364d, "t_avg_tax": 0.03888888888888889d, "t_max_shipdate": "1998-04-20", "t_min_commitdate": "1992-05-10", "t_min_receiptdate": "1992-07-04", "t_max_comment": "ully. carefully final accounts accordi" }
+{ "t_partkey": 153, "t_count": 35, "t_avg_quantity": 5.514285714285715d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 29036.85d, "t_avg_discount": 0.045714285714285714d, "t_avg_tax": 0.03885714285714286d, "t_max_shipdate": "1998-08-17", "t_min_commitdate": "1992-02-18", "t_min_receiptdate": "1992-03-02", "t_max_comment": "y above the bli" }
+{ "t_partkey": 154, "t_count": 30, "t_avg_quantity": 4.54d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23929.205d, "t_avg_discount": 0.04933333333333333d, "t_avg_tax": 0.041666666666666664d, "t_max_shipdate": "1998-09-29", "t_min_commitdate": "1992-03-06", "t_min_receiptdate": "1992-03-01", "t_max_comment": "vely ironic accounts. furiously unusual acc" }
+{ "t_partkey": 155, "t_count": 23, "t_avg_quantity": 6.069565217391305d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 32021.508695652174d, "t_avg_discount": 0.0508695652173913d, "t_avg_tax": 0.037391304347826095d, "t_max_shipdate": "1998-07-27", "t_min_commitdate": "1992-10-21", "t_min_receiptdate": "1992-09-30", "t_max_comment": "y regular requests haggle." }
+{ "t_partkey": 156, "t_count": 39, "t_avg_quantity": 5.333333333333334d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 28164.0d, "t_avg_discount": 0.0458974358974359d, "t_avg_tax": 0.04410256410256411d, "t_max_shipdate": "1998-08-09", "t_min_commitdate": "1992-02-18", "t_min_receiptdate": "1992-05-03", "t_max_comment": "y regular instructions doze furiously. reg" }
+{ "t_partkey": 157, "t_count": 28, "t_avg_quantity": 5.414285714285715d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 28618.560714285715d, "t_avg_discount": 0.05714285714285714d, "t_avg_tax": 0.03964285714285714d, "t_max_shipdate": "1997-11-27", "t_min_commitdate": "1992-06-30", "t_min_receiptdate": "1992-08-01", "t_max_comment": "y regular requests engage furiously final d" }
+{ "t_partkey": 158, "t_count": 25, "t_avg_quantity": 5.144d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27215.618000000002d, "t_avg_discount": 0.044000000000000004d, "t_avg_tax": 0.036800000000000006d, "t_max_shipdate": "1998-07-16", "t_min_commitdate": "1992-06-04", "t_min_receiptdate": "1992-08-07", "t_max_comment": "uctions cajole" }
+{ "t_partkey": 159, "t_count": 32, "t_avg_quantity": 4.9625d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26280.159375000003d, "t_avg_discount": 0.0578125d, "t_avg_tax": 0.043125000000000004d, "t_max_shipdate": "1998-05-25", "t_min_commitdate": "1992-02-10", "t_min_receiptdate": "1992-05-20", "t_max_comment": "y special ideas. express packages pr" }
+{ "t_partkey": 160, "t_count": 42, "t_avg_quantity": 4.338095238095238d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 22995.37523809524d, "t_avg_discount": 0.04690476190476191d, "t_avg_tax": 0.03785714285714287d, "t_max_shipdate": "1998-08-14", "t_min_commitdate": "1992-04-07", "t_min_receiptdate": "1992-05-13", "t_max_comment": "yly silent deposits" }
+{ "t_partkey": 161, "t_count": 33, "t_avg_quantity": 5.109090909090909d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27107.814545454545d, "t_avg_discount": 0.04666666666666667d, "t_avg_tax": 0.04606060606060606d, "t_max_shipdate": "1998-09-11", "t_min_commitdate": "1992-04-27", "t_min_receiptdate": "1992-04-09", "t_max_comment": "y ironic pin" }
+{ "t_partkey": 162, "t_count": 42, "t_avg_quantity": 4.895238095238096d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 25997.630476190476d, "t_avg_discount": 0.05833333333333335d, "t_avg_tax": 0.03547619047619048d, "t_max_shipdate": "1998-09-18", "t_min_commitdate": "1992-04-27", "t_min_receiptdate": "1992-04-14", "t_max_comment": "y asymptotes. regular depen" }
+{ "t_partkey": 163, "t_count": 28, "t_avg_quantity": 5.550000000000001d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 29502.690000000002d, "t_avg_discount": 0.045d, "t_avg_tax": 0.032499999999999994d, "t_max_shipdate": "1998-04-18", "t_min_commitdate": "1992-03-07", "t_min_receiptdate": "1992-03-09", "t_max_comment": "y fluffily stealt" }
+{ "t_partkey": 164, "t_count": 26, "t_avg_quantity": 4.915384615384616d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 26153.778461538463d, "t_avg_discount": 0.04076923076923077d, "t_avg_tax": 0.04115384615384616d, "t_max_shipdate": "1998-10-17", "t_min_commitdate": "1992-03-31", "t_min_receiptdate": "1992-04-04", "t_max_comment": "ymptotes boost. furiously bold p" }
+{ "t_partkey": 165, "t_count": 36, "t_avg_quantity": 5.561111111111112d, "t_max_suppkey": 10, "t_max_linenumber": 5, "t_avg_extendedprice": 29617.365555555552d, "t_avg_discount": 0.05277777777777778d, "t_avg_tax": 0.03777777777777778d, "t_max_shipdate": "1998-06-07", "t_min_commitdate": "1992-03-17", "t_min_receiptdate": "1992-04-07", "t_max_comment": "y unusual deposits prom" }
+{ "t_partkey": 166, "t_count": 33, "t_avg_quantity": 4.830303030303031d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 25749.37939393939d, "t_avg_discount": 0.04666666666666667d, "t_avg_tax": 0.03878787878787879d, "t_max_shipdate": "1998-08-11", "t_min_commitdate": "1992-06-07", "t_min_receiptdate": "1992-08-16", "t_max_comment": "uses detect spec" }
+{ "t_partkey": 167, "t_count": 31, "t_avg_quantity": 4.851612903225806d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25887.236129032255d, "t_avg_discount": 0.052258064516129035d, "t_avg_tax": 0.037096774193548385d, "t_max_shipdate": "1998-05-02", "t_min_commitdate": "1992-05-30", "t_min_receiptdate": "1992-06-08", "t_max_comment": "yly final packages according to the quickl" }
+{ "t_partkey": 168, "t_count": 36, "t_avg_quantity": 5.1722222222222225d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 27623.804444444442d, "t_avg_discount": 0.04944444444444445d, "t_avg_tax": 0.03666666666666667d, "t_max_shipdate": "1998-06-26", "t_min_commitdate": "1992-05-20", "t_min_receiptdate": "1992-05-07", "t_max_comment": "xpress requests haggle after the final, fi" }
+{ "t_partkey": 169, "t_count": 35, "t_avg_quantity": 5.822857142857143d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 31127.829714285715d, "t_avg_discount": 0.047999999999999994d, "t_avg_tax": 0.038857142857142854d, "t_max_shipdate": "1998-07-30", "t_min_commitdate": "1992-04-18", "t_min_receiptdate": "1992-04-18", "t_max_comment": "yly final theodolites. furi" }
+{ "t_partkey": 170, "t_count": 27, "t_avg_quantity": 4.874074074074074d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 26080.43925925926d, "t_avg_discount": 0.050740740740740746d, "t_avg_tax": 0.044814814814814814d, "t_max_shipdate": "1998-10-30", "t_min_commitdate": "1992-06-24", "t_min_receiptdate": "1992-08-13", "t_max_comment": "yly ironic " }
+{ "t_partkey": 171, "t_count": 18, "t_avg_quantity": 4.533333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24279.853333333333d, "t_avg_discount": 0.04055555555555555d, "t_avg_tax": 0.036666666666666674d, "t_max_shipdate": "1998-07-28", "t_min_commitdate": "1992-10-15", "t_min_receiptdate": "1992-11-11", "t_max_comment": "uriously ironic accounts. ironic, ir" }
+{ "t_partkey": 172, "t_count": 18, "t_avg_quantity": 5.1000000000000005d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 27340.335d, "t_avg_discount": 0.05222222222222222d, "t_avg_tax": 0.03722222222222223d, "t_max_shipdate": "1998-08-21", "t_min_commitdate": "1992-09-18", "t_min_receiptdate": "1992-09-26", "t_max_comment": "wake carefully alongside of " }
+{ "t_partkey": 173, "t_count": 34, "t_avg_quantity": 5.247058823529412d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 28154.930588235293d, "t_avg_discount": 0.054411764705882354d, "t_avg_tax": 0.048529411764705876d, "t_max_shipdate": "1998-09-17", "t_min_commitdate": "1992-06-20", "t_min_receiptdate": "1992-06-21", "t_max_comment": "uses. fluffily fina" }
+{ "t_partkey": 174, "t_count": 31, "t_avg_quantity": 5.3419354838709685d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 28690.734193548382d, "t_avg_discount": 0.05354838709677419d, "t_avg_tax": 0.046129032258064515d, "t_max_shipdate": "1998-05-31", "t_min_commitdate": "1992-09-05", "t_min_receiptdate": "1992-07-14", "t_max_comment": "y unusual packages thrash pinto " }
+{ "t_partkey": 175, "t_count": 31, "t_avg_quantity": 5.658064516129032d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 30416.906129032257d, "t_avg_discount": 0.04548387096774193d, "t_avg_tax": 0.03387096774193549d, "t_max_shipdate": "1998-09-06", "t_min_commitdate": "1992-09-30", "t_min_receiptdate": "1992-10-22", "t_max_comment": "yly special " }
+{ "t_partkey": 176, "t_count": 28, "t_avg_quantity": 6.078571428571429d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 32707.88107142857d, "t_avg_discount": 0.06d, "t_avg_tax": 0.03642857142857143d, "t_max_shipdate": "1998-11-11", "t_min_commitdate": "1992-02-28", "t_min_receiptdate": "1992-02-21", "t_max_comment": "y unusual foxes cajole ab" }
+{ "t_partkey": 177, "t_count": 29, "t_avg_quantity": 4.675862068965517d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25183.491724137926d, "t_avg_discount": 0.045517241379310354d, "t_avg_tax": 0.04482758620689655d, "t_max_shipdate": "1998-08-24", "t_min_commitdate": "1992-04-05", "t_min_receiptdate": "1992-05-04", "t_max_comment": "y ironic instructions cajole" }
+{ "t_partkey": 178, "t_count": 41, "t_avg_quantity": 5.414634146341464d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 29189.480487804878d, "t_avg_discount": 0.04878048780487805d, "t_avg_tax": 0.038780487804878055d, "t_max_shipdate": "1998-11-11", "t_min_commitdate": "1992-06-01", "t_min_receiptdate": "1992-06-18", "t_max_comment": "yly ironic decoys; regular, iron" }
+{ "t_partkey": 179, "t_count": 19, "t_avg_quantity": 6.010526315789474d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 32431.898421052636d, "t_avg_discount": 0.04263157894736842d, "t_avg_tax": 0.02368421052631579d, "t_max_shipdate": "1997-06-03", "t_min_commitdate": "1992-04-18", "t_min_receiptdate": "1992-06-10", "t_max_comment": "y regular pain" }
+{ "t_partkey": 180, "t_count": 29, "t_avg_quantity": 4.096551724137931d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 22125.06620689655d, "t_avg_discount": 0.04758620689655172d, "t_avg_tax": 0.036551724137931035d, "t_max_shipdate": "1998-10-28", "t_min_commitdate": "1992-04-02", "t_min_receiptdate": "1992-03-18", "t_max_comment": "y final foxes by the sl" }
+{ "t_partkey": 181, "t_count": 26, "t_avg_quantity": 4.307692307692308d, "t_max_suppkey": 2, "t_max_linenumber": 6, "t_avg_extendedprice": 23286.953846153843d, "t_avg_discount": 0.05615384615384615d, "t_avg_tax": 0.05153846153846154d, "t_max_shipdate": "1998-10-23", "t_min_commitdate": "1992-07-25", "t_min_receiptdate": "1992-07-02", "t_max_comment": "ts across the even requests doze furiously" }
+{ "t_partkey": 182, "t_count": 23, "t_avg_quantity": 4.234782608695652d, "t_max_suppkey": 3, "t_max_linenumber": 7, "t_avg_extendedprice": 22913.985217391306d, "t_avg_discount": 0.03782608695652174d, "t_avg_tax": 0.036521739130434785d, "t_max_shipdate": "1998-11-04", "t_min_commitdate": "1992-04-21", "t_min_receiptdate": "1992-03-13", "t_max_comment": "yly. express ideas agai" }
+{ "t_partkey": 183, "t_count": 31, "t_avg_quantity": 4.851612903225806d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 26275.85032258064d, "t_avg_discount": 0.043225806451612905d, "t_avg_tax": 0.04064516129032259d, "t_max_shipdate": "1998-05-26", "t_min_commitdate": "1992-03-21", "t_min_receiptdate": "1992-05-02", "t_max_comment": "y. even excuses" }
+{ "t_partkey": 184, "t_count": 42, "t_avg_quantity": 5.380952380952381d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 29169.604761904764d, "t_avg_discount": 0.048809523809523817d, "t_avg_tax": 0.035d, "t_max_shipdate": "1998-07-14", "t_min_commitdate": "1992-04-23", "t_min_receiptdate": "1992-04-14", "t_max_comment": "y regular pinto beans. evenly regular packa" }
+{ "t_partkey": 185, "t_count": 21, "t_avg_quantity": 4.542857142857144d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 24649.088571428572d, "t_avg_discount": 0.04619047619047619d, "t_avg_tax": 0.042857142857142864d, "t_max_shipdate": "1998-06-16", "t_min_commitdate": "1992-02-11", "t_min_receiptdate": "1992-05-30", "t_max_comment": "unusual theodol" }
+{ "t_partkey": 186, "t_count": 30, "t_avg_quantity": 4.206666666666667d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 22845.986d, "t_avg_discount": 0.04766666666666667d, "t_avg_tax": 0.044666666666666674d, "t_max_shipdate": "1998-03-06", "t_min_commitdate": "1992-07-07", "t_min_receiptdate": "1992-08-04", "t_max_comment": "ymptotes could u" }
+{ "t_partkey": 187, "t_count": 29, "t_avg_quantity": 5.627586206896552d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 30590.99586206896d, "t_avg_discount": 0.048965517241379306d, "t_avg_tax": 0.04103448275862069d, "t_max_shipdate": "1998-11-11", "t_min_commitdate": "1992-05-01", "t_min_receiptdate": "1992-04-13", "t_max_comment": "y even forges. fluffily furious accounts" }
+{ "t_partkey": 188, "t_count": 31, "t_avg_quantity": 4.2129032258064525d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 22921.98516129032d, "t_avg_discount": 0.06483870967741935d, "t_avg_tax": 0.03483870967741936d, "t_max_shipdate": "1998-06-19", "t_min_commitdate": "1992-08-05", "t_min_receiptdate": "1992-10-05", "t_max_comment": "y regular asymptotes doz" }
+{ "t_partkey": 189, "t_count": 33, "t_avg_quantity": 4.533333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24688.079999999998d, "t_avg_discount": 0.053333333333333344d, "t_avg_tax": 0.03757575757575757d, "t_max_shipdate": "1998-07-26", "t_min_commitdate": "1992-06-08", "t_min_receiptdate": "1992-07-03", "t_max_comment": "y sly theodolites. ironi" }
+{ "t_partkey": 190, "t_count": 39, "t_avg_quantity": 4.912820512820513d, "t_max_suppkey": 1, "t_max_linenumber": 7, "t_avg_extendedprice": 26779.538974358973d, "t_avg_discount": 0.04743589743589744d, "t_avg_tax": 0.03538461538461539d, "t_max_shipdate": "1998-09-24", "t_min_commitdate": "1992-05-02", "t_min_receiptdate": "1992-05-11", "t_max_comment": "y final foxes sleep blithely sl" }
+{ "t_partkey": 191, "t_count": 40, "t_avg_quantity": 5.5200000000000005d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 30116.844d, "t_avg_discount": 0.0475d, "t_avg_tax": 0.04025d, "t_max_shipdate": "1998-10-08", "t_min_commitdate": "1992-06-09", "t_min_receiptdate": "1992-08-09", "t_max_comment": "ys engage. th" }
+{ "t_partkey": 192, "t_count": 29, "t_avg_quantity": 4.655172413793103d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 25421.66379310345d, "t_avg_discount": 0.04724137931034483d, "t_avg_tax": 0.04586206896551724d, "t_max_shipdate": "1998-05-26", "t_min_commitdate": "1992-04-06", "t_min_receiptdate": "1992-03-02", "t_max_comment": "y. fluffily bold accounts grow. furio" }
+{ "t_partkey": 193, "t_count": 27, "t_avg_quantity": 4.4222222222222225d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 24171.64555555556d, "t_avg_discount": 0.044814814814814814d, "t_avg_tax": 0.02851851851851852d, "t_max_shipdate": "1998-08-19", "t_min_commitdate": "1992-05-05", "t_min_receiptdate": "1992-06-03", "t_max_comment": "y players sleep along the final, pending " }
+{ "t_partkey": 194, "t_count": 28, "t_avg_quantity": 4.457142857142857d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 24384.80571428571d, "t_avg_discount": 0.04071428571428572d, "t_avg_tax": 0.031785714285714285d, "t_max_shipdate": "1998-07-06", "t_min_commitdate": "1992-03-18", "t_min_receiptdate": "1992-02-23", "t_max_comment": "y silent requests. regular, even accounts" }
+{ "t_partkey": 195, "t_count": 30, "t_avg_quantity": 5.053333333333334d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 27671.800666666666d, "t_avg_discount": 0.04833333333333333d, "t_avg_tax": 0.045000000000000005d, "t_max_shipdate": "1998-01-21", "t_min_commitdate": "1992-02-12", "t_min_receiptdate": "1992-05-05", "t_max_comment": "yly pending packages snooz" }
+{ "t_partkey": 196, "t_count": 36, "t_avg_quantity": 5.011111111111112d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 27465.649444444443d, "t_avg_discount": 0.04972222222222223d, "t_avg_tax": 0.03944444444444444d, "t_max_shipdate": "1998-10-17", "t_min_commitdate": "1992-03-14", "t_min_receiptdate": "1992-03-27", "t_max_comment": "y quickly " }
+{ "t_partkey": 197, "t_count": 32, "t_avg_quantity": 5.2125d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 28595.514375d, "t_avg_discount": 0.0553125d, "t_avg_tax": 0.0378125d, "t_max_shipdate": "1998-05-19", "t_min_commitdate": "1993-09-09", "t_min_receiptdate": "1993-08-23", "t_max_comment": "warhorses slee" }
+{ "t_partkey": 198, "t_count": 31, "t_avg_quantity": 4.587096774193548d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 25187.519032258064d, "t_avg_discount": 0.03967741935483871d, "t_avg_tax": 0.035806451612903224d, "t_max_shipdate": "1998-10-06", "t_min_commitdate": "1992-02-23", "t_min_receiptdate": "1992-05-15", "t_max_comment": "y even accounts. quickly bold decoys" }
+{ "t_partkey": 199, "t_count": 32, "t_avg_quantity": 5.5062500000000005d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 30262.0746875d, "t_avg_discount": 0.052812500000000005d, "t_avg_tax": 0.043750000000000004d, "t_max_shipdate": "1998-08-14", "t_min_commitdate": "1992-05-13", "t_min_receiptdate": "1992-03-28", "t_max_comment": "y carefully ironi" }
+{ "t_partkey": 200, "t_count": 24, "t_avg_quantity": 5.458333333333334d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 30026.291666666668d, "t_avg_discount": 0.049166666666666664d, "t_avg_tax": 0.03375d, "t_max_shipdate": "1998-09-04", "t_min_commitdate": "1992-05-28", "t_min_receiptdate": "1992-05-12", "t_max_comment": "y silent foxes! carefully ruthless cour" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.adm
new file mode 100644
index 0000000..a09cde0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.adm
@@ -0,0 +1 @@
+863.2285714285715d
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.1.adm
new file mode 100644
index 0000000..453d5e2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q18_large_volume_customer/q18_large_volume_customer.1.adm
@@ -0,0 +1,100 @@
+{ "c_name": "Customer#000000070", "c_custkey": 70, "o_orderkey": 2567, "o_orderdate": "1998-02-27", "o_totalprice": 263411.29d, "sum_quantity": 266 }
+{ "c_name": "Customer#000000010", "c_custkey": 10, "o_orderkey": 4421, "o_orderdate": "1997-04-04", "o_totalprice": 258779.02d, "sum_quantity": 255 }
+{ "c_name": "Customer#000000052", "c_custkey": 52, "o_orderkey": 5765, "o_orderdate": "1994-12-15", "o_totalprice": 249900.42d, "sum_quantity": 247 }
+{ "c_name": "Customer#000000082", "c_custkey": 82, "o_orderkey": 3460, "o_orderdate": "1995-10-03", "o_totalprice": 245976.74d, "sum_quantity": 254 }
+{ "c_name": "Customer#000000068", "c_custkey": 68, "o_orderkey": 2208, "o_orderdate": "1995-05-01", "o_totalprice": 245388.06d, "sum_quantity": 256 }
+{ "c_name": "Customer#000000028", "c_custkey": 28, "o_orderkey": 2306, "o_orderdate": "1995-07-26", "o_totalprice": 244704.23d, "sum_quantity": 235 }
+{ "c_name": "Customer#000000146", "c_custkey": 146, "o_orderkey": 5925, "o_orderdate": "1995-11-13", "o_totalprice": 242588.87d, "sum_quantity": 242 }
+{ "c_name": "Customer#000000029", "c_custkey": 29, "o_orderkey": 1121, "o_orderdate": "1997-01-13", "o_totalprice": 241837.88d, "sum_quantity": 242 }
+{ "c_name": "Customer#000000067", "c_custkey": 67, "o_orderkey": 3907, "o_orderdate": "1992-08-19", "o_totalprice": 240457.56d, "sum_quantity": 239 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 5158, "o_orderdate": "1997-01-21", "o_totalprice": 240284.95d, "sum_quantity": 248 }
+{ "c_name": "Customer#000000131", "c_custkey": 131, "o_orderkey": 4484, "o_orderdate": "1996-12-24", "o_totalprice": 237947.61d, "sum_quantity": 243 }
+{ "c_name": "Customer#000000115", "c_custkey": 115, "o_orderkey": 645, "o_orderdate": "1994-12-03", "o_totalprice": 234763.73d, "sum_quantity": 245 }
+{ "c_name": "Customer#000000049", "c_custkey": 49, "o_orderkey": 4294, "o_orderdate": "1992-08-15", "o_totalprice": 232194.74d, "sum_quantity": 225 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 1477, "o_orderdate": "1997-08-24", "o_totalprice": 231831.35d, "sum_quantity": 236 }
+{ "c_name": "Customer#000000044", "c_custkey": 44, "o_orderkey": 4645, "o_orderdate": "1994-09-20", "o_totalprice": 231012.22d, "sum_quantity": 248 }
+{ "c_name": "Customer#000000089", "c_custkey": 89, "o_orderkey": 5957, "o_orderdate": "1993-12-27", "o_totalprice": 230949.45d, "sum_quantity": 242 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 326, "o_orderdate": "1995-06-04", "o_totalprice": 229165.17d, "sum_quantity": 228 }
+{ "c_name": "Customer#000000067", "c_custkey": 67, "o_orderkey": 928, "o_orderdate": "1995-03-02", "o_totalprice": 228136.49d, "sum_quantity": 241 }
+{ "c_name": "Customer#000000079", "c_custkey": 79, "o_orderkey": 3808, "o_orderdate": "1994-04-24", "o_totalprice": 228054.01d, "sum_quantity": 227 }
+{ "c_name": "Customer#000000037", "c_custkey": 37, "o_orderkey": 5317, "o_orderdate": "1994-09-09", "o_totalprice": 228002.51d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000004", "c_custkey": 4, "o_orderkey": 358, "o_orderdate": "1993-09-20", "o_totalprice": 226806.66d, "sum_quantity": 223 }
+{ "c_name": "Customer#000000142", "c_custkey": 142, "o_orderkey": 5699, "o_orderdate": "1992-07-30", "o_totalprice": 226314.91d, "sum_quantity": 240 }
+{ "c_name": "Customer#000000121", "c_custkey": 121, "o_orderkey": 1888, "o_orderdate": "1993-10-31", "o_totalprice": 224724.11d, "sum_quantity": 225 }
+{ "c_name": "Customer#000000094", "c_custkey": 94, "o_orderkey": 2690, "o_orderdate": "1996-03-31", "o_totalprice": 224674.27d, "sum_quantity": 219 }
+{ "c_name": "Customer#000000094", "c_custkey": 94, "o_orderkey": 5413, "o_orderdate": "1997-10-17", "o_totalprice": 224382.57d, "sum_quantity": 212 }
+{ "c_name": "Customer#000000032", "c_custkey": 32, "o_orderkey": 5381, "o_orderdate": "1993-01-29", "o_totalprice": 223995.46d, "sum_quantity": 228 }
+{ "c_name": "Customer#000000145", "c_custkey": 145, "o_orderkey": 518, "o_orderdate": "1998-02-08", "o_totalprice": 223537.09d, "sum_quantity": 214 }
+{ "c_name": "Customer#000000029", "c_custkey": 29, "o_orderkey": 2945, "o_orderdate": "1996-01-03", "o_totalprice": 223507.72d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000007", "c_custkey": 7, "o_orderkey": 3654, "o_orderdate": "1992-06-03", "o_totalprice": 222653.54d, "sum_quantity": 222 }
+{ "c_name": "Customer#000000145", "c_custkey": 145, "o_orderkey": 807, "o_orderdate": "1993-11-24", "o_totalprice": 222392.53d, "sum_quantity": 216 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 3619, "o_orderdate": "1996-11-20", "o_totalprice": 222274.54d, "sum_quantity": 221 }
+{ "c_name": "Customer#000000070", "c_custkey": 70, "o_orderkey": 5472, "o_orderdate": "1993-04-11", "o_totalprice": 221636.83d, "sum_quantity": 217 }
+{ "c_name": "Customer#000000137", "c_custkey": 137, "o_orderkey": 4900, "o_orderdate": "1992-06-30", "o_totalprice": 221320.76d, "sum_quantity": 227 }
+{ "c_name": "Customer#000000106", "c_custkey": 106, "o_orderkey": 3778, "o_orderdate": "1993-05-26", "o_totalprice": 221036.31d, "sum_quantity": 225 }
+{ "c_name": "Customer#000000121", "c_custkey": 121, "o_orderkey": 1153, "o_orderdate": "1996-04-18", "o_totalprice": 220727.97d, "sum_quantity": 209 }
+{ "c_name": "Customer#000000070", "c_custkey": 70, "o_orderkey": 4004, "o_orderdate": "1993-05-07", "o_totalprice": 220715.14d, "sum_quantity": 228 }
+{ "c_name": "Customer#000000098", "c_custkey": 98, "o_orderkey": 768, "o_orderdate": "1996-08-20", "o_totalprice": 220636.82d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 5606, "o_orderdate": "1996-11-12", "o_totalprice": 219959.08d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000055", "c_custkey": 55, "o_orderkey": 484, "o_orderdate": "1997-01-03", "o_totalprice": 219920.62d, "sum_quantity": 224 }
+{ "c_name": "Customer#000000140", "c_custkey": 140, "o_orderkey": 4230, "o_orderdate": "1992-03-04", "o_totalprice": 219709.6d, "sum_quantity": 217 }
+{ "c_name": "Customer#000000082", "c_custkey": 82, "o_orderkey": 39, "o_orderdate": "1996-09-20", "o_totalprice": 219707.84d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000037", "c_custkey": 37, "o_orderkey": 2789, "o_orderdate": "1998-03-14", "o_totalprice": 219123.27d, "sum_quantity": 218 }
+{ "c_name": "Customer#000000017", "c_custkey": 17, "o_orderkey": 3269, "o_orderdate": "1996-03-01", "o_totalprice": 218697.85d, "sum_quantity": 220 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 3590, "o_orderdate": "1995-05-13", "o_totalprice": 218482.7d, "sum_quantity": 210 }
+{ "c_name": "Customer#000000134", "c_custkey": 134, "o_orderkey": 614, "o_orderdate": "1992-12-01", "o_totalprice": 218116.21d, "sum_quantity": 204 }
+{ "c_name": "Customer#000000092", "c_custkey": 92, "o_orderkey": 4197, "o_orderdate": "1996-08-13", "o_totalprice": 217709.03d, "sum_quantity": 225 }
+{ "c_name": "Customer#000000133", "c_custkey": 133, "o_orderkey": 1156, "o_orderdate": "1996-10-19", "o_totalprice": 217682.81d, "sum_quantity": 218 }
+{ "c_name": "Customer#000000046", "c_custkey": 46, "o_orderkey": 453, "o_orderdate": "1997-05-26", "o_totalprice": 216826.73d, "sum_quantity": 226 }
+{ "c_name": "Customer#000000124", "c_custkey": 124, "o_orderkey": 3109, "o_orderdate": "1993-07-24", "o_totalprice": 216104.85d, "sum_quantity": 210 }
+{ "c_name": "Customer#000000043", "c_custkey": 43, "o_orderkey": 4994, "o_orderdate": "1996-06-29", "o_totalprice": 216071.76d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 3713, "o_orderdate": "1998-05-07", "o_totalprice": 215342.63d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000029", "c_custkey": 29, "o_orderkey": 68, "o_orderdate": "1998-04-18", "o_totalprice": 215135.72d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000013", "c_custkey": 13, "o_orderkey": 2438, "o_orderdate": "1993-07-15", "o_totalprice": 214494.39d, "sum_quantity": 210 }
+{ "c_name": "Customer#000000133", "c_custkey": 133, "o_orderkey": 4613, "o_orderdate": "1998-03-05", "o_totalprice": 212339.55d, "sum_quantity": 214 }
+{ "c_name": "Customer#000000106", "c_custkey": 106, "o_orderkey": 1761, "o_orderdate": "1993-12-24", "o_totalprice": 211925.95d, "sum_quantity": 218 }
+{ "c_name": "Customer#000000049", "c_custkey": 49, "o_orderkey": 1248, "o_orderdate": "1992-01-02", "o_totalprice": 210713.88d, "sum_quantity": 207 }
+{ "c_name": "Customer#000000005", "c_custkey": 5, "o_orderkey": 5859, "o_orderdate": "1997-04-23", "o_totalprice": 210643.96d, "sum_quantity": 211 }
+{ "c_name": "Customer#000000106", "c_custkey": 106, "o_orderkey": 1827, "o_orderdate": "1996-06-22", "o_totalprice": 210113.88d, "sum_quantity": 205 }
+{ "c_name": "Customer#000000085", "c_custkey": 85, "o_orderkey": 5184, "o_orderdate": "1998-07-20", "o_totalprice": 209155.48d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000133", "c_custkey": 133, "o_orderkey": 710, "o_orderdate": "1993-01-02", "o_totalprice": 208974.42d, "sum_quantity": 196 }
+{ "c_name": "Customer#000000052", "c_custkey": 52, "o_orderkey": 5186, "o_orderdate": "1996-08-03", "o_totalprice": 208892.63d, "sum_quantity": 210 }
+{ "c_name": "Customer#000000028", "c_custkey": 28, "o_orderkey": 2050, "o_orderdate": "1994-06-02", "o_totalprice": 208517.98d, "sum_quantity": 217 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 2180, "o_orderdate": "1996-09-14", "o_totalprice": 208481.57d, "sum_quantity": 212 }
+{ "c_name": "Customer#000000119", "c_custkey": 119, "o_orderkey": 3588, "o_orderdate": "1995-03-19", "o_totalprice": 207925.83d, "sum_quantity": 212 }
+{ "c_name": "Customer#000000134", "c_custkey": 134, "o_orderkey": 1444, "o_orderdate": "1994-12-06", "o_totalprice": 207907.6d, "sum_quantity": 205 }
+{ "c_name": "Customer#000000103", "c_custkey": 103, "o_orderkey": 742, "o_orderdate": "1994-12-23", "o_totalprice": 207632.55d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000017", "c_custkey": 17, "o_orderkey": 4099, "o_orderdate": "1992-08-21", "o_totalprice": 207364.8d, "sum_quantity": 208 }
+{ "c_name": "Customer#000000109", "c_custkey": 109, "o_orderkey": 1286, "o_orderdate": "1993-05-14", "o_totalprice": 207291.83d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000079", "c_custkey": 79, "o_orderkey": 5633, "o_orderdate": "1998-05-31", "o_totalprice": 207119.83d, "sum_quantity": 203 }
+{ "c_name": "Customer#000000062", "c_custkey": 62, "o_orderkey": 2022, "o_orderdate": "1992-03-15", "o_totalprice": 206742.11d, "sum_quantity": 209 }
+{ "c_name": "Customer#000000022", "c_custkey": 22, "o_orderkey": 4583, "o_orderdate": "1994-09-25", "o_totalprice": 206495.43d, "sum_quantity": 197 }
+{ "c_name": "Customer#000000148", "c_custkey": 148, "o_orderkey": 5185, "o_orderdate": "1997-07-25", "o_totalprice": 206179.68d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000044", "c_custkey": 44, "o_orderkey": 3175, "o_orderdate": "1994-07-15", "o_totalprice": 205282.63d, "sum_quantity": 215 }
+{ "c_name": "Customer#000000056", "c_custkey": 56, "o_orderkey": 2565, "o_orderdate": "1998-02-28", "o_totalprice": 204438.57d, "sum_quantity": 201 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 3747, "o_orderdate": "1996-08-20", "o_totalprice": 204355.65d, "sum_quantity": 195 }
+{ "c_name": "Customer#000000101", "c_custkey": 101, "o_orderkey": 4964, "o_orderdate": "1997-07-28", "o_totalprice": 204163.1d, "sum_quantity": 197 }
+{ "c_name": "Customer#000000062", "c_custkey": 62, "o_orderkey": 4992, "o_orderdate": "1992-05-10", "o_totalprice": 203904.8d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000010", "c_custkey": 10, "o_orderkey": 3751, "o_orderdate": "1994-04-27", "o_totalprice": 202917.72d, "sum_quantity": 204 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 2534, "o_orderdate": "1996-07-17", "o_totalprice": 202784.54d, "sum_quantity": 214 }
+{ "c_name": "Customer#000000001", "c_custkey": 1, "o_orderkey": 164, "o_orderdate": "1992-10-21", "o_totalprice": 202660.52d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000118", "c_custkey": 118, "o_orderkey": 1283, "o_orderdate": "1996-08-30", "o_totalprice": 202623.92d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000010", "c_custkey": 10, "o_orderkey": 1890, "o_orderdate": "1996-12-18", "o_totalprice": 202364.58d, "sum_quantity": 207 }
+{ "c_name": "Customer#000000077", "c_custkey": 77, "o_orderkey": 1762, "o_orderdate": "1994-08-20", "o_totalprice": 202227.17d, "sum_quantity": 216 }
+{ "c_name": "Customer#000000106", "c_custkey": 106, "o_orderkey": 4196, "o_orderdate": "1998-05-15", "o_totalprice": 201455.98d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000064", "c_custkey": 64, "o_orderkey": 5895, "o_orderdate": "1997-01-01", "o_totalprice": 201419.83d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000008", "c_custkey": 8, "o_orderkey": 644, "o_orderdate": "1992-05-01", "o_totalprice": 201268.06d, "sum_quantity": 202 }
+{ "c_name": "Customer#000000047", "c_custkey": 47, "o_orderkey": 261, "o_orderdate": "1993-06-29", "o_totalprice": 201003.12d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000079", "c_custkey": 79, "o_orderkey": 4672, "o_orderdate": "1995-11-07", "o_totalprice": 199593.71d, "sum_quantity": 203 }
+{ "c_name": "Customer#000000131", "c_custkey": 131, "o_orderkey": 930, "o_orderdate": "1994-12-17", "o_totalprice": 199102.23d, "sum_quantity": 204 }
+{ "c_name": "Customer#000000118", "c_custkey": 118, "o_orderkey": 4161, "o_orderdate": "1993-08-21", "o_totalprice": 198995.21d, "sum_quantity": 211 }
+{ "c_name": "Customer#000000073", "c_custkey": 73, "o_orderkey": 4069, "o_orderdate": "1992-05-13", "o_totalprice": 198816.13d, "sum_quantity": 199 }
+{ "c_name": "Customer#000000142", "c_custkey": 142, "o_orderkey": 5696, "o_orderdate": "1995-05-04", "o_totalprice": 198723.3d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000134", "c_custkey": 134, "o_orderkey": 3872, "o_orderdate": "1996-09-06", "o_totalprice": 198538.68d, "sum_quantity": 207 }
+{ "c_name": "Customer#000000127", "c_custkey": 127, "o_orderkey": 1059, "o_orderdate": "1994-02-27", "o_totalprice": 198360.22d, "sum_quantity": 194 }
+{ "c_name": "Customer#000000103", "c_custkey": 103, "o_orderkey": 4293, "o_orderdate": "1996-08-20", "o_totalprice": 198322.91d, "sum_quantity": 202 }
+{ "c_name": "Customer#000000080", "c_custkey": 80, "o_orderkey": 993, "o_orderdate": "1995-09-10", "o_totalprice": 198238.65d, "sum_quantity": 194 }
+{ "c_name": "Customer#000000091", "c_custkey": 91, "o_orderkey": 420, "o_orderdate": "1995-10-31", "o_totalprice": 198039.23d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000092", "c_custkey": 92, "o_orderkey": 3333, "o_orderdate": "1992-09-16", "o_totalprice": 197973.22d, "sum_quantity": 195 }
+{ "c_name": "Customer#000000146", "c_custkey": 146, "o_orderkey": 4192, "o_orderdate": "1998-04-19", "o_totalprice": 197192.95d, "sum_quantity": 209 }
+{ "c_name": "Customer#000000145", "c_custkey": 145, "o_orderkey": 1575, "o_orderdate": "1995-09-13", "o_totalprice": 197031.52d, "sum_quantity": 204 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.1.adm
new file mode 100644
index 0000000..aea671f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.1.adm
@@ -0,0 +1 @@
+51515.7344d
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.1.adm
new file mode 100644
index 0000000..424ab59
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q20_potential_part_promotion/q20_potential_part_promotion.1.adm
@@ -0,0 +1,10 @@
+{ "s_name": "Supplier#000000001", "s_address": " N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ" }
+{ "s_name": "Supplier#000000002", "s_address": "89eJ5ksX3ImxJQBvxObC," }
+{ "s_name": "Supplier#000000003", "s_address": "q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3" }
+{ "s_name": "Supplier#000000004", "s_address": "Bk7ah4CK8SYQTepEmvMkkgMwg" }
+{ "s_name": "Supplier#000000005", "s_address": "Gcdm2rJRzl5qlTVzc" }
+{ "s_name": "Supplier#000000006", "s_address": "tQxuVm7s7CnK" }
+{ "s_name": "Supplier#000000007", "s_address": "s,4TicNGB4uO6PaSqNBUq" }
+{ "s_name": "Supplier#000000008", "s_address": "9Sq4bBH2FQEmaFOocY45sRTxo6yuoG" }
+{ "s_name": "Supplier#000000009", "s_address": "1KhUgZegwM3ua7dsYmekYBsK" }
+{ "s_name": "Supplier#000000010", "s_address": "Saygah3gYWMp72i PY" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.adm
new file mode 100644
index 0000000..2ae0988
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.adm
@@ -0,0 +1,10 @@
+{ "s_name": "Supplier#000000007", "numwait": 431 }
+{ "s_name": "Supplier#000000005", "numwait": 417 }
+{ "s_name": "Supplier#000000001", "numwait": 403 }
+{ "s_name": "Supplier#000000009", "numwait": 373 }
+{ "s_name": "Supplier#000000004", "numwait": 367 }
+{ "s_name": "Supplier#000000002", "numwait": 364 }
+{ "s_name": "Supplier#000000010", "numwait": 358 }
+{ "s_name": "Supplier#000000003", "numwait": 349 }
+{ "s_name": "Supplier#000000008", "numwait": 347 }
+{ "s_name": "Supplier#000000006", "numwait": 343 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.1.adm
new file mode 100644
index 0000000..4f3cd97
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.1.adm
@@ -0,0 +1,23 @@
+{ "cntrycode": "10", "numcust": 3, "totacctbal": 20747.13d }
+{ "cntrycode": "11", "numcust": 5, "totacctbal": 35208.88d }
+{ "cntrycode": "12", "numcust": 2, "totacctbal": 13735.27d }
+{ "cntrycode": "13", "numcust": 2, "totacctbal": 13545.3d }
+{ "cntrycode": "14", "numcust": 1, "totacctbal": 9963.15d }
+{ "cntrycode": "15", "numcust": 2, "totacctbal": 14624.84d }
+{ "cntrycode": "16", "numcust": 2, "totacctbal": 11239.02d }
+{ "cntrycode": "17", "numcust": 1, "totacctbal": 9127.27d }
+{ "cntrycode": "18", "numcust": 3, "totacctbal": 22156.91d }
+{ "cntrycode": "19", "numcust": 6, "totacctbal": 43758.41d }
+{ "cntrycode": "20", "numcust": 3, "totacctbal": 23085.67d }
+{ "cntrycode": "21", "numcust": 3, "totacctbal": 19400.52d }
+{ "cntrycode": "22", "numcust": 3, "totacctbal": 20332.18d }
+{ "cntrycode": "23", "numcust": 3, "totacctbal": 25483.06d }
+{ "cntrycode": "25", "numcust": 3, "totacctbal": 19038.36d }
+{ "cntrycode": "26", "numcust": 5, "totacctbal": 38943.9d }
+{ "cntrycode": "27", "numcust": 2, "totacctbal": 13248.06d }
+{ "cntrycode": "28", "numcust": 5, "totacctbal": 42700.5d }
+{ "cntrycode": "29", "numcust": 4, "totacctbal": 36059.01d }
+{ "cntrycode": "30", "numcust": 2, "totacctbal": 17528.46d }
+{ "cntrycode": "31", "numcust": 3, "totacctbal": 23599.109999999997d }
+{ "cntrycode": "32", "numcust": 4, "totacctbal": 25754.22d }
+{ "cntrycode": "33", "numcust": 3, "totacctbal": 20359.59d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-ASTERIXDB-1127/query-ASTERIXDB-1127.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-ASTERIXDB-1127/query-ASTERIXDB-1127.1.adm
new file mode 100644
index 0000000..6407653
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-ASTERIXDB-1127/query-ASTERIXDB-1127.1.adm
@@ -0,0 +1,8 @@
+{ "l_orderkey": 1637, "revenue": 164224.9253d, "o_orderdate": "1995-02-08", "o_shippriority": 0i32 }
+{ "l_orderkey": 5191, "revenue": 49378.309400000006d, "o_orderdate": "1994-12-11", "o_shippriority": 0i32 }
+{ "l_orderkey": 742, "revenue": 43728.048d, "o_orderdate": "1994-12-23", "o_shippriority": 0i32 }
+{ "l_orderkey": 3492, "revenue": 43716.072400000005d, "o_orderdate": "1994-11-24", "o_shippriority": 0i32 }
+{ "l_orderkey": 2883, "revenue": 36666.9612d, "o_orderdate": "1995-01-23", "o_shippriority": 0i32 }
+{ "l_orderkey": 998, "revenue": 11785.548600000002d, "o_orderdate": "1994-11-26", "o_shippriority": 0i32 }
+{ "l_orderkey": 3430, "revenue": 4726.6775d, "o_orderdate": "1994-12-12", "o_shippriority": 0i32 }
+{ "l_orderkey": 4423, "revenue": 3055.9365d, "o_orderdate": "1995-02-17", "o_shippriority": 0i32 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue562/query-issue562.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue562/query-issue562.1.adm
new file mode 100644
index 0000000..aa7bb6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue562/query-issue562.1.adm
@@ -0,0 +1,7 @@
+{ "cntrycode": "13", "numcust": 1, "totacctbal": 5679.84d }
+{ "cntrycode": "17", "numcust": 2, "totacctbal": 11309.79d }
+{ "cntrycode": "18", "numcust": 3, "totacctbal": 16076.24d }
+{ "cntrycode": "23", "numcust": 2, "totacctbal": 12652.16d }
+{ "cntrycode": "29", "numcust": 2, "totacctbal": 17195.08d }
+{ "cntrycode": "30", "numcust": 2, "totacctbal": 9662.279999999999d }
+{ "cntrycode": "31", "numcust": 3, "totacctbal": 18470.33d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue601/query-issue601.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue601/query-issue601.1.adm
new file mode 100644
index 0000000..7d83268
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue601/query-issue601.1.adm
@@ -0,0 +1,7 @@
+{ "l_linenumber": 6, "count_order": 432 }
+{ "l_linenumber": 1, "count_order": 1500 }
+{ "l_linenumber": 2, "count_order": 1291 }
+{ "l_linenumber": 4, "count_order": 862 }
+{ "l_linenumber": 3, "count_order": 1077 }
+{ "l_linenumber": 5, "count_order": 632 }
+{ "l_linenumber": 7, "count_order": 211 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue638/query-issue638.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue638/query-issue638.1.adm
new file mode 100644
index 0000000..e9f3f47
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue638/query-issue638.1.adm
@@ -0,0 +1,59 @@
+{ "nation": "ARGENTINA", "o_year": 1997, "sum_profit": 18247.873399999993d }
+{ "nation": "ARGENTINA", "o_year": 1996, "sum_profit": 7731.089399999995d }
+{ "nation": "ARGENTINA", "o_year": 1995, "sum_profit": 134490.5697d }
+{ "nation": "ARGENTINA", "o_year": 1994, "sum_profit": 36767.101500000004d }
+{ "nation": "ARGENTINA", "o_year": 1993, "sum_profit": 35857.08d }
+{ "nation": "ARGENTINA", "o_year": 1992, "sum_profit": 35740.0d }
+{ "nation": "ETHIOPIA", "o_year": 1998, "sum_profit": 2758.7801999999992d }
+{ "nation": "ETHIOPIA", "o_year": 1997, "sum_profit": 19419.294599999994d }
+{ "nation": "ETHIOPIA", "o_year": 1995, "sum_profit": 51231.87439999999d }
+{ "nation": "ETHIOPIA", "o_year": 1994, "sum_profit": 3578.9478999999974d }
+{ "nation": "ETHIOPIA", "o_year": 1992, "sum_profit": 1525.8234999999986d }
+{ "nation": "IRAN", "o_year": 1998, "sum_profit": 37817.229600000006d }
+{ "nation": "IRAN", "o_year": 1997, "sum_profit": 52643.77359999999d }
+{ "nation": "IRAN", "o_year": 1996, "sum_profit": 70143.77609999999d }
+{ "nation": "IRAN", "o_year": 1995, "sum_profit": 84094.58260000001d }
+{ "nation": "IRAN", "o_year": 1994, "sum_profit": 18140.925599999995d }
+{ "nation": "IRAN", "o_year": 1993, "sum_profit": 78655.1676d }
+{ "nation": "IRAN", "o_year": 1992, "sum_profit": 87142.2396d }
+{ "nation": "IRAQ", "o_year": 1998, "sum_profit": 22860.8082d }
+{ "nation": "IRAQ", "o_year": 1997, "sum_profit": 93676.24359999999d }
+{ "nation": "IRAQ", "o_year": 1996, "sum_profit": 45103.3242d }
+{ "nation": "IRAQ", "o_year": 1994, "sum_profit": 36010.728599999995d }
+{ "nation": "IRAQ", "o_year": 1993, "sum_profit": 33221.9399d }
+{ "nation": "IRAQ", "o_year": 1992, "sum_profit": 47755.05900000001d }
+{ "nation": "KENYA", "o_year": 1998, "sum_profit": 44194.831999999995d }
+{ "nation": "KENYA", "o_year": 1997, "sum_profit": 57578.3626d }
+{ "nation": "KENYA", "o_year": 1996, "sum_profit": 59195.9021d }
+{ "nation": "KENYA", "o_year": 1995, "sum_profit": 79262.6278d }
+{ "nation": "KENYA", "o_year": 1994, "sum_profit": 102360.66609999999d }
+{ "nation": "KENYA", "o_year": 1993, "sum_profit": 128422.01959999999d }
+{ "nation": "KENYA", "o_year": 1992, "sum_profit": 181517.20890000003d }
+{ "nation": "MOROCCO", "o_year": 1998, "sum_profit": 41797.823199999984d }
+{ "nation": "MOROCCO", "o_year": 1997, "sum_profit": 23685.801799999997d }
+{ "nation": "MOROCCO", "o_year": 1996, "sum_profit": 62115.19579999999d }
+{ "nation": "MOROCCO", "o_year": 1995, "sum_profit": 42442.64300000001d }
+{ "nation": "MOROCCO", "o_year": 1994, "sum_profit": 48655.87800000001d }
+{ "nation": "MOROCCO", "o_year": 1993, "sum_profit": 22926.744400000003d }
+{ "nation": "MOROCCO", "o_year": 1992, "sum_profit": 32239.8088d }
+{ "nation": "PERU", "o_year": 1998, "sum_profit": 86999.36459999997d }
+{ "nation": "PERU", "o_year": 1997, "sum_profit": 121110.41070000001d }
+{ "nation": "PERU", "o_year": 1996, "sum_profit": 177040.40759999998d }
+{ "nation": "PERU", "o_year": 1995, "sum_profit": 122247.94519999999d }
+{ "nation": "PERU", "o_year": 1994, "sum_profit": 88046.2533d }
+{ "nation": "PERU", "o_year": 1993, "sum_profit": 49379.813799999996d }
+{ "nation": "PERU", "o_year": 1992, "sum_profit": 80646.86050000001d }
+{ "nation": "UNITED KINGDOM", "o_year": 1998, "sum_profit": 50577.25560000001d }
+{ "nation": "UNITED KINGDOM", "o_year": 1997, "sum_profit": 114288.86049999998d }
+{ "nation": "UNITED KINGDOM", "o_year": 1996, "sum_profit": 147684.46480000002d }
+{ "nation": "UNITED KINGDOM", "o_year": 1995, "sum_profit": 225267.6576d }
+{ "nation": "UNITED KINGDOM", "o_year": 1994, "sum_profit": 140595.58639999997d }
+{ "nation": "UNITED KINGDOM", "o_year": 1993, "sum_profit": 322548.49210000003d }
+{ "nation": "UNITED KINGDOM", "o_year": 1992, "sum_profit": 67747.88279999999d }
+{ "nation": "UNITED STATES", "o_year": 1998, "sum_profit": 3957.0431999999996d }
+{ "nation": "UNITED STATES", "o_year": 1997, "sum_profit": 94729.5704d }
+{ "nation": "UNITED STATES", "o_year": 1996, "sum_profit": 79297.8567d }
+{ "nation": "UNITED STATES", "o_year": 1995, "sum_profit": 62201.23360000001d }
+{ "nation": "UNITED STATES", "o_year": 1994, "sum_profit": 43075.62989999999d }
+{ "nation": "UNITED STATES", "o_year": 1993, "sum_profit": 27168.486199999996d }
+{ "nation": "UNITED STATES", "o_year": 1992, "sum_profit": 34092.366d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue785-2/query-issue785-2.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue785-2/query-issue785-2.1.adm
new file mode 100644
index 0000000..c6a683d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue785-2/query-issue785-2.1.adm
@@ -0,0 +1,10 @@
+{ "nation_key": 21, "sum_price": [ { "orderdate": "1994-02-27", "sum_price": 198360.22d }, { "orderdate": "1992-07-07", "sum_price": 180692.9d }, { "orderdate": "1996-06-28", "sum_price": 139915.23d } ] }
+{ "nation_key": 23, "sum_price": [ { "orderdate": "1993-06-08", "sum_price": 161307.05d }, { "orderdate": "1995-12-07", "sum_price": 153048.74d }, { "orderdate": "1994-08-22", "sum_price": 147071.86d } ] }
+{ "nation_key": 1, "sum_price": [ { "orderdate": "1993-05-26", "sum_price": 221036.31d }, { "orderdate": "1992-03-20", "sum_price": 216230.27000000002d }, { "orderdate": "1993-12-24", "sum_price": 211925.95d } ] }
+{ "nation_key": 2, "sum_price": [ { "orderdate": "1996-03-01", "sum_price": 218697.85d }, { "orderdate": "1996-08-13", "sum_price": 217709.03d }, { "orderdate": "1992-08-21", "sum_price": 207364.8d } ] }
+{ "nation_key": 4, "sum_price": [ { "orderdate": "1993-09-20", "sum_price": 226806.66d }, { "orderdate": "1992-03-04", "sum_price": 219709.6d }, { "orderdate": "1996-01-06", "sum_price": 190490.78d } ] }
+{ "nation_key": 19, "sum_price": [ { "orderdate": "1993-12-29", "sum_price": 328959.87d }, { "orderdate": "1997-08-04", "sum_price": 244636.7d }, { "orderdate": "1996-11-20", "sum_price": 222274.54d } ] }
+{ "nation_key": 20, "sum_price": [ { "orderdate": "1993-01-31", "sum_price": 190960.69d }, { "orderdate": "1998-07-17", "sum_price": 187156.38d }, { "orderdate": "1993-03-25", "sum_price": 167017.39d } ] }
+{ "nation_key": 22, "sum_price": [ { "orderdate": "1998-02-27", "sum_price": 263411.29d }, { "orderdate": "1993-04-11", "sum_price": 221636.83d }, { "orderdate": "1993-05-07", "sum_price": 220715.14d } ] }
+{ "nation_key": 0, "sum_price": [ { "orderdate": "1997-01-13", "sum_price": 241837.88d }, { "orderdate": "1997-01-21", "sum_price": 240284.95d }, { "orderdate": "1997-08-24", "sum_price": 231831.35d } ] }
+{ "nation_key": 3, "sum_price": [ { "orderdate": "1997-04-23", "sum_price": 351762.82999999996d }, { "orderdate": "1995-11-13", "sum_price": 242588.87d }, { "orderdate": "1993-07-15", "sum_price": 214494.39d } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue785/query-issue785.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue785/query-issue785.1.adm
new file mode 100644
index 0000000..216a8f6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue785/query-issue785.1.adm
@@ -0,0 +1,24 @@
+{ "nation_key": 6, "sum_price": [ { "orderdate": "1992-05-28", "sum_price": 335178.33d }, { "orderdate": "1997-05-26", "sum_price": 216826.73d }, { "orderdate": "1996-04-30", "sum_price": 180054.29d } ] }
+{ "nation_key": 11, "sum_price": [ { "orderdate": "1994-12-15", "sum_price": 249900.42d }, { "orderdate": "1996-12-24", "sum_price": 237947.61d }, { "orderdate": "1992-12-01", "sum_price": 218116.21d } ] }
+{ "nation_key": 12, "sum_price": [ { "orderdate": "1995-05-01", "sum_price": 245388.06d }, { "orderdate": "1997-02-17", "sum_price": 225518.72d }, { "orderdate": "1996-08-20", "sum_price": 220636.82d } ] }
+{ "nation_key": 14, "sum_price": [ { "orderdate": "1993-12-27", "sum_price": 230949.45d }, { "orderdate": "1992-04-26", "sum_price": 134333.33d }, { "orderdate": "1997-03-09", "sum_price": 132838.49d } ] }
+{ "nation_key": 21, "sum_price": [ { "orderdate": "1994-02-27", "sum_price": 198360.22d }, { "orderdate": "1992-07-07", "sum_price": 180692.9d }, { "orderdate": "1996-06-28", "sum_price": 139915.23d } ] }
+{ "nation_key": 23, "sum_price": [ { "orderdate": "1993-06-08", "sum_price": 161307.05d }, { "orderdate": "1995-12-07", "sum_price": 153048.74d }, { "orderdate": "1994-08-22", "sum_price": 147071.86d } ] }
+{ "nation_key": 1, "sum_price": [ { "orderdate": "1993-05-26", "sum_price": 221036.31d }, { "orderdate": "1992-03-20", "sum_price": 216230.27000000002d }, { "orderdate": "1993-12-24", "sum_price": 211925.95d } ] }
+{ "nation_key": 2, "sum_price": [ { "orderdate": "1996-03-01", "sum_price": 218697.85d }, { "orderdate": "1996-08-13", "sum_price": 217709.03d }, { "orderdate": "1992-08-21", "sum_price": 207364.8d } ] }
+{ "nation_key": 4, "sum_price": [ { "orderdate": "1993-09-20", "sum_price": 226806.66d }, { "orderdate": "1992-03-04", "sum_price": 219709.6d }, { "orderdate": "1996-01-06", "sum_price": 190490.78d } ] }
+{ "nation_key": 13, "sum_price": [ { "orderdate": "1998-02-08", "sum_price": 223537.09d }, { "orderdate": "1993-11-24", "sum_price": 222392.53d }, { "orderdate": "1995-09-13", "sum_price": 197031.52d } ] }
+{ "nation_key": 15, "sum_price": [ { "orderdate": "1998-05-31", "sum_price": 366291.52d }, { "orderdate": "1994-04-24", "sum_price": 228054.01d }, { "orderdate": "1993-01-29", "sum_price": 223995.46d } ] }
+{ "nation_key": 16, "sum_price": [ { "orderdate": "1994-09-20", "sum_price": 231012.22d }, { "orderdate": "1992-06-30", "sum_price": 221320.76d }, { "orderdate": "1993-05-14", "sum_price": 207291.83d } ] }
+{ "nation_key": 19, "sum_price": [ { "orderdate": "1993-12-29", "sum_price": 328959.87d }, { "orderdate": "1997-08-04", "sum_price": 244636.7d }, { "orderdate": "1996-11-20", "sum_price": 222274.54d } ] }
+{ "nation_key": 20, "sum_price": [ { "orderdate": "1993-01-31", "sum_price": 190960.69d }, { "orderdate": "1998-07-17", "sum_price": 187156.38d }, { "orderdate": "1993-03-25", "sum_price": 167017.39d } ] }
+{ "nation_key": 22, "sum_price": [ { "orderdate": "1998-02-27", "sum_price": 263411.29d }, { "orderdate": "1993-04-11", "sum_price": 221636.83d }, { "orderdate": "1993-05-07", "sum_price": 220715.14d } ] }
+{ "nation_key": 0, "sum_price": [ { "orderdate": "1997-01-13", "sum_price": 241837.88d }, { "orderdate": "1997-01-21", "sum_price": 240284.95d }, { "orderdate": "1997-08-24", "sum_price": 231831.35d } ] }
+{ "nation_key": 8, "sum_price": [ { "orderdate": "1995-07-26", "sum_price": 244704.23d }, { "orderdate": "1994-12-03", "sum_price": 234763.73d }, { "orderdate": "1994-09-09", "sum_price": 228002.51d } ] }
+{ "nation_key": 9, "sum_price": [ { "orderdate": "1992-08-19", "sum_price": 240457.56d }, { "orderdate": "1995-03-02", "sum_price": 228136.49d }, { "orderdate": "1992-07-30", "sum_price": 226314.91d } ] }
+{ "nation_key": 10, "sum_price": [ { "orderdate": "1992-08-15", "sum_price": 232194.74d }, { "orderdate": "1997-01-03", "sum_price": 219920.62d }, { "orderdate": "1992-01-02", "sum_price": 210713.88d } ] }
+{ "nation_key": 3, "sum_price": [ { "orderdate": "1997-04-23", "sum_price": 351762.82999999996d }, { "orderdate": "1995-11-13", "sum_price": 242588.87d }, { "orderdate": "1993-07-15", "sum_price": 214494.39d } ] }
+{ "nation_key": 5, "sum_price": [ { "orderdate": "1997-04-04", "sum_price": 258779.02d }, { "orderdate": "1998-07-20", "sum_price": 209155.48d }, { "orderdate": "1994-04-27", "sum_price": 202917.72d } ] }
+{ "nation_key": 7, "sum_price": [ { "orderdate": "1995-03-19", "sum_price": 207925.83d }, { "orderdate": "1992-03-15", "sum_price": 206742.11d }, { "orderdate": "1992-05-10", "sum_price": 203904.8d } ] }
+{ "nation_key": 17, "sum_price": [ { "orderdate": "1997-07-05", "sum_price": 233874.09d }, { "orderdate": "1993-10-31", "sum_price": 224724.11d }, { "orderdate": "1996-04-18", "sum_price": 220727.97d } ] }
+{ "nation_key": 18, "sum_price": [ { "orderdate": "1995-10-03", "sum_price": 245976.74d }, { "orderdate": "1992-06-03", "sum_price": 233161.66d }, { "orderdate": "1996-09-20", "sum_price": 219707.84d } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue786/query-issue786.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue786/query-issue786.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue786/query-issue786.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue810-2/query-issue810-2.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue810-2/query-issue810-2.1.adm
new file mode 100644
index 0000000..d392ecf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue810-2/query-issue810-2.1.adm
@@ -0,0 +1,4 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "count_cheaps": 680, "total_charges": 3.7101416222424E7d }
+{ "l_returnflag": "N", "l_linestatus": "F", "count_cheaps": 12, "total_charges": 1036450.80228d }
+{ "l_returnflag": "N", "l_linestatus": "O", "count_cheaps": 1345, "total_charges": 7.4498798133073E7d }
+{ "l_returnflag": "R", "l_linestatus": "F", "count_cheaps": 679, "total_charges": 3.616906011219301E7d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue810-3/query-issue810-3.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue810-3/query-issue810-3.1.adm
new file mode 100644
index 0000000..d6dd75d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue810-3/query-issue810-3.1.adm
@@ -0,0 +1,4 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "count_cheaps": 680, "avg_expensive_discounts": 0.025714285714285662d, "sum_disc_prices": 3.5676192097E7d, "total_charges": 3.7101416222424E7d }
+{ "l_returnflag": "N", "l_linestatus": "F", "count_cheaps": 12, "avg_expensive_discounts": 0.024615384615384615d, "sum_disc_prices": 999060.898d, "total_charges": 1036450.80228d }
+{ "l_returnflag": "N", "l_linestatus": "O", "count_cheaps": 1345, "avg_expensive_discounts": 0.024699248120300644d, "sum_disc_prices": 7.165316630340001E7d, "total_charges": 7.4498798133073E7d }
+{ "l_returnflag": "R", "l_linestatus": "F", "count_cheaps": 679, "avg_expensive_discounts": 0.0244601542416452d, "sum_disc_prices": 3.473847287579999E7d, "total_charges": 3.616906011219301E7d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue810/query-issue810.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue810/query-issue810.1.adm
new file mode 100644
index 0000000..a74e76f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue810/query-issue810.1.adm
@@ -0,0 +1,4 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "count_cheaps": 680, "count_expensives": 798 }
+{ "l_returnflag": "N", "l_linestatus": "F", "count_cheaps": 12, "count_expensives": 26 }
+{ "l_returnflag": "N", "l_linestatus": "O", "count_cheaps": 1345, "count_expensives": 1596 }
+{ "l_returnflag": "R", "l_linestatus": "F", "count_cheaps": 679, "count_expensives": 778 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue827-2/query-issue827-2.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue827-2/query-issue827-2.1.adm
new file mode 100644
index 0000000..1b693a2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue827-2/query-issue827-2.1.adm
@@ -0,0 +1 @@
+{ "sum_qty_partial": 150194.0d, "sum_base_price": 1.5277439838000005E8d, "sum_disc_price": 1.4517182996390012E8d, "sum_charge": 1.51008955587289E8d, "ave_qty": 25.39634764964491d, "ave_price": 25441.198731057462d, "ave_disc": 0.05003164029975036d, "count_order": 6005 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue827/query-issue827.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue827/query-issue827.1.adm
new file mode 100644
index 0000000..0a3b71c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-sql/query-issue827/query-issue827.1.adm
@@ -0,0 +1 @@
+{ "count_cheaps": 6005, "count_expensives": 1.5277439838000005E8d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.adm
index da45d73..ed5098a 100644
--- a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.adm
@@ -1 +1 @@
-0.0d
+15.23021261159725d
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch/q14_promotion_effect/q14_promotion_effect.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch/q14_promotion_effect/q14_promotion_effect.1.adm
index da45d73..ed5098a 100644
--- a/asterix-app/src/test/resources/runtimets/results/tpch/q14_promotion_effect/q14_promotion_effect.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/tpch/q14_promotion_effect/q14_promotion_effect.1.adm
@@ -1 +1 @@
-0.0d
+15.23021261159725d
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_null_rec/agg_null_rec.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_null_rec/agg_null_rec.3.ast
index 2967c35..3c4f5f4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_null_rec/agg_null_rec.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_null_rec/agg_null_rec.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -28,7 +28,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -36,7 +36,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -48,7 +48,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -56,7 +56,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -68,7 +68,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -76,7 +76,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -88,7 +88,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -96,7 +96,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_null_rec_1/agg_null_rec_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_null_rec_1/agg_null_rec_1.3.ast
index 20e9b29..5a12496 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_null_rec_1/agg_null_rec_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_null_rec_1/agg_null_rec_1.3.ast
@@ -7,13 +7,13 @@
     FunctionCall test.sql-count@1[
       (
         SELECT ELEMENT [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -25,23 +25,23 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=val
         ]
         ]
         FROM [          (
             SELECT ELEMENT [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Test]
               ]
               AS
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
             ]
           )
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -53,23 +53,23 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=val
         ]
         ]
         FROM [          (
             SELECT ELEMENT [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Test]
               ]
               AS
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
             ]
           )
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -81,23 +81,23 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=valplus
         ]
         ]
         FROM [          (
             SELECT ELEMENT [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Test]
               ]
               AS
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
             ]
           )
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -109,23 +109,23 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=valplus
         ]
         ]
         FROM [          (
             SELECT ELEMENT [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Test]
               ]
               AS
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
             ]
           )
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_number_rec/agg_number_rec.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_number_rec/agg_number_rec.3.ast
index 2967c35..3c4f5f4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_number_rec/agg_number_rec.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/agg_number_rec/agg_number_rec.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -28,7 +28,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -36,7 +36,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -48,7 +48,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -56,7 +56,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -68,7 +68,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -76,7 +76,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -88,7 +88,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -96,7 +96,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.3.ast
index 534efd5..772844d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [DOUBLE] [1.0]
@@ -13,7 +13,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.ast
index c7b919e..ddec4ab 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=doubleField
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.ast
index 59b1670..c142f72 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,11 +12,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.ast
index f9887fc..21b366e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.3.ast
index a5dd207..b7ac2aa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.float@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.ast
index 4202d44..68c122f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=floatField
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.3.ast
index 2961824..9a37e98 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int16@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.ast
index bf92b19..1c48f72 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=int16Field
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.3.ast
index 2d3def0..a9e95b9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int32@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.ast
index 918740e..57e755c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=int32Field
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.3.ast
index 3f6cc7a..bba67d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int64@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.ast
index 74fa23c..a622e36 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=int64Field
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.3.ast
index 32031da..e80871c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int8@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.ast
index c3b88b0..d0e1a63 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=int8Field
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_mixed/avg_mixed.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_mixed/avg_mixed.3.ast
index c772c5a..2d5c692 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_mixed/avg_mixed.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_mixed/avg_mixed.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall null.float@1[
@@ -16,7 +16,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_01/count_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_01/count_01.3.ast
index f1f381b..13dd2e2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_01/count_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_01/count_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,7 +12,7 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_empty_01/count_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_empty_01/count_empty_01.3.ast
index 1909937..a83ec17 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_empty_01/count_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_empty_01/count_empty_01.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.sql-count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -11,11 +11,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_empty_02/count_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_empty_02/count_empty_02.3.ast
index d8394cb..36a38a9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_empty_02/count_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_empty_02/count_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_null/count_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_null/count_null.3.ast
index 9910dff..6c274cf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_null/count_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/count_null/count_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=doubleField
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/issue395/issue395.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/issue395/issue395.3.ast
index bb48475..cbd0a79 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/issue395/issue395.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/issue395/issue395.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=name
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Employee]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.3.ast
index 3f8f2e5..6ffb156 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.3.ast
@@ -9,7 +9,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=name
         ]
         ]
@@ -17,7 +17,7 @@
             LiteralExpr [STRING] [t1]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
       )
     ]
@@ -29,7 +29,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=name
         ]
         ]
@@ -37,7 +37,7 @@
             LiteralExpr [STRING] [t1]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/max_empty_01/max_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/max_empty_01/max_empty_01.3.ast
index c112a3f..9f66425 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/max_empty_01/max_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/max_empty_01/max_empty_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-max@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,11 +12,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/max_empty_02/max_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/max_empty_02/max_empty_02.3.ast
index e067564..85912ef 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/max_empty_02/max_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/max_empty_02/max_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_empty_01/min_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_empty_01/min_empty_01.3.ast
index 211e1c7..b62f1d5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_empty_01/min_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_empty_01/min_empty_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-min@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,11 +12,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_empty_02/min_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_empty_02/min_empty_02.3.ast
index 9c636ce..6aecde0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_empty_02/min_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_empty_02/min_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_mixed/min_mixed.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_mixed/min_mixed.3.ast
index 5001cd1..d92bce5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_mixed/min_mixed.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/min_mixed/min_mixed.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.sql-min@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall null.float@1[
@@ -16,7 +16,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/query-issue400/query-issue400.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/query-issue400/query-issue400.3.ast
index 99938b6..008601e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/query-issue400/query-issue400.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/query-issue400/query-issue400.3.ast
@@ -2,7 +2,7 @@
 FunctionCall null.sql-count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      OrderedListConstructor [
         OrderedListConstructor [
@@ -20,7 +20,7 @@
         ]
       ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_avg/scalar_avg.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_avg/scalar_avg.3.ast
index 2d24805..3f3652f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_avg/scalar_avg.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_avg/scalar_avg.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -91,16 +91,16 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.3.ast
index 557f08b..d1c0cbf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-avg@1[
     OrderedListConstructor [
@@ -97,16 +97,16 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_count/scalar_count.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_count/scalar_count.3.ast
index 0511e9f..5e10637 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_count/scalar_count.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_count/scalar_count.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -90,7 +90,7 @@
       ]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -100,17 +100,17 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.3.ast
index 90369f6..5213a15 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -96,7 +96,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.sql-count@1[
     OrderedListConstructor [
@@ -107,17 +107,17 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_max/scalar_max.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_max/scalar_max.3.ast
index 0d96f9c..62a81b9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_max/scalar_max.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_max/scalar_max.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -90,7 +90,7 @@
       ]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -99,7 +99,7 @@
       LiteralExpr [STRING] [world]
     ]
   ]
-LetVariable [ Name=dt ]
+Let Variable [ Name=$dt ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -115,18 +115,18 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
-    Variable [ Name=dt ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
+    Variable [ Name=$dt ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.3.ast
index c108525..5781f80 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -96,7 +96,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -106,7 +106,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=dt ]
+Let Variable [ Name=$dt ]
   :=
   FunctionCall test.sql-max@1[
     OrderedListConstructor [
@@ -123,18 +123,18 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
-    Variable [ Name=dt ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
+    Variable [ Name=$dt ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_min/scalar_min.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_min/scalar_min.3.ast
index d817b6b..aef2332 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_min/scalar_min.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_min/scalar_min.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -90,7 +90,7 @@
       ]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -99,7 +99,7 @@
       LiteralExpr [STRING] [world]
     ]
   ]
-LetVariable [ Name=dt ]
+Let Variable [ Name=$dt ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -115,18 +115,18 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
-    Variable [ Name=dt ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
+    Variable [ Name=$dt ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.3.ast
index 9eaae70..e406615 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -96,7 +96,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -106,7 +106,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=dt ]
+Let Variable [ Name=$dt ]
   :=
   FunctionCall test.sql-min@1[
     OrderedListConstructor [
@@ -123,18 +123,18 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
-    Variable [ Name=dt ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
+    Variable [ Name=$dt ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_sum/scalar_sum.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_sum/scalar_sum.3.ast
index 27bd715..b568d92 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_sum/scalar_sum.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_sum/scalar_sum.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -91,16 +91,16 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.3.ast
index 94d8dd9..ce265b8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sql-sum@1[
     OrderedListConstructor [
@@ -97,16 +97,16 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_double/sum_double.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_double/sum_double.3.ast
index 3b0400a..9132133 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_double/sum_double.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_double/sum_double.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [DOUBLE] [1.0]
@@ -12,7 +12,7 @@
         LiteralExpr [DOUBLE] [3.0]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_double_null/sum_double_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_double_null/sum_double_null.3.ast
index eb881ad..ce4271d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_double_null/sum_double_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_double_null/sum_double_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=doubleField
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.3.ast
index 4262dd6..06a668c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,11 +12,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.3.ast
index d0b8323..86aa8d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_float/sum_float.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_float/sum_float.3.ast
index 9b38f1f..c456ba6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_float/sum_float.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_float/sum_float.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.float@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_float_null/sum_float_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_float_null/sum_float_null.3.ast
index a97f1bd..baa9b91 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_float_null/sum_float_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_float_null/sum_float_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=floatField
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int16/sum_int16.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int16/sum_int16.3.ast
index 1acd1e9..a9176a8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int16/sum_int16.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int16/sum_int16.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int16@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int16_null/sum_int16_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int16_null/sum_int16_null.3.ast
index 13000a7..2d49797 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int16_null/sum_int16_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int16_null/sum_int16_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=int16Field
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int32/sum_int32.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int32/sum_int32.3.ast
index 06d76c3..70a818a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int32/sum_int32.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int32/sum_int32.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int32@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int32_null/sum_int32_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int32_null/sum_int32_null.3.ast
index 2d57c5f..0f6079a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int32_null/sum_int32_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int32_null/sum_int32_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=int32Field
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int64/sum_int64.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int64/sum_int64.3.ast
index 7c91476..54dc886 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int64/sum_int64.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int64/sum_int64.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int64@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int64_null/sum_int64_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int64_null/sum_int64_null.3.ast
index 6bb78c1..4f2524a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int64_null/sum_int64_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int64_null/sum_int64_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=int64Field
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8/sum_int8.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8/sum_int8.3.ast
index 14025b8..dcffbf2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8/sum_int8.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8/sum_int8.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sql-sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int8@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8_null/sum_int8_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8_null/sum_int8_null.3.ast
index 6bb0066..3bdfe85 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8_null/sum_int8_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_int8_null/sum_int8_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=int8Field
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.ast
index 3f8aff5..1d0d5be 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.sql-sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall null.float@1[
@@ -16,7 +16,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.3.ast
index 0bfc9d8..40ba26b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.3.ast
@@ -6,7 +6,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=sal
     ]
     ]
@@ -14,13 +14,13 @@
         LiteralExpr [STRING] [tdst]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Where
       FunctionCall test.not@1[
         FunctionCall test.is-null@1[
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=sal
           ]
         ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.3.ast
index becfad0..a59827a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=sal
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [tdst]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.ast
index 4976f97..d73dacf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -28,7 +28,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -36,7 +36,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -48,7 +48,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -56,7 +56,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -68,7 +68,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -76,7 +76,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -88,7 +88,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -96,7 +96,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.ast
index cae68d8..f7bad79 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.ast
@@ -7,13 +7,13 @@
     FunctionCall test.count@1[
       (
         SELECT ELEMENT [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -25,23 +25,23 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=val
         ]
         ]
         FROM [          (
             SELECT ELEMENT [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Test]
               ]
               AS
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
             ]
           )
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -53,23 +53,23 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=val
         ]
         ]
         FROM [          (
             SELECT ELEMENT [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Test]
               ]
               AS
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
             ]
           )
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -81,23 +81,23 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=valplus
         ]
         ]
         FROM [          (
             SELECT ELEMENT [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Test]
               ]
               AS
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
             ]
           )
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -109,23 +109,23 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=valplus
         ]
         ]
         FROM [          (
             SELECT ELEMENT [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Test]
               ]
               AS
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
             ]
           )
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.ast
index 4976f97..d73dacf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -28,7 +28,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -36,7 +36,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -48,7 +48,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -56,7 +56,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -68,7 +68,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -76,7 +76,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
@@ -88,7 +88,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=valplus
         ]
         ]
@@ -96,7 +96,7 @@
             LiteralExpr [STRING] [Test]
           ]
           AS
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.3.ast
index d979a6e..ea15957 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [DOUBLE] [1.0]
@@ -13,7 +13,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.3.ast
index b946881..70a1738 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=doubleField
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.ast
index 236a7de..441ca62 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,11 +12,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.ast
index 18cf26c..2fe644b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.3.ast
index 7d9e49d..927f646 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.float@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.3.ast
index 5cd105d..ce9cbf2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=floatField
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.3.ast
index 3421856..88332e3 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int16@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.ast
index 37e709a..4f5daa5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=int16Field
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.3.ast
index 514e8ff..fe7ef21 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,7 +12,7 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.ast
index 7b84875..286d2bd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=int32Field
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.3.ast
index 31c9432..047d806 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int64@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.ast
index a2e73ec..bad056d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=int64Field
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.3.ast
index ad6ccba..e6b1c11 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int8@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.ast
index 7a932c8..399f61b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=int8Field
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_mixed/avg_mixed.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_mixed/avg_mixed.3.ast
index 23fb1f6..5d36b1a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_mixed/avg_mixed.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_mixed/avg_mixed.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall null.float@1[
@@ -16,7 +16,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_01/count_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_01/count_01.3.ast
index ec31659..e58e38a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_01/count_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_01/count_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,7 +12,7 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_empty_01/count_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_empty_01/count_empty_01.3.ast
index db67870..1d06a82 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_empty_01/count_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_empty_01/count_empty_01.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -11,11 +11,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_empty_02/count_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_empty_02/count_empty_02.3.ast
index 3cd5b5d..9ed1050 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_empty_02/count_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_empty_02/count_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_null/count_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_null/count_null.3.ast
index 08cf114..b46d1b3 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_null/count_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/count_null/count_null.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=doubleField
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [Numeric]
           ]
           AS
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/issue395/issue395.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/issue395/issue395.3.ast
index 2801aed..983cc6d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/issue395/issue395.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/issue395/issue395.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=name
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Employee]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/issue531_string_min_max/issue531_string_min_max.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/issue531_string_min_max/issue531_string_min_max.3.ast
index 9dec63d..e37c5a4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/issue531_string_min_max/issue531_string_min_max.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/issue531_string_min_max/issue531_string_min_max.3.ast
@@ -9,7 +9,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=name
         ]
         ]
@@ -17,7 +17,7 @@
             LiteralExpr [STRING] [t1]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
       )
     ]
@@ -29,7 +29,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=name
         ]
         ]
@@ -37,7 +37,7 @@
             LiteralExpr [STRING] [t1]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/max_empty_01/max_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/max_empty_01/max_empty_01.3.ast
index b9f1f79..b5c9a3e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/max_empty_01/max_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/max_empty_01/max_empty_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.max@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,11 +12,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/max_empty_02/max_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/max_empty_02/max_empty_02.3.ast
index 1aa6529..4e6b888 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/max_empty_02/max_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/max_empty_02/max_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_empty_01/min_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_empty_01/min_empty_01.3.ast
index f6a660a..1ea9d4d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_empty_01/min_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_empty_01/min_empty_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.min@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,11 +12,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_empty_02/min_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_empty_02/min_empty_02.3.ast
index 5a1f7c9..cc240fa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_empty_02/min_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_empty_02/min_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_mixed/min_mixed.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_mixed/min_mixed.3.ast
index 8cce23d..27ab397 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_mixed/min_mixed.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/min_mixed/min_mixed.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.min@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall null.float@1[
@@ -16,7 +16,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/query-issue400/query-issue400.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/query-issue400/query-issue400.3.ast
index 3ab430c..33aa6f6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/query-issue400/query-issue400.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/query-issue400/query-issue400.3.ast
@@ -2,7 +2,7 @@
 FunctionCall null.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      OrderedListConstructor [
         OrderedListConstructor [
@@ -20,7 +20,7 @@
         ]
       ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_avg/scalar_avg.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_avg/scalar_avg.3.ast
index 21159c1..bde3209 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_avg/scalar_avg.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_avg/scalar_avg.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -91,16 +91,16 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_avg_null/scalar_avg_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_avg_null/scalar_avg_null.3.ast
index ac89e95..1d9e4df 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_avg_null/scalar_avg_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_avg_null/scalar_avg_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.avg@1[
     OrderedListConstructor [
@@ -97,16 +97,16 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_count/scalar_count.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_count/scalar_count.3.ast
index 08505d6..7abcc7a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_count/scalar_count.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_count/scalar_count.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -90,7 +90,7 @@
       ]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -100,17 +100,17 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_count_null/scalar_count_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_count_null/scalar_count_null.3.ast
index 2496e09..e1e0c6e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_count_null/scalar_count_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_count_null/scalar_count_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -96,7 +96,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.count@1[
     OrderedListConstructor [
@@ -107,17 +107,17 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_max/scalar_max.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_max/scalar_max.3.ast
index 112a12d..b7bd61e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_max/scalar_max.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_max/scalar_max.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -90,7 +90,7 @@
       ]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -99,7 +99,7 @@
       LiteralExpr [STRING] [world]
     ]
   ]
-LetVariable [ Name=dt ]
+Let Variable [ Name=$dt ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -115,18 +115,18 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
-    Variable [ Name=dt ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
+    Variable [ Name=$dt ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_max_null/scalar_max_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_max_null/scalar_max_null.3.ast
index c148cee..da189de 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_max_null/scalar_max_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_max_null/scalar_max_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -96,7 +96,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -106,7 +106,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=dt ]
+Let Variable [ Name=$dt ]
   :=
   FunctionCall test.max@1[
     OrderedListConstructor [
@@ -123,18 +123,18 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
-    Variable [ Name=dt ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
+    Variable [ Name=$dt ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_min/scalar_min.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_min/scalar_min.3.ast
index 666e43a..8d150cf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_min/scalar_min.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_min/scalar_min.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -90,7 +90,7 @@
       ]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -99,7 +99,7 @@
       LiteralExpr [STRING] [world]
     ]
   ]
-LetVariable [ Name=dt ]
+Let Variable [ Name=$dt ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -115,18 +115,18 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
-    Variable [ Name=dt ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
+    Variable [ Name=$dt ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_min_null/scalar_min_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_min_null/scalar_min_null.3.ast
index a2cf93f..b35d3d3 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_min_null/scalar_min_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_min_null/scalar_min_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -96,7 +96,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=s ]
+Let Variable [ Name=$s ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -106,7 +106,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=dt ]
+Let Variable [ Name=$dt ]
   :=
   FunctionCall test.min@1[
     OrderedListConstructor [
@@ -123,18 +123,18 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
-    Variable [ Name=s ]
-    Variable [ Name=dt ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
+    Variable [ Name=$s ]
+    Variable [ Name=$dt ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_sum/scalar_sum.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_sum/scalar_sum.3.ast
index 2729c21..32235b5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_sum/scalar_sum.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_sum/scalar_sum.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -15,7 +15,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -30,7 +30,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -45,7 +45,7 @@
       ]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -60,7 +60,7 @@
       ]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -75,7 +75,7 @@
       ]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -91,16 +91,16 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_sum_null/scalar_sum_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_sum_null/scalar_sum_null.3.ast
index df1a452..a75fe6f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_sum_null/scalar_sum_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/scalar_sum_null/scalar_sum_null.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=i8 ]
+Let Variable [ Name=$i8 ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -16,7 +16,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i16 ]
+Let Variable [ Name=$i16 ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -32,7 +32,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i32 ]
+Let Variable [ Name=$i32 ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -48,7 +48,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=i64 ]
+Let Variable [ Name=$i64 ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -64,7 +64,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -80,7 +80,7 @@
       LiteralExpr [NULL]
     ]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   FunctionCall test.sum@1[
     OrderedListConstructor [
@@ -97,16 +97,16 @@
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=i8 ]
-    Variable [ Name=i16 ]
-    Variable [ Name=i32 ]
-    Variable [ Name=i64 ]
-    Variable [ Name=f ]
-    Variable [ Name=d ]
+    Variable [ Name=$i8 ]
+    Variable [ Name=$i16 ]
+    Variable [ Name=$i32 ]
+    Variable [ Name=$i64 ]
+    Variable [ Name=$f ]
+    Variable [ Name=$d ]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_double/sum_double.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_double/sum_double.3.ast
index 4b3c3cd..4299d22 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_double/sum_double.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_double/sum_double.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [DOUBLE] [1.0]
@@ -12,7 +12,7 @@
         LiteralExpr [DOUBLE] [3.0]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_double_null/sum_double_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_double_null/sum_double_null.3.ast
index 0972479..486ab5c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_double_null/sum_double_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_double_null/sum_double_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=doubleField
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_empty_01/sum_empty_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_empty_01/sum_empty_01.3.ast
index e2f8ce7..601a419 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_empty_01/sum_empty_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_empty_01/sum_empty_01.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,11 +12,11 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         >
         LiteralExpr [LONG] [10]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_empty_02/sum_empty_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_empty_02/sum_empty_02.3.ast
index bb6cfc0..1a8ee7d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_empty_02/sum_empty_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_empty_02/sum_empty_02.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=val
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Test]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_float/sum_float.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_float/sum_float.3.ast
index bc473b4..227e495 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_float/sum_float.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_float/sum_float.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.float@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_float_null/sum_float_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_float_null/sum_float_null.3.ast
index a2649d8..cdb85ab 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_float_null/sum_float_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_float_null/sum_float_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=floatField
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int16/sum_int16.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int16/sum_int16.3.ast
index 38c2666..2492cfd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int16/sum_int16.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int16/sum_int16.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int16@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int16_null/sum_int16_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int16_null/sum_int16_null.3.ast
index 523dcfe..917f0ff 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int16_null/sum_int16_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int16_null/sum_int16_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=int16Field
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int32/sum_int32.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int32/sum_int32.3.ast
index d2a5e9c..99ab8bf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int32/sum_int32.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int32/sum_int32.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int32@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int32_null/sum_int32_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int32_null/sum_int32_null.3.ast
index 59d3409..3dfc636 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int32_null/sum_int32_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int32_null/sum_int32_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=int32Field
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int64/sum_int64.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int64/sum_int64.3.ast
index 081d221..8e9351c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int64/sum_int64.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int64/sum_int64.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int64@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int64_null/sum_int64_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int64_null/sum_int64_null.3.ast
index 91ca34d..6b11722 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int64_null/sum_int64_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int64_null/sum_int64_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=int64Field
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8/sum_int8.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8/sum_int8.3.ast
index 253f544..79b3bf9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8/sum_int8.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8/sum_int8.3.ast
@@ -4,7 +4,7 @@
 FunctionCall test.sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall test.int8@1[
@@ -18,7 +18,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8_null/sum_int8_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8_null/sum_int8_null.3.ast
index 225e565..8ec8d54 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8_null/sum_int8_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_int8_null/sum_int8_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=int8Field
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [Numeric]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_mixed/sum_mixed.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_mixed/sum_mixed.3.ast
index 6bce314..74a268d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_mixed/sum_mixed.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_mixed/sum_mixed.3.ast
@@ -3,7 +3,7 @@
 FunctionCall null.sum@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      OrderedListConstructor [
         FunctionCall null.float@1[
@@ -16,7 +16,7 @@
         ]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.3.ast
index b478771..ccd8438 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.3.ast
@@ -6,7 +6,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=sal
     ]
     ]
@@ -14,13 +14,13 @@
         LiteralExpr [STRING] [tdst]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Where
       FunctionCall test.not@1[
         FunctionCall test.is-null@1[
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=sal
           ]
         ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.3.ast
index eadfd99..38b048a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.3.ast
@@ -5,7 +5,7 @@
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=sal
     ]
     ]
@@ -13,7 +13,7 @@
         LiteralExpr [STRING] [tdst]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_groupby-2/big_object_groupby.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_groupby-2/big_object_groupby.3.ast
index cb72b70..e02bd2e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_groupby-2/big_object_groupby.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_groupby-2/big_object_groupby.3.ast
@@ -5,19 +5,19 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=id ]
+    Variable [ Name=$id ]
   )
   (
     LiteralExpr [STRING] [length]
     :
     FunctionCall test.string-length@1[
-      Variable [ Name=comment ]
+      Variable [ Name=$comment ]
     ]
   )
   (
     LiteralExpr [STRING] [comment]
     :
-    Variable [ Name=comment ]
+    Variable [ Name=$comment ]
   )
 ]
 ]
@@ -25,31 +25,35 @@
     LiteralExpr [STRING] [Line]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Groupby
-  Variable [ Name=comment ]
+  Variable [ Name=$comment ]
   :=
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=l_comment
   ]
-  Variable [ Name=id ]
+  Variable [ Name=$id ]
   :=
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=l_orderkey
   ]
-  With
-  Variable [ Name=i ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$i ]
+   AS i
+  )
 
 Orderby
-  Variable [ Name=id ]
+  Variable [ Name=$id ]
   ASC
   FunctionCall test.string-length@1[
-    Variable [ Name=comment ]
+    Variable [ Name=$comment ]
   ]
   ASC
-  Variable [ Name=comment ]
+  Variable [ Name=$comment ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_groupby/big_object_groupby.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_groupby/big_object_groupby.3.ast
index 7d82c98..c2d00c9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_groupby/big_object_groupby.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_groupby/big_object_groupby.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [partkey]
     :
-    Variable [ Name=partkey ]
+    Variable [ Name=$partkey ]
   )
   (
     LiteralExpr [STRING] [lines]
     :
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
   )
 ]
 ]
@@ -18,19 +18,23 @@
     LiteralExpr [STRING] [Line]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Groupby
-  Variable [ Name=partkey ]
+  Variable [ Name=$partkey ]
   :=
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=l_partkey
   ]
-  With
-  Variable [ Name=i ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$i ]
+   AS i
+  )
 
 Orderby
-  Variable [ Name=partkey ]
+  Variable [ Name=$partkey ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_join/big_object_join.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_join/big_object_join.3.ast
index f3254d4..301c358 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_join/big_object_join.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_join/big_object_join.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [c_custkey]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=c_custkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -23,7 +23,7 @@
     :
     FunctionCall test.string-length@1[
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_comment
       ]
     ]
@@ -33,7 +33,7 @@
     :
     FunctionCall test.string-length@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_comment
       ]
     ]
@@ -42,7 +42,7 @@
     LiteralExpr [STRING] [c_comment]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=c_comment
     ]
   )
@@ -52,34 +52,34 @@
     LiteralExpr [STRING] [Customer]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Order]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=c_custkey
     ]
     =
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=c_custkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_sort/big_object_sort.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_sort/big_object_sort.3.ast
index 4d0117e..22f3ccf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_sort/big_object_sort.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/big-object/big_object_sort/big_object_sort.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -23,7 +23,7 @@
     :
     FunctionCall test.string-length@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_comment
       ]
     ]
@@ -32,7 +32,7 @@
     LiteralExpr [STRING] [comment]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_comment
     ]
   )
@@ -42,16 +42,16 @@
     LiteralExpr [STRING] [Order]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_custkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/equal_join/equal_join.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/equal_join/equal_join.3.ast
index 717a2f9..dab21a7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/equal_join/equal_join.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/equal_join/equal_join.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [cid]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [oid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -24,29 +24,29 @@
     LiteralExpr [STRING] [User]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [UserCopy]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=md5
     ]
     =
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=md5
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/index_join/index_join.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/index_join/index_join.3.ast
index 717a2f9..dab21a7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/index_join/index_join.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/index_join/index_join.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [cid]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [oid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -24,29 +24,29 @@
     LiteralExpr [STRING] [User]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [UserCopy]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=md5
     ]
     =
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=md5
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/insert/insert.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/insert/insert.3.ast
index 20ea1c6..a1aa5bd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/insert/insert.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/insert/insert.3.ast
@@ -1,22 +1,22 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [UserOpen]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=md5
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/print/print.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/print/print.3.ast
index 1b58b54..7ef8419 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/print/print.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/binary/print/print.3.ast
@@ -9,13 +9,13 @@
       OperatorExpr [
         FunctionCall test.print-binary@2[
           FunctionCall test.parse-binary@2[
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             LiteralExpr [STRING] [hex]
           ]
           LiteralExpr [STRING] [hex]
         ]
         =
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
       ]
       FROM [        OrderedListConstructor [
@@ -25,7 +25,7 @@
           LiteralExpr [STRING] []
         ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   )
@@ -37,13 +37,13 @@
       OperatorExpr [
         FunctionCall test.print-binary@2[
           FunctionCall test.parse-binary@2[
-            Variable [ Name=j ]
+            Variable [ Name=$j ]
             LiteralExpr [STRING] [base64]
           ]
           LiteralExpr [STRING] [base64]
         ]
         =
-        Variable [ Name=j ]
+        Variable [ Name=$j ]
       ]
       ]
       FROM [        OrderedListConstructor [
@@ -53,7 +53,7 @@
           LiteralExpr [STRING] [QXN0ZXJpeAE8]
         ]
         AS
-        Variable [ Name=j ]
+        Variable [ Name=$j ]
       ]
     )
   )
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/datetime_order/datetime_order.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/datetime_order/datetime_order.3.ast
index e9ab49f..7fe9bf7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/datetime_order/datetime_order.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/datetime_order/datetime_order.3.ast
@@ -1,80 +1,80 @@
 DataverseUse test
 Query:
-LetVariable [ Name=dt1 ]
+Let Variable [ Name=$dt1 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [2011-12-31T14:00:00-10:00]
   ]
-LetVariable [ Name=dt2 ]
+Let Variable [ Name=$dt2 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [2012-01-01T00:00:00Z]
   ]
-LetVariable [ Name=dt3 ]
+Let Variable [ Name=$dt3 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [2005-01-01T00:00:00+04:00]
   ]
-LetVariable [ Name=dt4 ]
+Let Variable [ Name=$dt4 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [2011-12-31T13:00:00-11:00]
   ]
-LetVariable [ Name=dt5 ]
+Let Variable [ Name=$dt5 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [2012-04-06T00:00:00Z]
   ]
-LetVariable [ Name=dt6 ]
+Let Variable [ Name=$dt6 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [-1937-07-07T23:00:00+08:00]
   ]
-LetVariable [ Name=dt7 ]
+Let Variable [ Name=$dt7 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [-1600-03-01T00:00:00.384+06:00]
   ]
-LetVariable [ Name=dt8 ]
+Let Variable [ Name=$dt8 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [-1600-02-29T23:59:59.999Z]
   ]
-LetVariable [ Name=dt9 ]
+Let Variable [ Name=$dt9 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [2000-02-29T23:59:59.999Z]
   ]
-LetVariable [ Name=dt10 ]
+Let Variable [ Name=$dt10 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [2000-03-01T01:59:59.999+07:00]
   ]
-LetVariable [ Name=dt11 ]
+Let Variable [ Name=$dt11 ]
   :=
   FunctionCall test.datetime@1[
     LiteralExpr [STRING] [-1600-03-01T00:00:00.384-06:00]
   ]
 SELECT ELEMENT [
-Variable [ Name=dt ]
+Variable [ Name=$dt ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=dt1 ]
-    Variable [ Name=dt2 ]
-    Variable [ Name=dt3 ]
-    Variable [ Name=dt4 ]
-    Variable [ Name=dt5 ]
-    Variable [ Name=dt6 ]
-    Variable [ Name=dt7 ]
-    Variable [ Name=dt8 ]
-    Variable [ Name=dt9 ]
-    Variable [ Name=dt10 ]
-    Variable [ Name=dt11 ]
+    Variable [ Name=$dt1 ]
+    Variable [ Name=$dt2 ]
+    Variable [ Name=$dt3 ]
+    Variable [ Name=$dt4 ]
+    Variable [ Name=$dt5 ]
+    Variable [ Name=$dt6 ]
+    Variable [ Name=$dt7 ]
+    Variable [ Name=$dt8 ]
+    Variable [ Name=$dt9 ]
+    Variable [ Name=$dt10 ]
+    Variable [ Name=$dt11 ]
   ]
   AS
-  Variable [ Name=dt ]
+  Variable [ Name=$dt ]
 ]
 Orderby
-  Variable [ Name=dt ]
+  Variable [ Name=$dt ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/datetime_range/datetime_range.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/datetime_range/datetime_range.3.ast
index 246b7dd..ce1f738 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/datetime_range/datetime_range.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/datetime_range/datetime_range.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=id
     ]
   )
@@ -16,13 +16,13 @@
     LiteralExpr [STRING] [TwitterData]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=time
       ]
       >
@@ -33,7 +33,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=time
       ]
       <
@@ -44,7 +44,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/double_gte_01/double_gte_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/double_gte_01/double_gte_01.3.ast
index 37e5558..2663a8c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/double_gte_01/double_gte_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/double_gte_01/double_gte_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [DOUBLE] [0.8]
@@ -10,11 +10,11 @@
     LiteralExpr [DOUBLE] [0.901]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     >=
     LiteralExpr [DOUBLE] [0.9]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/eq_01/eq_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/eq_01/eq_01.3.ast
index 6220330..241fdf7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/eq_01/eq_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/eq_01/eq_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -9,11 +9,11 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     =
     LiteralExpr [LONG] [2]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/gt_01/gt_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/gt_01/gt_01.3.ast
index 1dfc291..2d7cd6f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/gt_01/gt_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/gt_01/gt_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -9,11 +9,11 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     >
     LiteralExpr [LONG] [1]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/gte_01/gte_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/gte_01/gte_01.3.ast
index 141f1b2..9396639 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/gte_01/gte_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/gte_01/gte_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -9,11 +9,11 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     >=
     LiteralExpr [LONG] [2]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/lt_01/lt_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/lt_01/lt_01.3.ast
index 9b13c70..76a06d6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/lt_01/lt_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/lt_01/lt_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -9,11 +9,11 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     <
     LiteralExpr [LONG] [3]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/lte_01/lte_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/lte_01/lte_01.3.ast
index 37ea949..e01bc50 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/lte_01/lte_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/lte_01/lte_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -9,11 +9,11 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     <=
     LiteralExpr [LONG] [2]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/neq_01/neq_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/neq_01/neq_01.3.ast
index ebfd090..a02d844 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/neq_01/neq_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/neq_01/neq_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -9,11 +9,11 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     !=
     LiteralExpr [LONG] [2]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/year_month_duration_order/year_month_duration_order.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/year_month_duration_order/year_month_duration_order.3.ast
index b04a755..4829893 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/year_month_duration_order/year_month_duration_order.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/comparison/year_month_duration_order/year_month_duration_order.3.ast
@@ -1,38 +1,38 @@
 DataverseUse test
 Query:
-LetVariable [ Name=dr1 ]
+Let Variable [ Name=$dr1 ]
   :=
   FunctionCall test.year-month-duration@1[
     LiteralExpr [STRING] [P439Y]
   ]
-LetVariable [ Name=dr2 ]
+Let Variable [ Name=$dr2 ]
   :=
   FunctionCall test.year-month-duration@1[
     LiteralExpr [STRING] [-P328M]
   ]
-LetVariable [ Name=dr3 ]
+Let Variable [ Name=$dr3 ]
   :=
   FunctionCall test.year-month-duration@1[
     LiteralExpr [STRING] [-P48Y12M]
   ]
-LetVariable [ Name=dr4 ]
+Let Variable [ Name=$dr4 ]
   :=
   FunctionCall test.year-month-duration@1[
     LiteralExpr [STRING] [P12M]
   ]
 SELECT ELEMENT [
-Variable [ Name=dr ]
+Variable [ Name=$dr ]
 ]
 FROM [  OrderedListConstructor [
-    Variable [ Name=dr1 ]
-    Variable [ Name=dr2 ]
-    Variable [ Name=dr3 ]
-    Variable [ Name=dr4 ]
+    Variable [ Name=$dr1 ]
+    Variable [ Name=$dr2 ]
+    Variable [ Name=$dr3 ]
+    Variable [ Name=$dr4 ]
   ]
   AS
-  Variable [ Name=dr ]
+  Variable [ Name=$dr ]
 ]
 Orderby
-  Variable [ Name=dr ]
+  Variable [ Name=$dr ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/interval/interval.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/interval/interval.3.ast
index 0382c4f..c993fe1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/interval/interval.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/interval/interval.3.ast
@@ -277,4 +277,4 @@
       LiteralExpr [NULL]
     ]
   )
-]
\ No newline at end of file
+]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv01/cross-dv01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv01/cross-dv01.3.ast
index ee08b06..7ef8a6f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv01/cross-dv01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv01/cross-dv01.3.ast
@@ -4,22 +4,22 @@
   (
     LiteralExpr [STRING] [ug-student]
     :
-    Variable [ Name=s ]
+    Variable [ Name=$s ]
   )
   (
     LiteralExpr [STRING] [prof]
     :
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
   )
   (
     LiteralExpr [STRING] [grd-student]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [postdoc]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -27,23 +27,23 @@
     LiteralExpr [STRING] [student.ugdstd]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [teacher.prof]
   ]
   AS
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [student.gdstd]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [teacher.pstdoc]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv02/cross-dv02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv02/cross-dv02.3.ast
index 3b61362..33161dd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv02/cross-dv02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv02/cross-dv02.3.ast
@@ -1,18 +1,18 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Metadata.Dataset]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=DataverseName
       ]
       =
@@ -21,7 +21,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=DataverseName
       ]
       =
@@ -30,7 +30,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=DatasetName
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv03/cross-dv03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv03/cross-dv03.3.ast
index 6d01c46..5c0d413 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv03/cross-dv03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv03/cross-dv03.3.ast
@@ -3,19 +3,19 @@
 FunctionCall null.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Metadata.Dataset]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=DataverseName
           ]
           =
@@ -24,7 +24,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=DataverseName
           ]
           =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv04/cross-dv04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv04/cross-dv04.3.ast
index 3b61362..33161dd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv04/cross-dv04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv04/cross-dv04.3.ast
@@ -1,18 +1,18 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Metadata.Dataset]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=DataverseName
       ]
       =
@@ -21,7 +21,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=DataverseName
       ]
       =
@@ -30,7 +30,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=DatasetName
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv07/cross-dv07.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv07/cross-dv07.3.ast
index c20010f..cd41f99 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv07/cross-dv07.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv07/cross-dv07.3.ast
@@ -1,18 +1,18 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test.employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=fname
       ]
       =
@@ -21,7 +21,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv15/cross-dv15.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv15/cross-dv15.3.ast
index 6732c8a..9395e60 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv15/cross-dv15.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv15/cross-dv15.3.ast
@@ -5,7 +5,7 @@
     LiteralExpr [STRING] [DataverseName]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=DataverseName
     ]
   )
@@ -13,7 +13,7 @@
     LiteralExpr [STRING] [Name]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=Name
     ]
   )
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [Arity]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=Arity
     ]
   )
@@ -29,7 +29,7 @@
     LiteralExpr [STRING] [ReturnType]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=ReturnType
     ]
   )
@@ -37,7 +37,7 @@
     LiteralExpr [STRING] [Language]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=Language
     ]
   )
@@ -47,12 +47,12 @@
     LiteralExpr [STRING] [Metadata.Function]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=DataverseName
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv19/cross-dv19.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv19/cross-dv19.3.ast
index 1ed46b8..f12fad9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv19/cross-dv19.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv19/cross-dv19.3.ast
@@ -1,18 +1,18 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Metadata.Dataset]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=DataverseName
       ]
       =
@@ -21,7 +21,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=DataverseName
       ]
       =
@@ -30,7 +30,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=DataverseName
       ]
       =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv20/cross-dv20.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv20/cross-dv20.3.ast
index ee08b06..7ef8a6f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv20/cross-dv20.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/cross-dv20/cross-dv20.3.ast
@@ -4,22 +4,22 @@
   (
     LiteralExpr [STRING] [ug-student]
     :
-    Variable [ Name=s ]
+    Variable [ Name=$s ]
   )
   (
     LiteralExpr [STRING] [prof]
     :
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
   )
   (
     LiteralExpr [STRING] [grd-student]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [postdoc]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -27,23 +27,23 @@
     LiteralExpr [STRING] [student.ugdstd]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [teacher.prof]
   ]
   AS
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [student.gdstd]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [teacher.pstdoc]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/insert_across_dataverses/insert_across_dataverses.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/insert_across_dataverses/insert_across_dataverses.3.ast
index 3d27ea4..dc5937b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/insert_across_dataverses/insert_across_dataverses.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/insert_across_dataverses/insert_across_dataverses.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test2
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test2.Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/join_across_dataverses/join_across_dataverses.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/join_across_dataverses/join_across_dataverses.3.ast
index 4e21492..15df5c4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/join_across_dataverses/join_across_dataverses.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/cross-dataverse/join_across_dataverses/join_across_dataverses.3.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [cust_name]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -15,7 +15,7 @@
     LiteralExpr [STRING] [cust_age]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
   )
@@ -23,7 +23,7 @@
     LiteralExpr [STRING] [order_total]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=total
     ]
   )
@@ -32,11 +32,11 @@
     :
     OrderedListConstructor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=oid
       ]
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=cid
       ]
     ]
@@ -47,34 +47,34 @@
     LiteralExpr [STRING] [test1.Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test2.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
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=total
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_01/customer_q_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_01/customer_q_01.3.ast
index bc6dd44..7fd2caf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_01/customer_q_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_01/customer_q_01.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_02/customer_q_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_02/customer_q_02.3.ast
index e2ed544..5e940f2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_02/customer_q_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_02/customer_q_02.3.ast
@@ -6,20 +6,20 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
   )
   (
     LiteralExpr [STRING] [nestedRecord]
     :
-    Variable [ Name=nestedRec ]
+    Variable [ Name=$nestedRec ]
   )
   (
     LiteralExpr [STRING] [order_id]
     :
     FieldAccessor [
-      Variable [ Name=nestedRec ]
+      Variable [ Name=$nestedRec ]
       Field=oid
     ]
   )
@@ -29,11 +29,11 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=nestedRec ]
+Let Variable [ Name=$nestedRec ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=lastorder
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_03/customer_q_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_03/customer_q_03.3.ast
index 43fa189..54f2594 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_03/customer_q_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_03/customer_q_03.3.ast
@@ -6,29 +6,29 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
   )
   (
     LiteralExpr [STRING] [list1]
     :
-    Variable [ Name=c1 ]
+    Variable [ Name=$c1 ]
   )
   (
     LiteralExpr [STRING] [list2]
     :
-    Variable [ Name=c2 ]
+    Variable [ Name=$c2 ]
   )
   (
     LiteralExpr [STRING] [list3]
     :
-    Variable [ Name=c3 ]
+    Variable [ Name=$c3 ]
   )
   (
     LiteralExpr [STRING] [list4]
     :
-    Variable [ Name=c4 ]
+    Variable [ Name=$c4 ]
   )
 ]
 ]
@@ -36,60 +36,60 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=nestedRec ]
+Let Variable [ Name=$nestedRec ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=lastorder
   ]
-LetVariable [ Name=c1 ]
+Let Variable [ Name=$c1 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     FieldAccessor [
-      Variable [ Name=nestedRec ]
+      Variable [ Name=$nestedRec ]
       Field=oid
     ]
   ]
-LetVariable [ Name=c2 ]
+Let Variable [ Name=$c2 ]
   :=
   UnorderedListConstructor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     FieldAccessor [
-      Variable [ Name=nestedRec ]
+      Variable [ Name=$nestedRec ]
       Field=oid
     ]
   ]
-LetVariable [ Name=c3 ]
+Let Variable [ Name=$c3 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=lastorder
     ]
-    Variable [ Name=nestedRec ]
+    Variable [ Name=$nestedRec ]
   ]
-LetVariable [ Name=c4 ]
+Let Variable [ Name=$c4 ]
   :=
   UnorderedListConstructor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=lastorder
     ]
-    Variable [ Name=nestedRec ]
+    Variable [ Name=$nestedRec ]
   ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     >=
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_04/customer_q_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_04/customer_q_04.3.ast
index 55224c1..40c17e4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_04/customer_q_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_04/customer_q_04.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [custname]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -22,14 +22,14 @@
     LiteralExpr [STRING] [age]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
   )
   (
     LiteralExpr [STRING] [MathcashBack]
     :
-    Variable [ Name=rec ]
+    Variable [ Name=$rec ]
   )
 ]
 ]
@@ -37,16 +37,16 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=rec ]
+Let Variable [ Name=$rec ]
   :=
   RecordConstructor [
     (
       LiteralExpr [STRING] [cashBack]
       :
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=cashBack
       ]
     )
@@ -55,7 +55,7 @@
       :
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=cashBack
         ]
         +
@@ -67,7 +67,7 @@
       :
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=cashBack
         ]
         -
@@ -79,7 +79,7 @@
       :
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=cashBack
         ]
         *
@@ -91,7 +91,7 @@
       :
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=cashBack
         ]
         /
@@ -102,7 +102,7 @@
       LiteralExpr [STRING] [-cashBack]
       :
       NEGATIVE FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=cashBack
 ]
     )
@@ -110,7 +110,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     >=
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_05/customer_q_05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_05/customer_q_05.3.ast
index 736d958..7f6f5ef 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_05/customer_q_05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_05/customer_q_05.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [custname]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -14,14 +14,14 @@
     LiteralExpr [STRING] [age]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
   )
   (
     LiteralExpr [STRING] [MathAge]
     :
-    Variable [ Name=rec ]
+    Variable [ Name=$rec ]
   )
 ]
 ]
@@ -29,16 +29,16 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=rec ]
+Let Variable [ Name=$rec ]
   :=
   RecordConstructor [
     (
       LiteralExpr [STRING] [age]
       :
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=age
       ]
     )
@@ -47,7 +47,7 @@
       :
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=age
         ]
         +
@@ -59,7 +59,7 @@
       :
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=age
         ]
         -
@@ -71,7 +71,7 @@
       :
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=age
         ]
         *
@@ -83,7 +83,7 @@
       :
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=age
         ]
         /
@@ -94,7 +94,7 @@
       LiteralExpr [STRING] [-age]
       :
       NEGATIVE FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=age
 ]
     )
@@ -102,7 +102,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     >=
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_06/customer_q_06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_06/customer_q_06.3.ast
index 85d9c0c..509909b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_06/customer_q_06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_06/customer_q_06.3.ast
@@ -6,14 +6,14 @@
     LiteralExpr [STRING] [customerid]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
   (
     LiteralExpr [STRING] [orderedlist]
     :
-    Variable [ Name=n ]
+    Variable [ Name=$n ]
   )
 ]
 ]
@@ -21,39 +21,39 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=rec ]
+Let Variable [ Name=$rec ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=lastorder
   ]
-LetVariable [ Name=m ]
+Let Variable [ Name=$m ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     FieldAccessor [
-      Variable [ Name=rec ]
+      Variable [ Name=$rec ]
       Field=oid
     ]
   ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   OrderedListConstructor [
     IndexAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Index: ANY
     ]
     IndexAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Index:       LiteralExpr [LONG] [1]
     ]
     IndexAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Index:       LiteralExpr [LONG] [4]
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_07/customer_q_07.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_07/customer_q_07.3.ast
index 79cca47..352bac2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_07/customer_q_07.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_07/customer_q_07.3.ast
@@ -6,14 +6,14 @@
     LiteralExpr [STRING] [customerid]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
   (
     LiteralExpr [STRING] [unorderedlist]
     :
-    Variable [ Name=n ]
+    Variable [ Name=$n ]
   )
 ]
 ]
@@ -21,39 +21,39 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=rec ]
+Let Variable [ Name=$rec ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=lastorder
   ]
-LetVariable [ Name=m ]
+Let Variable [ Name=$m ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     FieldAccessor [
-      Variable [ Name=rec ]
+      Variable [ Name=$rec ]
       Field=oid
     ]
   ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   UnorderedListConstructor [
     IndexAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Index: ANY
     ]
     IndexAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Index:       LiteralExpr [LONG] [1]
     ]
     IndexAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Index:       LiteralExpr [LONG] [4]
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_08/customer_q_08.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_08/customer_q_08.3.ast
index 24260b9..4919b5e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_08/customer_q_08.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/customer_q_08/customer_q_08.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [custname]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [custage]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
     <
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/denorm-cust-order_02/denorm-cust-order_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/denorm-cust-order_02/denorm-cust-order_02.3.ast
index 329c11c..e9011e1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/denorm-cust-order_02/denorm-cust-order_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/denorm-cust-order_02/denorm-cust-order_02.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=co ]
+Variable [ Name=$co ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CustomerOrders2]
   ]
   AS
-  Variable [ Name=co ]
+  Variable [ Name=$co ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=co ]
+    Variable [ Name=$co ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_01/join_q_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_01/join_q_01.3.ast
index 6891291..ec8788f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_01/join_q_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_01/join_q_01.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [cust_name]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [cust_age]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [order_total]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=total
     ]
   )
@@ -31,11 +31,11 @@
     :
     OrderedListConstructor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=oid
       ]
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=cid
       ]
     ]
@@ -46,34 +46,34 @@
     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
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=total
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_02/join_q_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_02/join_q_02.3.ast
index 04e5cfe..9375a39 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_02/join_q_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_02/join_q_02.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [cust_name]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -14,19 +14,19 @@
     LiteralExpr [STRING] [order_total]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=total
     ]
   )
   (
     LiteralExpr [STRING] [orderedlist]
     :
-    Variable [ Name=ol ]
+    Variable [ Name=$ol ]
   )
   (
     LiteralExpr [STRING] [unorderedlist]
     :
-    Variable [ Name=ul ]
+    Variable [ Name=$ul ]
   )
 ]
 ]
@@ -34,72 +34,72 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=rec ]
+Let Variable [ Name=$rec ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=lastorder
   ]
-LetVariable [ Name=ol ]
+Let Variable [ Name=$ol ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=oid
     ]
     FieldAccessor [
-      Variable [ Name=rec ]
+      Variable [ Name=$rec ]
       Field=oid
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=cid
     ]
   ]
-LetVariable [ Name=ul ]
+Let Variable [ Name=$ul ]
   :=
   UnorderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=oid
     ]
     FieldAccessor [
-      Variable [ Name=rec ]
+      Variable [ Name=$rec ]
       Field=oid
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=cid
     ]
   ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     =
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=cid
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=total
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_03/join_q_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_03/join_q_03.3.ast
index fd77802..bd229b6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_03/join_q_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_03/join_q_03.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [cust_name]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -14,25 +14,25 @@
     LiteralExpr [STRING] [order_total]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=total
     ]
   )
   (
     LiteralExpr [STRING] [orderedlist]
     :
-    Variable [ Name=ol ]
+    Variable [ Name=$ol ]
   )
   (
     LiteralExpr [STRING] [unorderedlist]
     :
-    Variable [ Name=ul ]
+    Variable [ Name=$ul ]
   )
   (
     LiteralExpr [STRING] [ol_item1]
     :
     IndexAccessor [
-      Variable [ Name=ol ]
+      Variable [ Name=$ol ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -40,7 +40,7 @@
     LiteralExpr [STRING] [ol_item2]
     :
     IndexAccessor [
-      Variable [ Name=ol ]
+      Variable [ Name=$ol ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -48,7 +48,7 @@
     LiteralExpr [STRING] [ol_item5]
     :
     IndexAccessor [
-      Variable [ Name=ol ]
+      Variable [ Name=$ol ]
       Index:       LiteralExpr [LONG] [4]
     ]
   )
@@ -56,7 +56,7 @@
     LiteralExpr [STRING] [ul_item1]
     :
     IndexAccessor [
-      Variable [ Name=ul ]
+      Variable [ Name=$ul ]
       Index: ANY
     ]
   )
@@ -66,72 +66,72 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=rec ]
+Let Variable [ Name=$rec ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=lastorder
   ]
-LetVariable [ Name=ol ]
+Let Variable [ Name=$ol ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=oid
     ]
     FieldAccessor [
-      Variable [ Name=rec ]
+      Variable [ Name=$rec ]
       Field=oid
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=cid
     ]
   ]
-LetVariable [ Name=ul ]
+Let Variable [ Name=$ul ]
   :=
   UnorderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=oid
     ]
     FieldAccessor [
-      Variable [ Name=rec ]
+      Variable [ Name=$rec ]
       Field=oid
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=cid
     ]
   ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
     =
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=cid
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=total
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_04/join_q_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_04/join_q_04.3.ast
index a47942b..3cb59e2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_04/join_q_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/join_q_04/join_q_04.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [cust_name]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -16,7 +16,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=oid
       ]
       ]
@@ -24,23 +24,23 @@
           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
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=oid
         ]
         ASC
@@ -53,11 +53,11 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/load-test/load-test.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/load-test/load-test.4.ast
index f37252c..dd5ca6b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/load-test/load-test.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/load-test/load-test.4.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [c2]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_01/order_q_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_01/order_q_01.3.ast
index 63d9290..69f927f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_01/order_q_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_01/order_q_01.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_02/order_q_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_02/order_q_02.3.ast
index 15c61b6..57da1bd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_02/order_q_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_02/order_q_02.3.ast
@@ -6,29 +6,29 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=cid
     ]
   )
   (
     LiteralExpr [STRING] [list1]
     :
-    Variable [ Name=c1 ]
+    Variable [ Name=$c1 ]
   )
   (
     LiteralExpr [STRING] [list2]
     :
-    Variable [ Name=c2 ]
+    Variable [ Name=$c2 ]
   )
   (
     LiteralExpr [STRING] [list3]
     :
-    Variable [ Name=c3 ]
+    Variable [ Name=$c3 ]
   )
   (
     LiteralExpr [STRING] [list4]
     :
-    Variable [ Name=c4 ]
+    Variable [ Name=$c4 ]
   )
 ]
 ]
@@ -36,85 +36,85 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=c1 ]
+Let Variable [ Name=$c1 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=orderstatus
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=clerk
     ]
   ]
-LetVariable [ Name=c2 ]
+Let Variable [ Name=$c2 ]
   :=
   UnorderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=orderstatus
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=clerk
     ]
   ]
-LetVariable [ Name=c3 ]
+Let Variable [ Name=$c3 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=heList
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=openlist
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=loc
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=lastorder
     ]
   ]
-LetVariable [ Name=c4 ]
+Let Variable [ Name=$c4 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=heList
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=openlist
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=loc
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=lastorder
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_03/order_q_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_03/order_q_03.3.ast
index 326ec5d..3bfbdcd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_03/order_q_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_03/order_q_03.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [orderid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=oid
     ]
   )
@@ -14,20 +14,20 @@
     LiteralExpr [STRING] [ordertot]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=total
     ]
   )
   (
     LiteralExpr [STRING] [list]
     :
-    Variable [ Name=c1 ]
+    Variable [ Name=$c1 ]
   )
   (
     LiteralExpr [STRING] [item1]
     :
     IndexAccessor [
-      Variable [ Name=c1 ]
+      Variable [ Name=$c1 ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -35,7 +35,7 @@
     LiteralExpr [STRING] [item2]
     :
     IndexAccessor [
-      Variable [ Name=c1 ]
+      Variable [ Name=$c1 ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -43,7 +43,7 @@
     LiteralExpr [STRING] [item3]
     :
     IndexAccessor [
-      Variable [ Name=c1 ]
+      Variable [ Name=$c1 ]
       Index:       LiteralExpr [LONG] [2]
     ]
   )
@@ -53,85 +53,85 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=c1 ]
+Let Variable [ Name=$c1 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=orderstatus
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=clerk
     ]
   ]
-LetVariable [ Name=c2 ]
+Let Variable [ Name=$c2 ]
   :=
   UnorderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=orderstatus
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=clerk
     ]
   ]
-LetVariable [ Name=c3 ]
+Let Variable [ Name=$c3 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=heList
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=openlist
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=loc
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=lastorder
     ]
   ]
-LetVariable [ Name=c4 ]
+Let Variable [ Name=$c4 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=heList
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=openlist
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=loc
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=lastorder
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_04/order_q_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_04/order_q_04.3.ast
index 1a26176..42a314b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_04/order_q_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_04/order_q_04.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [orderid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=oid
     ]
   )
@@ -14,20 +14,20 @@
     LiteralExpr [STRING] [ordertot]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=total
     ]
   )
   (
     LiteralExpr [STRING] [list]
     :
-    Variable [ Name=c3 ]
+    Variable [ Name=$c3 ]
   )
   (
     LiteralExpr [STRING] [item1]
     :
     IndexAccessor [
-      Variable [ Name=c3 ]
+      Variable [ Name=$c3 ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -35,7 +35,7 @@
     LiteralExpr [STRING] [item2]
     :
     IndexAccessor [
-      Variable [ Name=c3 ]
+      Variable [ Name=$c3 ]
       Index:       LiteralExpr [LONG] [1]
     ]
   )
@@ -43,7 +43,7 @@
     LiteralExpr [STRING] [item5]
     :
     IndexAccessor [
-      Variable [ Name=c3 ]
+      Variable [ Name=$c3 ]
       Index:       LiteralExpr [LONG] [5]
     ]
   )
@@ -51,7 +51,7 @@
     LiteralExpr [STRING] [item10]
     :
     IndexAccessor [
-      Variable [ Name=c3 ]
+      Variable [ Name=$c3 ]
       Index:       LiteralExpr [LONG] [10]
     ]
   )
@@ -61,85 +61,85 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=c1 ]
+Let Variable [ Name=$c1 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=orderstatus
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=clerk
     ]
   ]
-LetVariable [ Name=c2 ]
+Let Variable [ Name=$c2 ]
   :=
   UnorderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=orderstatus
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=clerk
     ]
   ]
-LetVariable [ Name=c3 ]
+Let Variable [ Name=$c3 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=heList
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=openlist
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=loc
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=lastorder
     ]
   ]
-LetVariable [ Name=c4 ]
+Let Variable [ Name=$c4 ]
   :=
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=heList
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=openlist
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=loc
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=lastorder
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_05/order_q_05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_05/order_q_05.3.ast
index 8a9b1ee..c519889 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_05/order_q_05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_05/order_q_05.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [orderid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=oid
     ]
   )
@@ -14,25 +14,25 @@
     LiteralExpr [STRING] [ordertot]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=total
     ]
   )
   (
     LiteralExpr [STRING] [emptyorderedlist]
     :
-    Variable [ Name=c1 ]
+    Variable [ Name=$c1 ]
   )
   (
     LiteralExpr [STRING] [emptyunorderedlist]
     :
-    Variable [ Name=c2 ]
+    Variable [ Name=$c2 ]
   )
   (
     LiteralExpr [STRING] [olist_item1]
     :
     IndexAccessor [
-      Variable [ Name=c1 ]
+      Variable [ Name=$c1 ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -40,7 +40,7 @@
     LiteralExpr [STRING] [olist_item5]
     :
     IndexAccessor [
-      Variable [ Name=c1 ]
+      Variable [ Name=$c1 ]
       Index:       LiteralExpr [LONG] [4]
     ]
   )
@@ -48,7 +48,7 @@
     LiteralExpr [STRING] [ulist_item1]
     :
     IndexAccessor [
-      Variable [ Name=c2 ]
+      Variable [ Name=$c2 ]
       Index: ANY
     ]
   )
@@ -58,13 +58,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=c1 ]
+Let Variable [ Name=$c1 ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=c2 ]
+Let Variable [ Name=$c2 ]
   :=
   UnorderedListConstructor [
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_06/order_q_06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_06/order_q_06.3.ast
index 102d550..d2c6329 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_06/order_q_06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/custord/order_q_06/order_q_06.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [item1]
     :
     IndexAccessor [
-      Variable [ Name=c3 ]
+      Variable [ Name=$c3 ]
       Index: ANY
     ]
   )
@@ -16,17 +16,17 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=c3 ]
+Let Variable [ Name=$c3 ]
   :=
   UnorderedListConstructor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=heList
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=openlist
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q1/q1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q1/q1.3.ast
index faf8289..612975d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q1/q1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q1/q1.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -16,20 +16,20 @@
     LiteralExpr [STRING] [User]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=i ]
+    [Variable [ Name=$i ]
     In
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         =
         LiteralExpr [STRING] [movies]
       ]
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   DESC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q2/q2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q2/q2.3.ast
index 8158af7..fc67ce2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q2/q2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q2/q2.3.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [sig_id]
     :
-    Variable [ Name=sig_id ]
+    Variable [ Name=$sig_id ]
   )
   (
     LiteralExpr [STRING] [total_count]
     :
-    Variable [ Name=sig_sponsorship_count ]
+    Variable [ Name=$sig_sponsorship_count ]
   )
   (
     LiteralExpr [STRING] [chapter_breakdown]
     :
-    Variable [ Name=by_chapter ]
+    Variable [ Name=$by_chapter ]
   )
 ]
 ]
@@ -23,47 +23,64 @@
     LiteralExpr [STRING] [Event]
   ]
   AS
-  Variable [ Name=event ]
+  Variable [ Name=$event ]
 ,
   FieldAccessor [
-    Variable [ Name=event ]
+    Variable [ Name=$event ]
     Field=sponsoring_sigs
   ]
   AS
-  Variable [ Name=sponsor ]
+  Variable [ Name=$sponsor ]
 ]
-LetVariable [ Name=es ]
+Let Variable [ Name=$es ]
   :=
   RecordConstructor [
     (
       LiteralExpr [STRING] [event]
       :
-      Variable [ Name=event ]
+      Variable [ Name=$event ]
     )
     (
       LiteralExpr [STRING] [sponsor]
       :
-      Variable [ Name=sponsor ]
+      Variable [ Name=$sponsor ]
     )
   ]
 Groupby
-  Variable [ Name=sig_id ]
+  Variable [ Name=$sig_id ]
   :=
   FieldAccessor [
-    Variable [ Name=sponsor ]
+    Variable [ Name=$sponsor ]
     Field=sig_id
   ]
-  With
-  Variable [ Name=es ]
-  Variable [ Name=sponsor ]
-  Variable [ Name=event ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$es ]
+   AS es
+  Variable [ Name=$sponsor ]
+   AS sponsor
+  Variable [ Name=$event ]
+   AS event
+  )
 
-LetVariable [ Name=sig_sponsorship_count ]
+Let Variable [ Name=$sig_sponsorship_count ]
   :=
   FunctionCall test.count@1[
-    Variable [ Name=es ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=es
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
-LetVariable [ Name=by_chapter ]
+Let Variable [ Name=$by_chapter ]
   :=
   (
     SELECT ELEMENT [
@@ -71,42 +88,64 @@
       (
         LiteralExpr [STRING] [chapter_name]
         :
-        Variable [ Name=chapter_name ]
+        Variable [ Name=$chapter_name ]
       )
       (
         LiteralExpr [STRING] [escount]
         :
         FunctionCall test.count@1[
-          Variable [ Name=e ]
+          (
+            SELECT ELEMENT [
+            FieldAccessor [
+              Variable [ Name=#4 ]
+              Field=e
+            ]
+            ]
+            FROM [              Variable [ Name=#3 ]
+              AS
+              Variable [ Name=#4 ]
+            ]
+          )
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=es ]
+    FROM [      Variable [ Name=$es ]
       AS
-      Variable [ Name=e ]
+      Variable [ Name=$e ]
     ]
     Groupby
-      Variable [ Name=chapter_name ]
+      Variable [ Name=$chapter_name ]
       :=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=e ]
+          Variable [ Name=$e ]
           Field=sponsor
         ]
         Field=chapter_name
       ]
-      With
-      Variable [ Name=e ]
-      Variable [ Name=sig_sponsorship_count ]
-      Variable [ Name=sponsor ]
-      Variable [ Name=sig_id ]
-      Variable [ Name=event ]
-      Variable [ Name=es ]
+      GROUP AS
+      Variable [ Name=#3 ]
+      (
+      Variable [ Name=$e ]
+       AS e
+      Variable [ Name=$sig_sponsorship_count ]
+       AS sig_sponsorship_count
+      Variable [ Name=$es ]
+       AS es
+      Variable [ Name=$event ]
+       AS event
+      Variable [ Name=$sponsor ]
+       AS sponsor
+      Variable [ Name=$sig_id ]
+       AS sig_id
+      Variable [ Name=#1 ]
+       AS #1
+      )
 
   )
 Orderby
-  Variable [ Name=sig_sponsorship_count ]
+  Variable [ Name=$sig_sponsorship_count ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/distinct/query-issue443-2/query-issue443-2.1.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/distinct/query-issue443-2/query-issue443-2.1.ast
index 4f89fc4..b2a8474 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/distinct/query-issue443-2/query-issue443-2.1.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/distinct/query-issue443-2/query-issue443-2.1.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     RecordConstructor [
@@ -65,5 +65,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/distinct/query-issue443/query-issue443.1.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/distinct/query-issue443/query-issue443.1.ast
index 3bccb41..ebbabb7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/distinct/query-issue443/query-issue443.1.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/distinct/query-issue443/query-issue443.1.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     RecordConstructor [
@@ -40,5 +40,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/compact-dataset-and-its-indexes/compact-dataset-and-its-indexes.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/compact-dataset-and-its-indexes/compact-dataset-and-its-indexes.5.ast
index 185b162..2ea0e43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/compact-dataset-and-its-indexes/compact-dataset-and-its-indexes.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/compact-dataset-and-its-indexes/compact-dataset-and-its-indexes.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_suppkey
     ]
     <
@@ -20,12 +20,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/create-drop-cltype/create-drop-cltype.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/create-drop-cltype/create-drop-cltype.3.ast
index 9504111..b793763 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/create-drop-cltype/create-drop-cltype.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/create-drop-cltype/create-drop-cltype.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Metadata.Datatype]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=DatatypeName
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/create-drop-opntype/create-drop-opntype.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/create-drop-opntype/create-drop-opntype.3.ast
index 9504111..b793763 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/create-drop-opntype/create-drop-opntype.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/create-drop-opntype/create-drop-opntype.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Metadata.Datatype]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=DatatypeName
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast
index 185b162..2ea0e43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_suppkey
     ]
     <
@@ -20,12 +20,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.3.ast
index 55c7a87..93180bd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.3.ast
@@ -1,22 +1,22 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-multi-statement/delete-multi-statement.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-multi-statement/delete-multi-statement.3.ast
index b3586b5..a5a5824 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-multi-statement/delete-multi-statement.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-multi-statement/delete-multi-statement.3.ast
@@ -1,11 +1,11 @@
 DataverseUse tpch
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customer]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-syntax-change/delete-syntax-change.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-syntax-change/delete-syntax-change.3.ast
index 55c7a87..93180bd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-syntax-change/delete-syntax-change.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/delete-syntax-change/delete-syntax-change.3.ast
@@ -1,22 +1,22 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.ast
index 7600062..4612d6e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Metadata.Index]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=IsPrimary
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/drop-index/drop-index.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/drop-index/drop-index.4.ast
index de91ce6..6352064 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/drop-index/drop-index.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/drop-index/drop-index.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [t1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=unique1
       ]
       >
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=stringu1
       ]
       =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/empty-load-with-index/empty-load-with-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/empty-load-with-index/empty-load-with-index.3.ast
index 125e278..2ab0040 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/empty-load-with-index/empty-load-with-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/empty-load-with-index/empty-load-with-index.3.ast
@@ -1,22 +1,22 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.ast
index d3cf8a6..7839ec7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test.employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-dataset/insert-and-scan-dataset.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-dataset/insert-and-scan-dataset.3.ast
index c200c21..8d78a96 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-dataset/insert-and-scan-dataset.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-dataset/insert-and-scan-dataset.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [myData]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.3.ast
index c200c21..8d78a96 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [myData]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.ast
index fe0604d..e09a921 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineID]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       <
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_linenumber
       ]
       <
@@ -31,12 +31,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-empty-dataset/insert-into-empty-dataset.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-empty-dataset/insert-into-empty-dataset.3.ast
index fe0604d..e09a921 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-empty-dataset/insert-into-empty-dataset.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-empty-dataset/insert-into-empty-dataset.3.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineID]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       <
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_linenumber
       ]
       <
@@ -31,12 +31,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset-with-index_01/insert-into-loaded-dataset-with-index_01.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset-with-index_01/insert-into-loaded-dataset-with-index_01.5.ast
index 2312f4d..037f474 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset-with-index_01/insert-into-loaded-dataset-with-index_01.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset-with-index_01/insert-into-loaded-dataset-with-index_01.5.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineID]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       =
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_linenumber
       ]
       =
@@ -31,12 +31,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.ast
index fe0604d..e09a921 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineID]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       <
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_linenumber
       ]
       <
@@ -31,12 +31,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset_01/insert-into-loaded-dataset_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset_01/insert-into-loaded-dataset_01.3.ast
index fe0604d..e09a921 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset_01/insert-into-loaded-dataset_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset_01/insert-into-loaded-dataset_01.3.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineID]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       <
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_linenumber
       ]
       <
@@ -31,12 +31,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset_02/insert-into-loaded-dataset_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset_02/insert-into-loaded-dataset_02.3.ast
index 2e2d27e..9ec1229 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset_02/insert-into-loaded-dataset_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-into-loaded-dataset_02/insert-into-loaded-dataset_02.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=t ]
+Variable [ Name=$t ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [tmp]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=unique2
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-src-dst-01/insert-src-dst-01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-src-dst-01/insert-src-dst-01.3.ast
index 07560d2..f646e71 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-src-dst-01/insert-src-dst-01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-src-dst-01/insert-src-dst-01.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds01]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-syntax/insert-syntax.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-syntax/insert-syntax.3.ast
index ecce0a8..1c6d7f0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-syntax/insert-syntax.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-syntax/insert-syntax.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.3.ast
index 32586e8..e79a75b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=title
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Extending]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.3.ast
index 32586e8..e79a75b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=title
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Extending]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.3.ast
index 12df2e7..6579dcd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Extending]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert/insert.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert/insert.3.ast
index 2a8182e..d3c7e57 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert/insert.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert/insert.3.ast
@@ -1,22 +1,22 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineID]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert_less_nc/insert_less_nc.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert_less_nc/insert_less_nc.3.ast
index 2a8182e..d3c7e57 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert_less_nc/insert_less_nc.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/insert_less_nc/insert_less_nc.3.ast
@@ -1,22 +1,22 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineID]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_01/load-with-autogenerated-pk_adm_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_01/load-with-autogenerated-pk_adm_01.3.ast
index d163e5a..b24adbb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_01/load-with-autogenerated-pk_adm_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_01/load-with-autogenerated-pk_adm_01.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=title
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Authorization in Object-Oriented Databases.]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_02/load-with-autogenerated-pk_adm_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_02/load-with-autogenerated-pk_adm_01.3.ast
index d163e5a..b24adbb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_02/load-with-autogenerated-pk_adm_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_02/load-with-autogenerated-pk_adm_01.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=title
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Authorization in Object-Oriented Databases.]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_03/load-with-autogenerated-pk_adm_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_03/load-with-autogenerated-pk_adm_03.3.ast
index d163e5a..b24adbb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_03/load-with-autogenerated-pk_adm_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_03/load-with-autogenerated-pk_adm_03.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=title
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Authorization in Object-Oriented Databases.]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.3.ast
index d163e5a..b24adbb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=title
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Authorization in Object-Oriented Databases.]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_csv_01/load-with-autogenerated-pk_csv_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_csv_01/load-with-autogenerated-pk_csv_01.3.ast
index d163e5a..b24adbb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_csv_01/load-with-autogenerated-pk_csv_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_csv_01/load-with-autogenerated-pk_csv_01.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=title
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Authorization in Object-Oriented Databases.]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_csv_02/load-with-autogenerated-pk_csv_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_csv_02/load-with-autogenerated-pk_csv_02.3.ast
index d163e5a..b24adbb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_csv_02/load-with-autogenerated-pk_csv_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_csv_02/load-with-autogenerated-pk_csv_02.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=title
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Authorization in Object-Oriented Databases.]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_txt_01/load-with-autogenerated-pk_txt_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_txt_01/load-with-autogenerated-pk_txt_01.3.ast
index fdb741c..2ebe2b1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_txt_01/load-with-autogenerated-pk_txt_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-autogenerated-pk_txt_01/load-with-autogenerated-pk_txt_01.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=title
 ]
 ]
@@ -10,12 +10,12 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Physical Object Management.]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-index-open/load-with-index-open.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-index-open/load-with-index-open.3.ast
index f68f911..0356975 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-index-open/load-with-index-open.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-index-open/load-with-index-open.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItemOpen]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_partkey
     ]
     =
@@ -20,12 +20,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-index/load-with-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-index/load-with-index.3.ast
index 6f47149..c349fe6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-index/load-with-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-index/load-with-index.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_partkey
     ]
     =
@@ -20,12 +20,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-ngram-index-open/load-with-ngram-index-open.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-ngram-index-open/load-with-ngram-index-open.3.ast
index 78199ca..7389afc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-ngram-index-open/load-with-ngram-index-open.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-ngram-index-open/load-with-ngram-index-open.3.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-ngram-index/load-with-ngram-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-ngram-index/load-with-ngram-index.3.ast
index 00a8321..84b8cef 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-ngram-index/load-with-ngram-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-ngram-index/load-with-ngram-index.3.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-rtree-index-open/load-with-rtree-index-open.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-rtree-index-open/load-with-rtree-index-open.3.ast
index 3f769c5..b0fdb23 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-rtree-index-open/load-with-rtree-index-open.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-rtree-index-open/load-with-rtree-index-open.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyDataOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-rtree-index/load-with-rtree-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-rtree-index/load-with-rtree-index.3.ast
index 613b78d..a8fb7a2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-rtree-index/load-with-rtree-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-rtree-index/load-with-rtree-index.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-word-index-open/load-with-word-index-open.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-word-index-open/load-with-word-index-open.3.ast
index 744a345..51bda44 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-word-index-open/load-with-word-index-open.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-word-index-open/load-with-word-index-open.3.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-word-index/load-with-word-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-word-index/load-with-word-index.3.ast
index e8fa4dd..fe9235b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-word-index/load-with-word-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/load-with-word-index/load-with-word-index.3.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-c2o-recursive/opentype-c2o-recursive.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-c2o-recursive/opentype-c2o-recursive.3.ast
index 40b2443..3f55eea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-c2o-recursive/opentype-c2o-recursive.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-c2o-recursive/opentype-c2o-recursive.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds2]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-c2o/opentype-c2o.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-c2o/opentype-c2o.3.ast
index 40b2443..3f55eea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-c2o/opentype-c2o.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-c2o/opentype-c2o.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds2]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-closed-optional/opentype-closed-optional.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-closed-optional/opentype-closed-optional.3.ast
index ecce0a8..1c6d7f0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-closed-optional/opentype-closed-optional.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-closed-optional/opentype-closed-optional.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-insert/opentype-insert.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-insert/opentype-insert.3.ast
index 180a22c..575c62e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-insert/opentype-insert.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-insert/opentype-insert.3.ast
@@ -1,11 +1,11 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-insert2/opentype-insert2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-insert2/opentype-insert2.3.ast
index 25fd257..b3df586 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-insert2/opentype-insert2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-insert2/opentype-insert2.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-noexpand/opentype-noexpand.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-noexpand/opentype-noexpand.3.ast
index ecce0a8..1c6d7f0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-noexpand/opentype-noexpand.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-noexpand/opentype-noexpand.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2c-recursive/opentype-o2c-recursive.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2c-recursive/opentype-o2c-recursive.3.ast
index 40b2443..3f55eea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2c-recursive/opentype-o2c-recursive.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2c-recursive/opentype-o2c-recursive.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds2]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2c/opentype-o2c.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2c/opentype-o2c.3.ast
index 40b2443..3f55eea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2c/opentype-o2c.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2c/opentype-o2c.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds2]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2o/opentype-o2o.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2o/opentype-o2o.3.ast
index 40b2443..3f55eea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2o/opentype-o2o.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/opentype-o2o/opentype-o2o.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds2]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue205/query-issue205.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue205/query-issue205.3.ast
index 52568ce..32645d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue205/query-issue205.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue205/query-issue205.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Employees]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue288/query-issue288.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue288/query-issue288.5.ast
index 2cc3f9b..ca4fdf8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue288/query-issue288.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue288/query-issue288.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineID2]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_linenumber
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue382/query-issue382.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue382/query-issue382.3.ast
index 46bda0b..4c6695e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue382/query-issue382.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue382/query-issue382.3.ast
@@ -4,13 +4,13 @@
 FunctionCall SocialNetworkData.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=h ]
+    Variable [ Name=$h ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [HandbookUsers]
       ]
       AS
-      Variable [ Name=h ]
+      Variable [ Name=$h ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue433/query-issue433.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue433/query-issue433.3.ast
index 5698d739..b3b58e3 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue433/query-issue433.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/query-issue433/query-issue433.3.ast
@@ -1,17 +1,17 @@
 DataverseUse insertIssue
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [myDataset]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-btree-secondary-index-nullable/scan-delete-btree-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-btree-secondary-index-nullable/scan-delete-btree-secondary-index-nullable.5.ast
index 9fa8d85..62e3142 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-btree-secondary-index-nullable/scan-delete-btree-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-btree-secondary-index-nullable/scan-delete-btree-secondary-index-nullable.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
     <
@@ -20,7 +20,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-btree-secondary-index-open/scan-delete-btree-secondary-index-open.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-btree-secondary-index-open/scan-delete-btree-secondary-index-open.5.ast
index c6100d4..5a910b0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-btree-secondary-index-open/scan-delete-btree-secondary-index-open.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-btree-secondary-index-open/scan-delete-btree-secondary-index-open.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CustomersOpen]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
     <
@@ -20,7 +20,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index-nullable/scan-delete-inverted-index-ngram-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index-nullable/scan-delete-inverted-index-ngram-secondary-index-nullable.5.ast
index 00a8321..84b8cef 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index-nullable/scan-delete-inverted-index-ngram-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index-nullable/scan-delete-inverted-index-ngram-secondary-index-nullable.5.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index-open/scan-delete-inverted-index-ngram-secondary-index-open.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index-open/scan-delete-inverted-index-ngram-secondary-index-open.5.ast
index 78199ca..7389afc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index-open/scan-delete-inverted-index-ngram-secondary-index-open.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index-open/scan-delete-inverted-index-ngram-secondary-index-open.5.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index/scan-delete-inverted-index-ngram-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index/scan-delete-inverted-index-ngram-secondary-index.5.ast
index 00a8321..84b8cef 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index/scan-delete-inverted-index-ngram-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-ngram-secondary-index/scan-delete-inverted-index-ngram-secondary-index.5.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index-nullable/scan-delete-inverted-index-word-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index-nullable/scan-delete-inverted-index-word-secondary-index-nullable.5.ast
index e8fa4dd..fe9235b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index-nullable/scan-delete-inverted-index-word-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index-nullable/scan-delete-inverted-index-word-secondary-index-nullable.5.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index-open/scan-delete-inverted-index-word-secondary-index-open.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index-open/scan-delete-inverted-index-word-secondary-index-open.5.ast
index 744a345..51bda44 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index-open/scan-delete-inverted-index-word-secondary-index-open.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index-open/scan-delete-inverted-index-word-secondary-index-open.5.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index/scan-delete-inverted-index-word-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index/scan-delete-inverted-index-word-secondary-index.5.ast
index e8fa4dd..fe9235b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index/scan-delete-inverted-index-word-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-inverted-index-word-secondary-index/scan-delete-inverted-index-word-secondary-index.5.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index-nullable/scan-delete-rtree-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index-nullable/scan-delete-rtree-secondary-index-nullable.5.ast
index 613b78d..a8fb7a2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index-nullable/scan-delete-rtree-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index-nullable/scan-delete-rtree-secondary-index-nullable.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index-open/scan-delete-rtree-secondary-index-open.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index-open/scan-delete-rtree-secondary-index-open.5.ast
index 3f769c5..b0fdb23 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index-open/scan-delete-rtree-secondary-index-open.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index-open/scan-delete-rtree-secondary-index-open.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyDataOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast
index 613b78d..a8fb7a2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-btree-secondary-index-nullable/scan-insert-btree-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-btree-secondary-index-nullable/scan-insert-btree-secondary-index-nullable.5.ast
index 23d7439..8c70eff 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-btree-secondary-index-nullable/scan-insert-btree-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-btree-secondary-index-nullable/scan-insert-btree-secondary-index-nullable.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CustomersMini]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
     <
@@ -20,7 +20,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-btree-secondary-index-open/scan-insert-btree-secondary-index-open.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-btree-secondary-index-open/scan-insert-btree-secondary-index-open.5.ast
index c6100d4..5a910b0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-btree-secondary-index-open/scan-insert-btree-secondary-index-open.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-btree-secondary-index-open/scan-insert-btree-secondary-index-open.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CustomersOpen]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
     <
@@ -20,7 +20,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index-nullable/scan-insert-inverted-index-ngram-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index-nullable/scan-insert-inverted-index-ngram-secondary-index-nullable.5.ast
index b68b640..77097fc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index-nullable/scan-insert-inverted-index-ngram-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index-nullable/scan-insert-inverted-index-ngram-secondary-index-nullable.5.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP1]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index-open/scan-insert-inverted-index-ngram-secondary-index-open.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index-open/scan-insert-inverted-index-ngram-secondary-index-open.5.ast
index 78199ca..7389afc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index-open/scan-insert-inverted-index-ngram-secondary-index-open.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index-open/scan-insert-inverted-index-ngram-secondary-index-open.5.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index/scan-insert-inverted-index-ngram-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index/scan-insert-inverted-index-ngram-secondary-index.5.ast
index b68b640..77097fc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index/scan-insert-inverted-index-ngram-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-ngram-secondary-index/scan-insert-inverted-index-ngram-secondary-index.5.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP1]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index-nullable/scan-insert-inverted-index-word-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index-nullable/scan-insert-inverted-index-word-secondary-index-nullable.5.ast
index 0025905..94fc6b6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index-nullable/scan-insert-inverted-index-word-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index-nullable/scan-insert-inverted-index-word-secondary-index-nullable.5.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP1]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index-open/scan-insert-inverted-index-word-secondary-index-open.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index-open/scan-insert-inverted-index-word-secondary-index-open.5.ast
index 744a345..51bda44 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index-open/scan-insert-inverted-index-word-secondary-index-open.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index-open/scan-insert-inverted-index-word-secondary-index-open.5.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index/scan-insert-inverted-index-word-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index/scan-insert-inverted-index-word-secondary-index.5.ast
index 0025905..94fc6b6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index/scan-insert-inverted-index-word-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-inverted-index-word-secondary-index/scan-insert-inverted-index-word-secondary-index.5.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP1]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index-nullable/scan-insert-rtree-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index-nullable/scan-insert-rtree-secondary-index-nullable.5.ast
index 1b0eba1..68e4dd8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index-nullable/scan-insert-rtree-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index-nullable/scan-insert-rtree-secondary-index-nullable.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyMiniData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index-open/scan-insert-rtree-secondary-index-open.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index-open/scan-insert-rtree-secondary-index-open.5.ast
index b0060e2..274b4d4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index-open/scan-insert-rtree-secondary-index-open.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index-open/scan-insert-rtree-secondary-index-open.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyOpenData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast
index 1b0eba1..68e4dd8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyMiniData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-constant-merge-policy/using-constant-merge-policy.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-constant-merge-policy/using-constant-merge-policy.5.ast
index 185b162..2ea0e43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-constant-merge-policy/using-constant-merge-policy.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-constant-merge-policy/using-constant-merge-policy.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_suppkey
     ]
     <
@@ -20,12 +20,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-correlated-prefix-merge-policy/using-correlated-prefix-merge-policy.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-correlated-prefix-merge-policy/using-correlated-prefix-merge-policy.5.ast
index 185b162..2ea0e43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-correlated-prefix-merge-policy/using-correlated-prefix-merge-policy.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-correlated-prefix-merge-policy/using-correlated-prefix-merge-policy.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_suppkey
     ]
     <
@@ -20,12 +20,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-no-merge-policy/using-no-merge-policy.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-no-merge-policy/using-no-merge-policy.5.ast
index 185b162..2ea0e43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-no-merge-policy/using-no-merge-policy.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-no-merge-policy/using-no-merge-policy.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_suppkey
     ]
     <
@@ -20,12 +20,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-prefix-merge-policy/using-prefix-merge-policy.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-prefix-merge-policy/using-prefix-merge-policy.5.ast
index 185b162..2ea0e43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-prefix-merge-policy/using-prefix-merge-policy.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dml/using-prefix-merge-policy/using-prefix-merge-policy.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_suppkey
     ]
     <
@@ -20,12 +20,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/employee/q_01/q_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/employee/q_01/q_01.3.ast
index b0e1330..fa27a43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/employee/q_01/q_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/employee/q_01/q_01.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=e ]
+Variable [ Name=$e ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Emp]
   ]
   AS
-  Variable [ Name=e ]
+  Variable [ Name=$e ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/employee/q_02/q_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/employee/q_02/q_02.3.ast
index b0ddf39..9de5b2c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/employee/q_02/q_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/employee/q_02/q_02.3.ast
@@ -1,15 +1,15 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Emp]
   ]
   AS
-  Variable [ Name=e ]
+  Variable [ Name=$e ]
 ]
-LetVariable [ Name=m ]
+Let Variable [ Name=$m ]
   :=
   OrderedListConstructor [
     RecordConstructor [
@@ -17,7 +17,7 @@
         LiteralExpr [STRING] [EmpName]
         :
         FieldAccessor [
-          Variable [ Name=e ]
+          Variable [ Name=$e ]
           Field=name
         ]
       )
@@ -26,7 +26,7 @@
         :
         IndexAccessor [
           FieldAccessor [
-            Variable [ Name=e ]
+            Variable [ Name=$e ]
             Field=interests
           ]
           Index: ANY
@@ -37,7 +37,7 @@
         :
         IndexAccessor [
           FieldAccessor [
-            Variable [ Name=e ]
+            Variable [ Name=$e ]
             Field=children
           ]
           Index: ANY
@@ -48,7 +48,7 @@
         :
         IndexAccessor [
           FieldAccessor [
-            Variable [ Name=e ]
+            Variable [ Name=$e ]
             Field=children
           ]
           Index:           LiteralExpr [LONG] [1]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
index 317564b..ab69658 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -46,19 +46,19 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -71,13 +71,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -85,7 +85,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -95,7 +95,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/leftouterjoin/leftouterjoin.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/leftouterjoin/leftouterjoin.3.ast
index d3b6da5..cec3efa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/leftouterjoin/leftouterjoin.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/leftouterjoin/leftouterjoin.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -46,23 +46,23 @@
           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
@@ -75,12 +75,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -90,7 +90,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/rc-format/rc-format.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/rc-format/rc-format.3.ast
index 4ce2f9f..7604fff 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/rc-format/rc-format.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/rc-format/rc-format.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [EmployeeDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/rtree-index/rtree-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/rtree-index/rtree-index.3.ast
index fe2fa6b..1302b5e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/rtree-index/rtree-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/rtree-index/rtree-index.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/sequence-format/sequence-format.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/sequence-format/sequence-format.3.ast
index 4ce2f9f..7604fff 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/sequence-format/sequence-format.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/sequence-format/sequence-format.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [EmployeeDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/text-format/text-format.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/text-format/text-format.3.ast
index a638988..cfb6277 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/text-format/text-format.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/external-indexing/text-format/text-format.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=emp ]
+Variable [ Name=$emp ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [EmployeeDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
@@ -20,7 +20,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/equality-predicate/equality-predicate.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/equality-predicate/equality-predicate.5.ast
index 0ec6003..4788c3e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/equality-predicate/equality-predicate.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/equality-predicate/equality-predicate.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Field=send-time
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-btree/insert-with-secondary-btree.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-btree/insert-with-secondary-btree.5.ast
index 698c900..5241dbb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-btree/insert-with-secondary-btree.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-btree/insert-with-secondary-btree.5.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages2]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=author-id
       ]
       =
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       >
@@ -33,7 +33,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       <
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-inverted-ngram/insert-with-secondary-inverted-ngram.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-inverted-ngram/insert-with-secondary-inverted-ngram.5.ast
index 307feb7..17c5ce7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-inverted-ngram/insert-with-secondary-inverted-ngram.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-inverted-ngram/insert-with-secondary-inverted-ngram.5.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=message
       ]
       LiteralExpr [STRING] [love]
@@ -21,7 +21,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       <
@@ -32,7 +32,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     Field=send-time
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-inverted-word/insert-with-secondary-inverted-word.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-inverted-word/insert-with-secondary-inverted-word.5.ast
index b429922..1ab98c4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-inverted-word/insert-with-secondary-inverted-word.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-inverted-word/insert-with-secondary-inverted-word.5.ast
@@ -1,13 +1,13 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
@@ -15,7 +15,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=m ]
+            Variable [ Name=$m ]
             Field=message
           ]
         ]
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       <
@@ -40,7 +40,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     Field=send-time
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-rtree/insert-with-secondary-rtree.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-rtree/insert-with-secondary-rtree.5.ast
index 3258cf9..647e3a8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-rtree/insert-with-secondary-rtree.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert-with-secondary-rtree/insert-with-secondary-rtree.5.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.spatial-intersect@2[
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=sender-location
       ]
       FunctionCall test.create-polygon@1[
@@ -32,7 +32,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       <
@@ -43,7 +43,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     Field=send-time
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert/insert.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert/insert.5.ast
index c4eb26a..52fc41d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert/insert.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/insert/insert.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages2]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Field=send-time
     ]
     >
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-btree/load-with-secondary-btree.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-btree/load-with-secondary-btree.5.ast
index b32e113..5071e45 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-btree/load-with-secondary-btree.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-btree/load-with-secondary-btree.5.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=author-id
       ]
       =
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       >
@@ -33,7 +33,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       <
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-inverted-ngram/load-with-secondary-inverted-ngram.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-inverted-ngram/load-with-secondary-inverted-ngram.5.ast
index 307feb7..17c5ce7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-inverted-ngram/load-with-secondary-inverted-ngram.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-inverted-ngram/load-with-secondary-inverted-ngram.5.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=message
       ]
       LiteralExpr [STRING] [love]
@@ -21,7 +21,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       <
@@ -32,7 +32,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     Field=send-time
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-inverted-word/load-with-secondary-inverted-word.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-inverted-word/load-with-secondary-inverted-word.5.ast
index b429922..1ab98c4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-inverted-word/load-with-secondary-inverted-word.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-inverted-word/load-with-secondary-inverted-word.5.ast
@@ -1,13 +1,13 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
@@ -15,7 +15,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=m ]
+            Variable [ Name=$m ]
             Field=message
           ]
         ]
@@ -29,7 +29,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       <
@@ -40,7 +40,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     Field=send-time
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-rtree/load-with-secondary-rtree.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-rtree/load-with-secondary-rtree.5.ast
index 3258cf9..647e3a8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-rtree/load-with-secondary-rtree.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load-with-secondary-rtree/load-with-secondary-rtree.5.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.spatial-intersect@2[
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=sender-location
       ]
       FunctionCall test.create-polygon@1[
@@ -32,7 +32,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         Field=send-time
       ]
       <
@@ -43,7 +43,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     Field=send-time
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load/load.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load/load.5.ast
index a033dff..aa484cd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load/load.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/filters/load/load.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=m ]
+Variable [ Name=$m ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Field=send-time
     ]
     >
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.3.ast
index 60a1d56..633ec16 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.3.ast
@@ -6,20 +6,20 @@
     LiteralExpr [STRING] [partkey]
     :
     FieldAccessor [
-      Variable [ Name=gen0 ]
+      Variable [ Name=$gen0 ]
       Field=partkey
     ]
   )
   (
     LiteralExpr [STRING] [pid]
     :
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
   )
   (
     LiteralExpr [STRING] [shipdate]
     :
     FieldAccessor [
-      Variable [ Name=j ]
+      Variable [ Name=$j ]
       Field=l_shipdate
     ]
   )
@@ -31,67 +31,71 @@
       (
         LiteralExpr [STRING] [partkey]
         :
-        Variable [ Name=partkey ]
+        Variable [ Name=$partkey ]
       )
       (
         LiteralExpr [STRING] [i]
         :
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       )
     ]
     ]
     FROM [      (
         SELECT ELEMENT [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Orderby
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_partkey
           ]
           ASC
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_shipdate
           ]
           ASC
 
       )
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Groupby
-      Variable [ Name=partkey ]
+      Variable [ Name=$partkey ]
       :=
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=l_partkey
       ]
-      With
-      Variable [ Name=i ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$i ]
+       AS i
+      )
 
   )
   AS
-  Variable [ Name=gen0 ]
+  Variable [ Name=$gen0 ]
 ,
   FieldAccessor [
-    Variable [ Name=gen0 ]
+    Variable [ Name=$gen0 ]
     Field=i
   ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
   AT
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
     <
     LiteralExpr [LONG] [4]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.4.ast
index 60a1d56..633ec16 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.4.ast
@@ -6,20 +6,20 @@
     LiteralExpr [STRING] [partkey]
     :
     FieldAccessor [
-      Variable [ Name=gen0 ]
+      Variable [ Name=$gen0 ]
       Field=partkey
     ]
   )
   (
     LiteralExpr [STRING] [pid]
     :
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
   )
   (
     LiteralExpr [STRING] [shipdate]
     :
     FieldAccessor [
-      Variable [ Name=j ]
+      Variable [ Name=$j ]
       Field=l_shipdate
     ]
   )
@@ -31,67 +31,71 @@
       (
         LiteralExpr [STRING] [partkey]
         :
-        Variable [ Name=partkey ]
+        Variable [ Name=$partkey ]
       )
       (
         LiteralExpr [STRING] [i]
         :
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       )
     ]
     ]
     FROM [      (
         SELECT ELEMENT [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Orderby
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_partkey
           ]
           ASC
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_shipdate
           ]
           ASC
 
       )
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Groupby
-      Variable [ Name=partkey ]
+      Variable [ Name=$partkey ]
       :=
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=l_partkey
       ]
-      With
-      Variable [ Name=i ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$i ]
+       AS i
+      )
 
   )
   AS
-  Variable [ Name=gen0 ]
+  Variable [ Name=$gen0 ]
 ,
   FieldAccessor [
-    Variable [ Name=gen0 ]
+    Variable [ Name=$gen0 ]
     Field=i
   ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
   AT
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
     <
     LiteralExpr [LONG] [4]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.5.ast
index 60a1d56..633ec16 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at00/at00.5.ast
@@ -6,20 +6,20 @@
     LiteralExpr [STRING] [partkey]
     :
     FieldAccessor [
-      Variable [ Name=gen0 ]
+      Variable [ Name=$gen0 ]
       Field=partkey
     ]
   )
   (
     LiteralExpr [STRING] [pid]
     :
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
   )
   (
     LiteralExpr [STRING] [shipdate]
     :
     FieldAccessor [
-      Variable [ Name=j ]
+      Variable [ Name=$j ]
       Field=l_shipdate
     ]
   )
@@ -31,67 +31,71 @@
       (
         LiteralExpr [STRING] [partkey]
         :
-        Variable [ Name=partkey ]
+        Variable [ Name=$partkey ]
       )
       (
         LiteralExpr [STRING] [i]
         :
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       )
     ]
     ]
     FROM [      (
         SELECT ELEMENT [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Orderby
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_partkey
           ]
           ASC
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_shipdate
           ]
           ASC
 
       )
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Groupby
-      Variable [ Name=partkey ]
+      Variable [ Name=$partkey ]
       :=
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=l_partkey
       ]
-      With
-      Variable [ Name=i ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$i ]
+       AS i
+      )
 
   )
   AS
-  Variable [ Name=gen0 ]
+  Variable [ Name=$gen0 ]
 ,
   FieldAccessor [
-    Variable [ Name=gen0 ]
+    Variable [ Name=$gen0 ]
     Field=i
   ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
   AT
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
     <
     LiteralExpr [LONG] [4]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at01/at01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at01/at01.3.ast
index 1aafc34..770fb09 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at01/at01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at01/at01.3.ast
@@ -5,13 +5,13 @@
   (
     LiteralExpr [STRING] [num]
     :
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
   )
   (
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=name
     ]
   )
@@ -19,7 +19,7 @@
     LiteralExpr [STRING] [user-since]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=user-since
     ]
   )
@@ -27,24 +27,24 @@
 ]
 FROM [  (
     SELECT ELEMENT [
-    Variable [ Name=fb ]
+    Variable [ Name=$fb ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [FacebookUsers]
       ]
       AS
-      Variable [ Name=fb ]
+      Variable [ Name=$fb ]
     ]
     Orderby
       FieldAccessor [
-        Variable [ Name=fb ]
+        Variable [ Name=$fb ]
         Field=name
       ]
       ASC
 
   )
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
   AT
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at02/at02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at02/at02.3.ast
index d6863cd..fc41a3b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at02/at02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at02/at02.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [group]
     :
-    Variable [ Name=g ]
+    Variable [ Name=$g ]
   )
   (
     LiteralExpr [STRING] [item]
@@ -16,13 +16,13 @@
         (
           LiteralExpr [STRING] [num]
           :
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
         )
         (
           LiteralExpr [STRING] [mid]
           :
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=message-id
           ]
         )
@@ -30,24 +30,24 @@
       ]
       FROM [        (
           SELECT ELEMENT [
-          Variable [ Name=ii ]
+          Variable [ Name=$ii ]
           ]
-          FROM [            Variable [ Name=m ]
+          FROM [            Variable [ Name=$m ]
             AS
-            Variable [ Name=ii ]
+            Variable [ Name=$ii ]
           ]
           Orderby
             FieldAccessor [
-              Variable [ Name=ii ]
+              Variable [ Name=$ii ]
               Field=message-id
             ]
             ASC
 
         )
         AS
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         AT
-        Variable [ Name=p ]
+        Variable [ Name=$p ]
       ]
     )
   )
@@ -57,38 +57,43 @@
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=u ]
+  Variable [ Name=$u ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=u ]
+      Variable [ Name=$u ]
       Field=id
     ]
     =
     FieldAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Field=author-id
     ]
   ]
 Groupby
-  Variable [ Name=g ]
+  Variable [ Name=$g ]
   :=
   FieldAccessor [
-    Variable [ Name=u ]
+    Variable [ Name=$u ]
     Field=id
   ]
-  With
-  Variable [ Name=u ]
-  Variable [ Name=m ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$m ]
+   AS m
+  Variable [ Name=$u ]
+   AS u
+  )
 
 Orderby
-  Variable [ Name=g ]
+  Variable [ Name=$g ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at03/at03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at03/at03.3.ast
index eda838d..d7e0dcc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at03/at03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at03/at03.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [user-since]
     :
-    Variable [ Name=fus ]
+    Variable [ Name=$fus ]
   )
   (
     LiteralExpr [STRING] [users]
@@ -16,13 +16,13 @@
         (
           LiteralExpr [STRING] [num]
           :
-          Variable [ Name=ip ]
+          Variable [ Name=$ip ]
         )
         (
           LiteralExpr [STRING] [name]
           :
           FieldAccessor [
-            Variable [ Name=f ]
+            Variable [ Name=$f ]
             Field=name
           ]
         )
@@ -30,24 +30,24 @@
       ]
       FROM [        (
           SELECT ELEMENT [
-          Variable [ Name=i1 ]
+          Variable [ Name=$i1 ]
           ]
-          FROM [            Variable [ Name=i ]
+          FROM [            Variable [ Name=$i ]
             AS
-            Variable [ Name=i1 ]
+            Variable [ Name=$i1 ]
           ]
           Orderby
             FieldAccessor [
-              Variable [ Name=i1 ]
+              Variable [ Name=$i1 ]
               Field=name
             ]
             ASC
 
         )
         AS
-        Variable [ Name=f ]
+        Variable [ Name=$f ]
         AT
-        Variable [ Name=ip ]
+        Variable [ Name=$ip ]
       ]
     )
   )
@@ -55,31 +55,35 @@
 ]
 FROM [  (
     SELECT ELEMENT [
-    Variable [ Name=fb ]
+    Variable [ Name=$fb ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [FacebookUsers]
       ]
       AS
-      Variable [ Name=fb ]
+      Variable [ Name=$fb ]
     ]
   )
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Groupby
-  Variable [ Name=fus ]
+  Variable [ Name=$fus ]
   :=
   FunctionCall test.get-year@1[
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=user-since
     ]
   ]
-  With
-  Variable [ Name=i ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$i ]
+   AS i
+  )
 
 Orderby
-  Variable [ Name=fus ]
+  Variable [ Name=$fus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at04/at04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at04/at04.3.ast
index 0efaa7b..5286e9c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at04/at04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at04/at04.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [o_custkey]
     :
-    Variable [ Name=ckey ]
+    Variable [ Name=$ckey ]
   )
   (
     LiteralExpr [STRING] [users]
@@ -16,13 +16,13 @@
         (
           LiteralExpr [STRING] [num]
           :
-          Variable [ Name=ip ]
+          Variable [ Name=$ip ]
         )
         (
           LiteralExpr [STRING] [orderkey]
           :
           FieldAccessor [
-            Variable [ Name=f ]
+            Variable [ Name=$f ]
             Field=o_orderkey
           ]
         )
@@ -30,24 +30,24 @@
       ]
       FROM [        (
           SELECT ELEMENT [
-          Variable [ Name=i1 ]
+          Variable [ Name=$i1 ]
           ]
-          FROM [            Variable [ Name=i ]
+          FROM [            Variable [ Name=$i ]
             AS
-            Variable [ Name=i1 ]
+            Variable [ Name=$i1 ]
           ]
           Orderby
             FieldAccessor [
-              Variable [ Name=i1 ]
+              Variable [ Name=$i1 ]
               Field=o_orderkey
             ]
             ASC
 
         )
         AS
-        Variable [ Name=f ]
+        Variable [ Name=$f ]
         AT
-        Variable [ Name=ip ]
+        Variable [ Name=$ip ]
       ]
     )
   )
@@ -55,30 +55,34 @@
 ]
 FROM [  (
     SELECT ELEMENT [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
     ]
   )
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Groupby
-  Variable [ Name=ckey ]
+  Variable [ Name=$ckey ]
   :=
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=o_custkey
   ]
-  With
-  Variable [ Name=i ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$i ]
+   AS i
+  )
 
 Orderby
-  Variable [ Name=ckey ]
+  Variable [ Name=$ckey ]
   ASC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at05/at05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at05/at05.3.ast
index a3d85c7..87ce40d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at05/at05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at05/at05.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=si ]
+Variable [ Name=$si ]
 ]
 FROM [  (
     SELECT ELEMENT [
@@ -9,17 +9,17 @@
       (
         LiteralExpr [STRING] [xx]
         :
-        Variable [ Name=xx ]
+        Variable [ Name=$xx ]
       )
       (
         LiteralExpr [STRING] [x]
         :
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       )
       (
         LiteralExpr [STRING] [uid]
         :
-        Variable [ Name=uid ]
+        Variable [ Name=$uid ]
       )
     ]
     ]
@@ -27,28 +27,32 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=o_custkey
         ]
         <
         LiteralExpr [LONG] [4]
       ]
     Groupby
-      Variable [ Name=uid ]
+      Variable [ Name=$uid ]
       :=
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=o_custkey
       ]
-      With
-      Variable [ Name=x ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$x ]
+       AS x
+      )
 
-    LetVariable [ Name=xx ]
+    Let Variable [ Name=$xx ]
       :=
       (
         SELECT ELEMENT [
@@ -56,18 +60,18 @@
           (
             LiteralExpr [STRING] [uid]
             :
-            Variable [ Name=uid ]
+            Variable [ Name=$uid ]
           )
           (
             LiteralExpr [STRING] [seq]
             :
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           )
           (
             LiteralExpr [STRING] [item]
             :
             FieldAccessor [
-              Variable [ Name=y ]
+              Variable [ Name=$y ]
               Field=o_orderkey
             ]
           )
@@ -75,38 +79,38 @@
         ]
         FROM [          (
             SELECT ELEMENT [
-            Variable [ Name=xxx ]
+            Variable [ Name=$xxx ]
             ]
-            FROM [              Variable [ Name=x ]
+            FROM [              Variable [ Name=$x ]
               AS
-              Variable [ Name=xxx ]
+              Variable [ Name=$xxx ]
             ]
             Orderby
               FieldAccessor [
-                Variable [ Name=xxx ]
+                Variable [ Name=$xxx ]
                 Field=o_orderkey
               ]
               ASC
 
           )
           AS
-          Variable [ Name=y ]
+          Variable [ Name=$y ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     Orderby
-      Variable [ Name=uid ]
+      Variable [ Name=$uid ]
       ASC
 
   )
   AS
-  Variable [ Name=gen0 ]
+  Variable [ Name=$gen0 ]
 ,
   FieldAccessor [
-    Variable [ Name=gen0 ]
+    Variable [ Name=$gen0 ]
     Field=xx
   ]
   AS
-  Variable [ Name=si ]
+  Variable [ Name=$si ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at06/at06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at06/at06.3.ast
index 1eed705..6fdea10 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at06/at06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at06/at06.3.ast
@@ -6,20 +6,20 @@
     LiteralExpr [STRING] [partkey]
     :
     FieldAccessor [
-      Variable [ Name=gen0 ]
+      Variable [ Name=$gen0 ]
       Field=partkey
     ]
   )
   (
     LiteralExpr [STRING] [pid]
     :
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
   )
   (
     LiteralExpr [STRING] [shipdate]
     :
     FieldAccessor [
-      Variable [ Name=j ]
+      Variable [ Name=$j ]
       Field=l_shipdate
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [orderkey]
     :
     FieldAccessor [
-      Variable [ Name=j ]
+      Variable [ Name=$j ]
       Field=l_orderkey
     ]
   )
@@ -39,77 +39,81 @@
       (
         LiteralExpr [STRING] [i]
         :
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       )
       (
         LiteralExpr [STRING] [partkey]
         :
-        Variable [ Name=partkey ]
+        Variable [ Name=$partkey ]
       )
     ]
     ]
     FROM [      (
         SELECT ELEMENT [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Orderby
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_partkey
           ]
           ASC
 
       )
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Groupby
-      Variable [ Name=partkey ]
+      Variable [ Name=$partkey ]
       :=
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=l_partkey
       ]
-      With
-      Variable [ Name=i ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$i ]
+       AS i
+      )
 
   )
   AS
-  Variable [ Name=gen0 ]
+  Variable [ Name=$gen0 ]
 ,
   (
     SELECT ELEMENT [
-    Variable [ Name=ii ]
+    Variable [ Name=$ii ]
     ]
     FROM [      FieldAccessor [
-        Variable [ Name=gen0 ]
+        Variable [ Name=$gen0 ]
         Field=i
       ]
       AS
-      Variable [ Name=ii ]
+      Variable [ Name=$ii ]
     ]
     Orderby
       FieldAccessor [
-        Variable [ Name=ii ]
+        Variable [ Name=$ii ]
         Field=l_shipdate
       ]
       ASC
 
   )
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
   AT
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=p ]
+    Variable [ Name=$p ]
     <
     LiteralExpr [LONG] [4]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/query-issue550/query-issue550.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/query-issue550/query-issue550.3.ast
index 416cf4e..7cf52e9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/query-issue550/query-issue550.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/query-issue550/query-issue550.3.ast
@@ -1,5 +1,5 @@
 Query:
-LetVariable [ Name=sample ]
+Let Variable [ Name=$sample ]
   :=
   UnorderedListConstructor [
     RecordConstructor [
@@ -152,35 +152,40 @@
   (
     LiteralExpr [STRING] [u]
     :
-    Variable [ Name=u ]
+    Variable [ Name=$u ]
   )
   (
     LiteralExpr [STRING] [recs]
     :
     (
       SELECT ELEMENT [
-      Variable [ Name=srec ]
+      Variable [ Name=$srec ]
       ]
-      FROM [        Variable [ Name=s ]
+      FROM [        Variable [ Name=$s ]
         AS
-        Variable [ Name=srec ]
+        Variable [ Name=$srec ]
       ]
     )
   )
 ]
 ]
-FROM [  Variable [ Name=sample ]
+FROM [  Variable [ Name=$sample ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
 ]
 Groupby
-  Variable [ Name=u ]
+  Variable [ Name=$u ]
   :=
   FieldAccessor [
-    Variable [ Name=s ]
+    Variable [ Name=$s ]
     Field=uid
   ]
-  With
-  Variable [ Name=s ]
-  Variable [ Name=sample ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$s ]
+   AS s
+  Variable [ Name=$sample ]
+   AS sample
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.ast
index eb3fed5..0e2d5bf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.ast
@@ -2,36 +2,52 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=tokenGroupped ]
+Variable [ Name=$tokenGroupped ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
 Groupby
-  Variable [ Name=tokenGroupped ]
+  Variable [ Name=$tokenGroupped ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=paper ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$paper ]
+   AS paper
+  )
 
 Orderby
   FunctionCall fuzzyjoin.count@1[
-    Variable [ Name=paper ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=paper
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
   ASC
-  Variable [ Name=tokenGroupped ]
+  Variable [ Name=$tokenGroupped ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
index 099a27b..191068a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
@@ -2,43 +2,60 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=tokenGroupped ]
+Variable [ Name=$tokenGroupped ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
-LetVariable [ Name=id ]
+Let Variable [ Name=$id ]
   :=
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
 Groupby
-  Variable [ Name=tokenGroupped ]
+  Variable [ Name=$tokenGroupped ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=id ]
-  Variable [ Name=paper ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$id ]
+   AS id
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$paper ]
+   AS paper
+  )
 
 Orderby
   FunctionCall fuzzyjoin.count@1[
-    Variable [ Name=id ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=id
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
   ASC
-  Variable [ Name=tokenGroupped ]
+  Variable [ Name=$tokenGroupped ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
index 099a27b..191068a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
@@ -2,43 +2,60 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=tokenGroupped ]
+Variable [ Name=$tokenGroupped ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
-LetVariable [ Name=id ]
+Let Variable [ Name=$id ]
   :=
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
 Groupby
-  Variable [ Name=tokenGroupped ]
+  Variable [ Name=$tokenGroupped ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=id ]
-  Variable [ Name=paper ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$id ]
+   AS id
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$paper ]
+   AS paper
+  )
 
 Orderby
   FunctionCall fuzzyjoin.count@1[
-    Variable [ Name=id ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=id
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
   ASC
-  Variable [ Name=tokenGroupped ]
+  Variable [ Name=$tokenGroupped ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
index c487f14..fa9ab5f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
@@ -2,43 +2,60 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=tokenGroupped ]
+Variable [ Name=$tokenGroupped ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
-LetVariable [ Name=paperid ]
+Let Variable [ Name=$paperid ]
   :=
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
 Groupby
-  Variable [ Name=tokenGroupped ]
+  Variable [ Name=$tokenGroupped ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=paperid ]
-  Variable [ Name=paper ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$paperid ]
+   AS paperid
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$paper ]
+   AS paper
+  )
 
 Orderby
   FunctionCall fuzzyjoin.count@1[
-    Variable [ Name=paperid ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=paperid
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
   ASC
-  Variable [ Name=tokenGroupped ]
+  Variable [ Name=$tokenGroupped ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
index db61b3e..315a705 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [prefixToken]
     :
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$prefixTokenDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -39,103 +39,126 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
index 5fcb123..44a7325 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [prefixToken]
     :
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$prefixTokenDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -41,66 +41,66 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       Field=rank
     ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [TOKENSRANKEDADM]
       ]
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
         FieldAccessor [
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           Field=token
         ]
       ]
     Orderby
       FieldAccessor [
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
         Field=rank
       ]
       ASC
 
   )
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_1/dblp-2_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_1/dblp-2_1.3.ast
index 66dcb7b..8ea2c98 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_1/dblp-2_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_1/dblp-2_1.3.ast
@@ -7,14 +7,14 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=id
     ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -22,80 +22,98 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=paper ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=paper
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
index 7f265d8..bdec735 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
@@ -7,14 +7,14 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=id
     ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -22,87 +22,106 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
index 136f460..3faf452 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -19,92 +19,112 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
index 7ea0932..6f085fc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -19,96 +19,117 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
index 2fa4b09..460fb11 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [len]
     :
-    Variable [ Name=lenDBLP ]
+    Variable [ Name=$lenDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -24,102 +24,124 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
index 2fa4b09..460fb11 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [len]
     :
-    Variable [ Name=lenDBLP ]
+    Variable [ Name=$lenDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -24,102 +24,124 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
index 2fa4b09..460fb11 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [len]
     :
-    Variable [ Name=lenDBLP ]
+    Variable [ Name=$lenDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -24,102 +24,124 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
index 2fa4b09..460fb11 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [len]
     :
-    Variable [ Name=lenDBLP ]
+    Variable [ Name=$lenDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -24,102 +24,124 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
index ff63e7d..4a9aac3 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [id]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [len]
     :
-    Variable [ Name=lenDBLP ]
+    Variable [ Name=$lenDBLP ]
   )
   (
     LiteralExpr [STRING] [tokens]
     :
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
   )
 ]
 ]
@@ -24,102 +24,124 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
index b4f1685..7201110 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [left]
     :
-    Variable [ Name=paperLeft ]
+    Variable [ Name=$paperLeft ]
   )
   (
     LiteralExpr [STRING] [right]
     :
-    Variable [ Name=paperRight ]
+    Variable [ Name=$paperRight ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idLeft]
         :
-        Variable [ Name=idLeft ]
+        Variable [ Name=$idLeft ]
       )
       (
         LiteralExpr [STRING] [idRight]
         :
-        Variable [ Name=idRight ]
+        Variable [ Name=$idRight ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperLeft ]
+      Variable [ Name=$paperLeft ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -65,13 +65,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenLeft ]
+      Variable [ Name=$prefixTokenLeft ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperRight ]
+      Variable [ Name=$paperRight ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -86,288 +86,346 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenRight ]
+      Variable [ Name=$prefixTokenRight ]
     ]
-    LetVariable [ Name=lenLeft ]
+    Let Variable [ Name=$lenLeft ]
       :=
       FunctionCall fuzzyjoin.len@1[
         FunctionCall fuzzyjoin.counthashed-word-tokens@1[
           FieldAccessor [
-            Variable [ Name=paperLeft ]
+            Variable [ Name=$paperLeft ]
             Field=title
           ]
         ]
       ]
-    LetVariable [ Name=tokensLeft ]
+    Let Variable [ Name=$tokensLeft ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperLeft ]
+              Variable [ Name=$paperLeft ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenLeft ]
-              Variable [ Name=paperLeft ]
-              Variable [ Name=paperRight ]
-              Variable [ Name=prefixTokenRight ]
-              Variable [ Name=prefixTokenLeft ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenLeft ]
+               AS lenLeft
+              Variable [ Name=$prefixTokenRight ]
+               AS prefixTokenRight
+              Variable [ Name=$paperRight ]
+               AS paperRight
+              Variable [ Name=$prefixTokenLeft ]
+               AS prefixTokenLeft
+              Variable [ Name=$paperLeft ]
+               AS paperLeft
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=lenRight ]
+    Let Variable [ Name=$lenRight ]
       :=
       FunctionCall fuzzyjoin.len@1[
         FunctionCall fuzzyjoin.counthashed-word-tokens@1[
           FieldAccessor [
-            Variable [ Name=paperRight ]
+            Variable [ Name=$paperRight ]
             Field=title
           ]
         ]
       ]
-    LetVariable [ Name=tokensRight ]
+    Let Variable [ Name=$tokensRight ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperRight ]
+              Variable [ Name=$paperRight ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenRight ]
-              Variable [ Name=tokensLeft ]
-              Variable [ Name=lenLeft ]
-              Variable [ Name=paperLeft ]
-              Variable [ Name=paperRight ]
-              Variable [ Name=prefixTokenRight ]
-              Variable [ Name=prefixTokenLeft ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenRight ]
+               AS lenRight
+              Variable [ Name=$tokensLeft ]
+               AS tokensLeft
+              Variable [ Name=$lenLeft ]
+               AS lenLeft
+              Variable [ Name=$prefixTokenRight ]
+               AS prefixTokenRight
+              Variable [ Name=$paperRight ]
+               AS paperRight
+              Variable [ Name=$prefixTokenLeft ]
+               AS prefixTokenLeft
+              Variable [ Name=$paperLeft ]
+               AS paperLeft
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenLeft ]
-        Variable [ Name=tokensLeft ]
-        Variable [ Name=lenRight ]
-        Variable [ Name=tokensRight ]
-        Variable [ Name=prefixTokenLeft ]
+        Variable [ Name=$lenLeft ]
+        Variable [ Name=$tokensLeft ]
+        Variable [ Name=$lenRight ]
+        Variable [ Name=$tokensRight ]
+        Variable [ Name=$prefixTokenLeft ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenLeft ]
+          Variable [ Name=$prefixTokenLeft ]
           =
-          Variable [ Name=prefixTokenRight ]
+          Variable [ Name=$prefixTokenRight ]
         ]
         and
         OperatorExpr [
           OperatorExpr [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             >=
             LiteralExpr [FLOAT] [0.5]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=paperLeft ]
+              Variable [ Name=$paperLeft ]
               Field=id
             ]
             <
             FieldAccessor [
-              Variable [ Name=paperRight ]
+              Variable [ Name=$paperRight ]
               Field=id
             ]
           ]
         ]
       ]
     Groupby
-      Variable [ Name=idLeft ]
+      Variable [ Name=$idLeft ]
       :=
       FieldAccessor [
-        Variable [ Name=paperLeft ]
+        Variable [ Name=$paperLeft ]
         Field=id
       ]
-      Variable [ Name=idRight ]
+      Variable [ Name=$idRight ]
       :=
       FieldAccessor [
-        Variable [ Name=paperRight ]
+        Variable [ Name=$paperRight ]
         Field=id
       ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensRight ]
-      Variable [ Name=lenRight ]
-      Variable [ Name=tokensLeft ]
-      Variable [ Name=lenLeft ]
-      Variable [ Name=paperLeft ]
-      Variable [ Name=paperRight ]
-      Variable [ Name=prefixTokenRight ]
-      Variable [ Name=prefixTokenLeft ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensRight ]
+       AS tokensRight
+      Variable [ Name=$lenRight ]
+       AS lenRight
+      Variable [ Name=$tokensLeft ]
+       AS tokensLeft
+      Variable [ Name=$lenLeft ]
+       AS lenLeft
+      Variable [ Name=$prefixTokenRight ]
+       AS prefixTokenRight
+      Variable [ Name=$paperRight ]
+       AS paperRight
+      Variable [ Name=$prefixTokenLeft ]
+       AS prefixTokenLeft
+      Variable [ Name=$paperLeft ]
+       AS paperLeft
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperLeft ]
+  Variable [ Name=$paperLeft ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperRight ]
+  Variable [ Name=$paperRight ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idLeft
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperLeft ]
+        Variable [ Name=$paperLeft ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idRight
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperRight ]
+        Variable [ Name=$paperRight ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperLeft ]
+    Variable [ Name=$paperLeft ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperRight ]
+    Variable [ Name=$paperRight ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
index b4f1685..7201110 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [left]
     :
-    Variable [ Name=paperLeft ]
+    Variable [ Name=$paperLeft ]
   )
   (
     LiteralExpr [STRING] [right]
     :
-    Variable [ Name=paperRight ]
+    Variable [ Name=$paperRight ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idLeft]
         :
-        Variable [ Name=idLeft ]
+        Variable [ Name=$idLeft ]
       )
       (
         LiteralExpr [STRING] [idRight]
         :
-        Variable [ Name=idRight ]
+        Variable [ Name=$idRight ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperLeft ]
+      Variable [ Name=$paperLeft ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -65,13 +65,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenLeft ]
+      Variable [ Name=$prefixTokenLeft ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperRight ]
+      Variable [ Name=$paperRight ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -86,288 +86,346 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenRight ]
+      Variable [ Name=$prefixTokenRight ]
     ]
-    LetVariable [ Name=lenLeft ]
+    Let Variable [ Name=$lenLeft ]
       :=
       FunctionCall fuzzyjoin.len@1[
         FunctionCall fuzzyjoin.counthashed-word-tokens@1[
           FieldAccessor [
-            Variable [ Name=paperLeft ]
+            Variable [ Name=$paperLeft ]
             Field=title
           ]
         ]
       ]
-    LetVariable [ Name=tokensLeft ]
+    Let Variable [ Name=$tokensLeft ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperLeft ]
+              Variable [ Name=$paperLeft ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenLeft ]
-              Variable [ Name=paperLeft ]
-              Variable [ Name=paperRight ]
-              Variable [ Name=prefixTokenRight ]
-              Variable [ Name=prefixTokenLeft ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenLeft ]
+               AS lenLeft
+              Variable [ Name=$prefixTokenRight ]
+               AS prefixTokenRight
+              Variable [ Name=$paperRight ]
+               AS paperRight
+              Variable [ Name=$prefixTokenLeft ]
+               AS prefixTokenLeft
+              Variable [ Name=$paperLeft ]
+               AS paperLeft
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=lenRight ]
+    Let Variable [ Name=$lenRight ]
       :=
       FunctionCall fuzzyjoin.len@1[
         FunctionCall fuzzyjoin.counthashed-word-tokens@1[
           FieldAccessor [
-            Variable [ Name=paperRight ]
+            Variable [ Name=$paperRight ]
             Field=title
           ]
         ]
       ]
-    LetVariable [ Name=tokensRight ]
+    Let Variable [ Name=$tokensRight ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperRight ]
+              Variable [ Name=$paperRight ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenRight ]
-              Variable [ Name=tokensLeft ]
-              Variable [ Name=lenLeft ]
-              Variable [ Name=paperLeft ]
-              Variable [ Name=paperRight ]
-              Variable [ Name=prefixTokenRight ]
-              Variable [ Name=prefixTokenLeft ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenRight ]
+               AS lenRight
+              Variable [ Name=$tokensLeft ]
+               AS tokensLeft
+              Variable [ Name=$lenLeft ]
+               AS lenLeft
+              Variable [ Name=$prefixTokenRight ]
+               AS prefixTokenRight
+              Variable [ Name=$paperRight ]
+               AS paperRight
+              Variable [ Name=$prefixTokenLeft ]
+               AS prefixTokenLeft
+              Variable [ Name=$paperLeft ]
+               AS paperLeft
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenLeft ]
-        Variable [ Name=tokensLeft ]
-        Variable [ Name=lenRight ]
-        Variable [ Name=tokensRight ]
-        Variable [ Name=prefixTokenLeft ]
+        Variable [ Name=$lenLeft ]
+        Variable [ Name=$tokensLeft ]
+        Variable [ Name=$lenRight ]
+        Variable [ Name=$tokensRight ]
+        Variable [ Name=$prefixTokenLeft ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenLeft ]
+          Variable [ Name=$prefixTokenLeft ]
           =
-          Variable [ Name=prefixTokenRight ]
+          Variable [ Name=$prefixTokenRight ]
         ]
         and
         OperatorExpr [
           OperatorExpr [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             >=
             LiteralExpr [FLOAT] [0.5]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=paperLeft ]
+              Variable [ Name=$paperLeft ]
               Field=id
             ]
             <
             FieldAccessor [
-              Variable [ Name=paperRight ]
+              Variable [ Name=$paperRight ]
               Field=id
             ]
           ]
         ]
       ]
     Groupby
-      Variable [ Name=idLeft ]
+      Variable [ Name=$idLeft ]
       :=
       FieldAccessor [
-        Variable [ Name=paperLeft ]
+        Variable [ Name=$paperLeft ]
         Field=id
       ]
-      Variable [ Name=idRight ]
+      Variable [ Name=$idRight ]
       :=
       FieldAccessor [
-        Variable [ Name=paperRight ]
+        Variable [ Name=$paperRight ]
         Field=id
       ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensRight ]
-      Variable [ Name=lenRight ]
-      Variable [ Name=tokensLeft ]
-      Variable [ Name=lenLeft ]
-      Variable [ Name=paperLeft ]
-      Variable [ Name=paperRight ]
-      Variable [ Name=prefixTokenRight ]
-      Variable [ Name=prefixTokenLeft ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensRight ]
+       AS tokensRight
+      Variable [ Name=$lenRight ]
+       AS lenRight
+      Variable [ Name=$tokensLeft ]
+       AS tokensLeft
+      Variable [ Name=$lenLeft ]
+       AS lenLeft
+      Variable [ Name=$prefixTokenRight ]
+       AS prefixTokenRight
+      Variable [ Name=$paperRight ]
+       AS paperRight
+      Variable [ Name=$prefixTokenLeft ]
+       AS prefixTokenLeft
+      Variable [ Name=$paperLeft ]
+       AS paperLeft
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperLeft ]
+  Variable [ Name=$paperLeft ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperRight ]
+  Variable [ Name=$paperRight ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idLeft
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperLeft ]
+        Variable [ Name=$paperLeft ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idRight
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperRight ]
+        Variable [ Name=$paperRight ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperLeft ]
+    Variable [ Name=$paperLeft ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperRight ]
+    Variable [ Name=$paperRight ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
index 2fb2585..77b36ad 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [left]
     :
-    Variable [ Name=paperLeft ]
+    Variable [ Name=$paperLeft ]
   )
   (
     LiteralExpr [STRING] [right]
     :
-    Variable [ Name=paperRight ]
+    Variable [ Name=$paperRight ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -27,13 +27,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperLeft ]
+  Variable [ Name=$paperLeft ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperRight ]
+  Variable [ Name=$paperRight ]
 ,
   (
     SELECT ELEMENT [
@@ -41,18 +41,18 @@
       (
         LiteralExpr [STRING] [idLeft]
         :
-        Variable [ Name=idLeft ]
+        Variable [ Name=$idLeft ]
       )
       (
         LiteralExpr [STRING] [idRight]
         :
-        Variable [ Name=idRight ]
+        Variable [ Name=$idRight ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -62,7 +62,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperLeft ]
+      Variable [ Name=$paperLeft ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -77,13 +77,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenLeft ]
+      Variable [ Name=$prefixTokenLeft ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperRight ]
+      Variable [ Name=$paperRight ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -98,276 +98,334 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenRight ]
+      Variable [ Name=$prefixTokenRight ]
     ]
-    LetVariable [ Name=lenLeft ]
+    Let Variable [ Name=$lenLeft ]
       :=
       FunctionCall fuzzyjoin.len@1[
         FunctionCall fuzzyjoin.counthashed-word-tokens@1[
           FieldAccessor [
-            Variable [ Name=paperLeft ]
+            Variable [ Name=$paperLeft ]
             Field=title
           ]
         ]
       ]
-    LetVariable [ Name=tokensLeft ]
+    Let Variable [ Name=$tokensLeft ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperLeft ]
+              Variable [ Name=$paperLeft ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenLeft ]
-              Variable [ Name=paperLeft ]
-              Variable [ Name=paperRight ]
-              Variable [ Name=prefixTokenRight ]
-              Variable [ Name=prefixTokenLeft ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenLeft ]
+               AS lenLeft
+              Variable [ Name=$prefixTokenRight ]
+               AS prefixTokenRight
+              Variable [ Name=$paperRight ]
+               AS paperRight
+              Variable [ Name=$prefixTokenLeft ]
+               AS prefixTokenLeft
+              Variable [ Name=$paperLeft ]
+               AS paperLeft
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=lenRight ]
+    Let Variable [ Name=$lenRight ]
       :=
       FunctionCall fuzzyjoin.len@1[
         FunctionCall fuzzyjoin.counthashed-word-tokens@1[
           FieldAccessor [
-            Variable [ Name=paperRight ]
+            Variable [ Name=$paperRight ]
             Field=title
           ]
         ]
       ]
-    LetVariable [ Name=tokensRight ]
+    Let Variable [ Name=$tokensRight ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperRight ]
+              Variable [ Name=$paperRight ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenRight ]
-              Variable [ Name=tokensLeft ]
-              Variable [ Name=lenLeft ]
-              Variable [ Name=paperLeft ]
-              Variable [ Name=paperRight ]
-              Variable [ Name=prefixTokenRight ]
-              Variable [ Name=prefixTokenLeft ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenRight ]
+               AS lenRight
+              Variable [ Name=$tokensLeft ]
+               AS tokensLeft
+              Variable [ Name=$lenLeft ]
+               AS lenLeft
+              Variable [ Name=$prefixTokenRight ]
+               AS prefixTokenRight
+              Variable [ Name=$paperRight ]
+               AS paperRight
+              Variable [ Name=$prefixTokenLeft ]
+               AS prefixTokenLeft
+              Variable [ Name=$paperLeft ]
+               AS paperLeft
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenLeft ]
-        Variable [ Name=tokensLeft ]
-        Variable [ Name=lenRight ]
-        Variable [ Name=tokensRight ]
-        Variable [ Name=prefixTokenLeft ]
+        Variable [ Name=$lenLeft ]
+        Variable [ Name=$tokensLeft ]
+        Variable [ Name=$lenRight ]
+        Variable [ Name=$tokensRight ]
+        Variable [ Name=$prefixTokenLeft ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenLeft ]
+          Variable [ Name=$prefixTokenLeft ]
           =
-          Variable [ Name=prefixTokenRight ]
+          Variable [ Name=$prefixTokenRight ]
         ]
         and
         OperatorExpr [
           OperatorExpr [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             >=
             LiteralExpr [FLOAT] [0.5]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=paperLeft ]
+              Variable [ Name=$paperLeft ]
               Field=id
             ]
             <
             FieldAccessor [
-              Variable [ Name=paperRight ]
+              Variable [ Name=$paperRight ]
               Field=id
             ]
           ]
         ]
       ]
     Groupby
-      Variable [ Name=idLeft ]
+      Variable [ Name=$idLeft ]
       :=
       FieldAccessor [
-        Variable [ Name=paperLeft ]
+        Variable [ Name=$paperLeft ]
         Field=id
       ]
-      Variable [ Name=idRight ]
+      Variable [ Name=$idRight ]
       :=
       FieldAccessor [
-        Variable [ Name=paperRight ]
+        Variable [ Name=$paperRight ]
         Field=id
       ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensRight ]
-      Variable [ Name=lenRight ]
-      Variable [ Name=tokensLeft ]
-      Variable [ Name=lenLeft ]
-      Variable [ Name=paperLeft ]
-      Variable [ Name=paperRight ]
-      Variable [ Name=prefixTokenRight ]
-      Variable [ Name=prefixTokenLeft ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensRight ]
+       AS tokensRight
+      Variable [ Name=$lenRight ]
+       AS lenRight
+      Variable [ Name=$tokensLeft ]
+       AS tokensLeft
+      Variable [ Name=$lenLeft ]
+       AS lenLeft
+      Variable [ Name=$prefixTokenRight ]
+       AS prefixTokenRight
+      Variable [ Name=$paperRight ]
+       AS paperRight
+      Variable [ Name=$prefixTokenLeft ]
+       AS prefixTokenLeft
+      Variable [ Name=$paperLeft ]
+       AS paperLeft
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idLeft
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperLeft ]
+        Variable [ Name=$paperLeft ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idRight
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperRight ]
+        Variable [ Name=$paperRight ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperLeft ]
+    Variable [ Name=$paperLeft ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperRight ]
+    Variable [ Name=$paperRight ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-aqlplus_1/dblp-aqlplus_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-aqlplus_1/dblp-aqlplus_1.3.ast
index e37e938..22d651f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-aqlplus_1/dblp-aqlplus_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-aqlplus_1/dblp-aqlplus_1.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
   )
   (
     LiteralExpr [STRING] [dblp2]
     :
-    Variable [ Name=dblp2 ]
+    Variable [ Name=$dblp2 ]
   )
 ]
 ]
@@ -19,27 +19,27 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=dblp ]
+  Variable [ Name=$dblp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=dblp2 ]
+  Variable [ Name=$dblp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall fuzzyjoin.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=dblp ]
+          Variable [ Name=$dblp ]
           Field=title
         ]
       ]
       ~=
       FunctionCall fuzzyjoin.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=dblp2 ]
+          Variable [ Name=$dblp2 ]
           Field=title
         ]
       ]
@@ -47,24 +47,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=dblp ]
+        Variable [ Name=$dblp ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=dblp2 ]
+        Variable [ Name=$dblp2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dblp2 ]
+    Variable [ Name=$dblp2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-aqlplus_2/dblp-aqlplus_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-aqlplus_2/dblp-aqlplus_2.3.ast
index 21dc41f..cc6eb88 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-aqlplus_2/dblp-aqlplus_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-aqlplus_2/dblp-aqlplus_2.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
   )
   (
     LiteralExpr [STRING] [dblp2]
     :
-    Variable [ Name=dblp2 ]
+    Variable [ Name=$dblp2 ]
   )
 ]
 ]
@@ -19,48 +19,48 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=dblp ]
+  Variable [ Name=$dblp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=dblp2 ]
+  Variable [ Name=$dblp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=dblp ]
+        Variable [ Name=$dblp ]
         Field=title
       ]
       ~=
       FieldAccessor [
-        Variable [ Name=dblp2 ]
+        Variable [ Name=$dblp2 ]
         Field=title
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=dblp ]
+        Variable [ Name=$dblp ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=dblp2 ]
+        Variable [ Name=$dblp2 ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dblp2 ]
+    Variable [ Name=$dblp2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
index 8f15de3..4936e10 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -44,13 +44,13 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -67,219 +67,272 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=paper ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=paper
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#3 ]
+          (
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=paper ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=paper
+              ]
+              ]
+              FROM [                Variable [ Name=#3 ]
+                AS
+                Variable [ Name=#4 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
     FunctionCall fuzzyjoin.len@1[
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
     ]
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
     FunctionCall fuzzyjoin.len@1[
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
     ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$tokensCSX ]
+    Variable [ Name=$prefixTokenDBLP ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
       =
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
     and
     OperatorExpr [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-  Variable [ Name=sim ]
+  Variable [ Name=$sim ]
   :=
-  Variable [ Name=sim ]
-  With
-  Variable [ Name=sim ]
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$sim ]
+  GROUP AS
+  Variable [ Name=#5 ]
+  (
+  Variable [ Name=$sim ]
+   AS sim
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
index e6786e2..4093d2a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -44,13 +44,13 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -67,233 +67,288 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#3 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#3 ]
+                AS
+                Variable [ Name=#4 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
     FunctionCall fuzzyjoin.len@1[
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
     ]
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
     FunctionCall fuzzyjoin.len@1[
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
     ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$tokensCSX ]
+    Variable [ Name=$prefixTokenDBLP ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
       =
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
     and
     OperatorExpr [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-  Variable [ Name=sim ]
+  Variable [ Name=$sim ]
   :=
-  Variable [ Name=sim ]
-  With
-  Variable [ Name=sim ]
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$sim ]
+  GROUP AS
+  Variable [ Name=#5 ]
+  (
+  Variable [ Name=$sim ]
+   AS sim
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
index 90cb49f..1276294 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -44,13 +44,13 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -67,244 +67,304 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=idCSX ]
+Let Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#3 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#3 ]
+                AS
+                Variable [ Name=#4 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
     FunctionCall fuzzyjoin.len@1[
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
     ]
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
     FunctionCall fuzzyjoin.len@1[
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
     ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$tokensCSX ]
+    Variable [ Name=$prefixTokenDBLP ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
       =
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
     and
     OperatorExpr [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
-  Variable [ Name=idDBLP ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idDBLP ]
+  Variable [ Name=$idCSX ]
   :=
-  Variable [ Name=idCSX ]
-  Variable [ Name=sim ]
+  Variable [ Name=$idCSX ]
+  Variable [ Name=$sim ]
   :=
-  Variable [ Name=sim ]
-  With
-  Variable [ Name=sim ]
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=idDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$sim ]
+  GROUP AS
+  Variable [ Name=#5 ]
+  (
+  Variable [ Name=$sim ]
+   AS sim
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$idDBLP ]
+   AS idDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
index 037d123..5358e91 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -44,13 +44,13 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -67,245 +67,310 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=idCSX ]
+Let Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedCSX ]
+Let Variable [ Name=$tokensUnrankedCSX ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=title
     ]
   ]
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedCSX ]
+    FROM [      Variable [ Name=$tokensUnrankedCSX ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#3 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#3 ]
+                AS
+                Variable [ Name=#4 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
     FunctionCall fuzzyjoin.len@1[
-      Variable [ Name=tokensUnrankedDBLP ]
+      Variable [ Name=$tokensUnrankedDBLP ]
     ]
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
     FunctionCall fuzzyjoin.len@1[
-      Variable [ Name=tokensUnrankedCSX ]
+      Variable [ Name=$tokensUnrankedCSX ]
     ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$tokensCSX ]
+    Variable [ Name=$prefixTokenDBLP ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
       =
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
     and
     OperatorExpr [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
-  Variable [ Name=idDBLP ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idDBLP ]
+  Variable [ Name=$idCSX ]
   :=
-  Variable [ Name=idCSX ]
-  Variable [ Name=sim ]
+  Variable [ Name=$idCSX ]
+  Variable [ Name=$sim ]
   :=
-  Variable [ Name=sim ]
-  With
-  Variable [ Name=sim ]
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=tokensUnrankedCSX ]
-  Variable [ Name=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=tokensUnrankedDBLP ]
-  Variable [ Name=idDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$sim ]
+  GROUP AS
+  Variable [ Name=#5 ]
+  (
+  Variable [ Name=$sim ]
+   AS sim
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$tokensUnrankedCSX ]
+   AS tokensUnrankedCSX
+  Variable [ Name=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$tokensUnrankedDBLP ]
+   AS tokensUnrankedDBLP
+  Variable [ Name=$idDBLP ]
+   AS idDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
index ed1f277..c925dea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -44,13 +44,13 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -67,253 +67,323 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=idCSX ]
+Let Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedCSX ]
+Let Variable [ Name=$tokensUnrankedCSX ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenCSX ]
+Let Variable [ Name=$lenCSX ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedCSX ]
+    Variable [ Name=$tokensUnrankedCSX ]
   ]
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedCSX ]
+    FROM [      Variable [ Name=$tokensUnrankedCSX ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenCSX ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#3 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenCSX ]
+           AS lenCSX
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#3 ]
+                AS
+                Variable [ Name=#4 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-    Variable [ Name=lenDBLP ]
-    Variable [ Name=tokensDBLP ]
-    Variable [ Name=lenCSX ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$lenDBLP ]
+    Variable [ Name=$tokensDBLP ]
+    Variable [ Name=$lenCSX ]
+    Variable [ Name=$tokensCSX ]
+    Variable [ Name=$prefixTokenDBLP ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
       =
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
     and
     OperatorExpr [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
-  Variable [ Name=idDBLP ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idDBLP ]
+  Variable [ Name=$idCSX ]
   :=
-  Variable [ Name=idCSX ]
-  With
-  Variable [ Name=sim ]
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=lenCSX ]
-  Variable [ Name=tokensUnrankedCSX ]
-  Variable [ Name=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=lenDBLP ]
-  Variable [ Name=tokensUnrankedDBLP ]
-  Variable [ Name=idDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$idCSX ]
+  GROUP AS
+  Variable [ Name=#5 ]
+  (
+  Variable [ Name=$sim ]
+   AS sim
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$lenCSX ]
+   AS lenCSX
+  Variable [ Name=$tokensUnrankedCSX ]
+   AS tokensUnrankedCSX
+  Variable [ Name=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$lenDBLP ]
+   AS lenDBLP
+  Variable [ Name=$tokensUnrankedDBLP ]
+   AS tokensUnrankedDBLP
+  Variable [ Name=$idDBLP ]
+   AS idDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
index ed1f277..c925dea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -44,13 +44,13 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -67,253 +67,323 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=idCSX ]
+Let Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedCSX ]
+Let Variable [ Name=$tokensUnrankedCSX ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenCSX ]
+Let Variable [ Name=$lenCSX ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedCSX ]
+    Variable [ Name=$tokensUnrankedCSX ]
   ]
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedCSX ]
+    FROM [      Variable [ Name=$tokensUnrankedCSX ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenCSX ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#3 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenCSX ]
+           AS lenCSX
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#3 ]
+                AS
+                Variable [ Name=#4 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-    Variable [ Name=lenDBLP ]
-    Variable [ Name=tokensDBLP ]
-    Variable [ Name=lenCSX ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$lenDBLP ]
+    Variable [ Name=$tokensDBLP ]
+    Variable [ Name=$lenCSX ]
+    Variable [ Name=$tokensCSX ]
+    Variable [ Name=$prefixTokenDBLP ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
       =
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
     and
     OperatorExpr [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
-  Variable [ Name=idDBLP ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idDBLP ]
+  Variable [ Name=$idCSX ]
   :=
-  Variable [ Name=idCSX ]
-  With
-  Variable [ Name=sim ]
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=lenCSX ]
-  Variable [ Name=tokensUnrankedCSX ]
-  Variable [ Name=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=lenDBLP ]
-  Variable [ Name=tokensUnrankedDBLP ]
-  Variable [ Name=idDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$idCSX ]
+  GROUP AS
+  Variable [ Name=#5 ]
+  (
+  Variable [ Name=$sim ]
+   AS sim
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$lenCSX ]
+   AS lenCSX
+  Variable [ Name=$tokensUnrankedCSX ]
+   AS tokensUnrankedCSX
+  Variable [ Name=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$lenDBLP ]
+   AS lenDBLP
+  Variable [ Name=$tokensUnrankedDBLP ]
+   AS tokensUnrankedDBLP
+  Variable [ Name=$idDBLP ]
+   AS idDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
index 5844826..8ddc7b1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -44,13 +44,13 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -67,256 +67,326 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=idCSX ]
+Let Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedCSX ]
+Let Variable [ Name=$tokensUnrankedCSX ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenCSX ]
+Let Variable [ Name=$lenCSX ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedCSX ]
+    Variable [ Name=$tokensUnrankedCSX ]
   ]
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedCSX ]
+    FROM [      Variable [ Name=$tokensUnrankedCSX ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenCSX ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#3 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenCSX ]
+           AS lenCSX
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#3 ]
+                AS
+                Variable [ Name=#4 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-    Variable [ Name=lenDBLP ]
-    Variable [ Name=tokensDBLP ]
-    Variable [ Name=lenCSX ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$lenDBLP ]
+    Variable [ Name=$tokensDBLP ]
+    Variable [ Name=$lenCSX ]
+    Variable [ Name=$tokensCSX ]
+    Variable [ Name=$prefixTokenDBLP ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
       =
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
     and
     OperatorExpr [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
-  Variable [ Name=idDBLP ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idDBLP ]
+  Variable [ Name=$idCSX ]
   :=
-  Variable [ Name=idCSX ]
-  Variable [ Name=sim ]
+  Variable [ Name=$idCSX ]
+  Variable [ Name=$sim ]
   :=
-  Variable [ Name=sim ]
-  With
-  Variable [ Name=sim ]
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=lenCSX ]
-  Variable [ Name=tokensUnrankedCSX ]
-  Variable [ Name=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=lenDBLP ]
-  Variable [ Name=tokensUnrankedDBLP ]
-  Variable [ Name=idDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$sim ]
+  GROUP AS
+  Variable [ Name=#5 ]
+  (
+  Variable [ Name=$sim ]
+   AS sim
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$lenCSX ]
+   AS lenCSX
+  Variable [ Name=$tokensUnrankedCSX ]
+   AS tokensUnrankedCSX
+  Variable [ Name=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$lenDBLP ]
+   AS lenDBLP
+  Variable [ Name=$tokensUnrankedDBLP ]
+   AS tokensUnrankedDBLP
+  Variable [ Name=$idDBLP ]
+   AS idDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
index ed1f277..c925dea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -44,13 +44,13 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -67,253 +67,323 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=idCSX ]
+Let Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedCSX ]
+Let Variable [ Name=$tokensUnrankedCSX ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenCSX ]
+Let Variable [ Name=$lenCSX ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedCSX ]
+    Variable [ Name=$tokensUnrankedCSX ]
   ]
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedCSX ]
+    FROM [      Variable [ Name=$tokensUnrankedCSX ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGrouped ]
+        Variable [ Name=$tokenGrouped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenCSX ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#3 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenCSX ]
+           AS lenCSX
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#3 ]
+                AS
+                Variable [ Name=#4 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGrouped ]
+          Variable [ Name=$tokenGrouped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-    Variable [ Name=lenDBLP ]
-    Variable [ Name=tokensDBLP ]
-    Variable [ Name=lenCSX ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$lenDBLP ]
+    Variable [ Name=$tokensDBLP ]
+    Variable [ Name=$lenCSX ]
+    Variable [ Name=$tokensCSX ]
+    Variable [ Name=$prefixTokenDBLP ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
       =
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
     and
     OperatorExpr [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
-  Variable [ Name=idDBLP ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idDBLP ]
+  Variable [ Name=$idCSX ]
   :=
-  Variable [ Name=idCSX ]
-  With
-  Variable [ Name=sim ]
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=lenCSX ]
-  Variable [ Name=tokensUnrankedCSX ]
-  Variable [ Name=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=lenDBLP ]
-  Variable [ Name=tokensUnrankedDBLP ]
-  Variable [ Name=idDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$idCSX ]
+  GROUP AS
+  Variable [ Name=#5 ]
+  (
+  Variable [ Name=$sim ]
+   AS sim
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$lenCSX ]
+   AS lenCSX
+  Variable [ Name=$tokensUnrankedCSX ]
+   AS tokensUnrankedCSX
+  Variable [ Name=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$lenDBLP ]
+   AS lenDBLP
+  Variable [ Name=$tokensUnrankedDBLP ]
+   AS tokensUnrankedDBLP
+  Variable [ Name=$idDBLP ]
+   AS idDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
index 5844826..8ddc7b1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [idDBLP]
     :
-    Variable [ Name=idDBLP ]
+    Variable [ Name=$idDBLP ]
   )
   (
     LiteralExpr [STRING] [idCSX]
     :
-    Variable [ Name=idCSX ]
+    Variable [ Name=$idCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       Index:       LiteralExpr [LONG] [0]
     ]
   )
@@ -27,7 +27,7 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -44,13 +44,13 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenDBLP ]
+  Variable [ Name=$prefixTokenDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
     FunctionCall Metadata.dataset@1[
@@ -67,256 +67,326 @@
     ]
   ]
   AS
-  Variable [ Name=prefixTokenCSX ]
+  Variable [ Name=$prefixTokenCSX ]
 ]
-LetVariable [ Name=idDBLP ]
+Let Variable [ Name=$idDBLP ]
   :=
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedDBLP ]
+Let Variable [ Name=$tokensUnrankedDBLP ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenDBLP ]
+Let Variable [ Name=$lenDBLP ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedDBLP ]
+    Variable [ Name=$tokensUnrankedDBLP ]
   ]
-LetVariable [ Name=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedDBLP ]
+    FROM [      Variable [ Name=$tokensUnrankedDBLP ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=idCSX ]
+Let Variable [ Name=$idCSX ]
   :=
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
-LetVariable [ Name=tokensUnrankedCSX ]
+Let Variable [ Name=$tokensUnrankedCSX ]
   :=
   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=title
     ]
   ]
-LetVariable [ Name=lenCSX ]
+Let Variable [ Name=$lenCSX ]
   :=
   FunctionCall fuzzyjoin.len@1[
-    Variable [ Name=tokensUnrankedCSX ]
+    Variable [ Name=$tokensUnrankedCSX ]
   ]
-LetVariable [ Name=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=tokensUnrankedCSX ]
+    FROM [      Variable [ Name=$tokensUnrankedCSX ]
       AS
-      Variable [ Name=tokenUnranked ]
+      Variable [ Name=$tokenUnranked ]
 ,
       (
         SELECT ELEMENT [
-        Variable [ Name=tokenGroupped ]
+        Variable [ Name=$tokenGroupped ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
 ,
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=token ]
+          Variable [ Name=$token ]
         ]
-        LetVariable [ Name=id ]
+        Let Variable [ Name=$id ]
           :=
           FieldAccessor [
-            Variable [ Name=paper ]
+            Variable [ Name=$paper ]
             Field=id
           ]
         Groupby
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           :=
-          Variable [ Name=token ]
-          With
-          Variable [ Name=id ]
-          Variable [ Name=paper ]
-          Variable [ Name=token ]
-          Variable [ Name=tokenUnranked ]
-          Variable [ Name=lenCSX ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$token ]
+          GROUP AS
+          Variable [ Name=#3 ]
+          (
+          Variable [ Name=$id ]
+           AS id
+          Variable [ Name=$token ]
+           AS token
+          Variable [ Name=$paper ]
+           AS paper
+          Variable [ Name=$tokenUnranked ]
+           AS tokenUnranked
+          Variable [ Name=$lenCSX ]
+           AS lenCSX
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
         Orderby
           FunctionCall fuzzyjoin.count@1[
-            Variable [ Name=id ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=id
+              ]
+              ]
+              FROM [                Variable [ Name=#3 ]
+                AS
+                Variable [ Name=#4 ]
+              ]
+            )
           ]
           ASC
-          Variable [ Name=tokenGroupped ]
+          Variable [ Name=$tokenGroupped ]
           ASC
 
       )
       AS
-      Variable [ Name=tokenRanked ]
+      Variable [ Name=$tokenRanked ]
       AT
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=tokenUnranked ]
+        Variable [ Name=$tokenUnranked ]
         =
-        Variable [ Name=tokenRanked ]
+        Variable [ Name=$tokenRanked ]
       ]
     Orderby
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       ASC
 
   )
-LetVariable [ Name=sim ]
+Let Variable [ Name=$sim ]
   :=
   FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-    Variable [ Name=lenDBLP ]
-    Variable [ Name=tokensDBLP ]
-    Variable [ Name=lenCSX ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    Variable [ Name=$lenDBLP ]
+    Variable [ Name=$tokensDBLP ]
+    Variable [ Name=$lenCSX ]
+    Variable [ Name=$tokensCSX ]
+    Variable [ Name=$prefixTokenDBLP ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
       =
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
     and
     OperatorExpr [
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 Groupby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   :=
-  Variable [ Name=idDBLP ]
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idDBLP ]
+  Variable [ Name=$idCSX ]
   :=
-  Variable [ Name=idCSX ]
-  Variable [ Name=sim ]
+  Variable [ Name=$idCSX ]
+  Variable [ Name=$sim ]
   :=
-  Variable [ Name=sim ]
-  With
-  Variable [ Name=sim ]
-  Variable [ Name=tokensCSX ]
-  Variable [ Name=lenCSX ]
-  Variable [ Name=tokensUnrankedCSX ]
-  Variable [ Name=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  Variable [ Name=lenDBLP ]
-  Variable [ Name=tokensUnrankedDBLP ]
-  Variable [ Name=idDBLP ]
-  Variable [ Name=paperDBLP ]
-  Variable [ Name=prefixTokenDBLP ]
-  Variable [ Name=prefixTokenCSX ]
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$sim ]
+  GROUP AS
+  Variable [ Name=#5 ]
+  (
+  Variable [ Name=$sim ]
+   AS sim
+  Variable [ Name=$tokensCSX ]
+   AS tokensCSX
+  Variable [ Name=$lenCSX ]
+   AS lenCSX
+  Variable [ Name=$tokensUnrankedCSX ]
+   AS tokensUnrankedCSX
+  Variable [ Name=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  Variable [ Name=$lenDBLP ]
+   AS lenDBLP
+  Variable [ Name=$tokensUnrankedDBLP ]
+   AS tokensUnrankedDBLP
+  Variable [ Name=$idDBLP ]
+   AS idDBLP
+  Variable [ Name=$prefixTokenCSX ]
+   AS prefixTokenCSX
+  Variable [ Name=$paperCSX ]
+   AS paperCSX
+  Variable [ Name=$prefixTokenDBLP ]
+   AS prefixTokenDBLP
+  Variable [ Name=$paperDBLP ]
+   AS paperDBLP
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
index 75fe415..74480b0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,266 +90,319 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=paper ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=paper
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
         FunctionCall fuzzyjoin.len@1[
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
         ]
-        Variable [ Name=tokensDBLP ]
+        Variable [ Name=$tokensDBLP ]
         FunctionCall fuzzyjoin.len@1[
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
         ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       :=
-      Variable [ Name=sim ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$sim ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
index 45ee790..4ee78c2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,280 +90,335 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
         FunctionCall fuzzyjoin.len@1[
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
         ]
-        Variable [ Name=tokensDBLP ]
+        Variable [ Name=$tokensDBLP ]
         FunctionCall fuzzyjoin.len@1[
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
         ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-      Variable [ Name=sim ]
+      Variable [ Name=$sim ]
       :=
-      Variable [ Name=sim ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$sim ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
index 133f403..f22a4e2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,291 +90,351 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
         FunctionCall fuzzyjoin.len@1[
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
         ]
-        Variable [ Name=tokensDBLP ]
+        Variable [ Name=$tokensDBLP ]
         FunctionCall fuzzyjoin.len@1[
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
         ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      Variable [ Name=sim ]
+      Variable [ Name=$idCSX ]
+      Variable [ Name=$sim ]
       :=
-      Variable [ Name=sim ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$sim ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
index 342922b..4e9103a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,292 +90,357 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedDBLP ]
+    Let Variable [ Name=$tokensUnrankedDBLP ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedDBLP ]
+        FROM [          Variable [ Name=$tokensUnrankedDBLP ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedCSX ]
+    Let Variable [ Name=$tokensUnrankedCSX ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedCSX ]
+        FROM [          Variable [ Name=$tokensUnrankedCSX ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=tokensUnrankedCSX ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$tokensUnrankedCSX ]
+               AS tokensUnrankedCSX
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
         FunctionCall fuzzyjoin.len@1[
-          Variable [ Name=tokensUnrankedDBLP ]
+          Variable [ Name=$tokensUnrankedDBLP ]
         ]
-        Variable [ Name=tokensDBLP ]
+        Variable [ Name=$tokensDBLP ]
         FunctionCall fuzzyjoin.len@1[
-          Variable [ Name=tokensUnrankedCSX ]
+          Variable [ Name=$tokensUnrankedCSX ]
         ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      Variable [ Name=sim ]
+      Variable [ Name=$idCSX ]
+      Variable [ Name=$sim ]
       :=
-      Variable [ Name=sim ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=tokensUnrankedCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=tokensUnrankedDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$sim ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$tokensUnrankedCSX ]
+       AS tokensUnrankedCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$tokensUnrankedDBLP ]
+       AS tokensUnrankedDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
index bf53a65..7f6a679 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,300 +90,370 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedDBLP ]
+    Let Variable [ Name=$tokensUnrankedDBLP ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenDBLP ]
+    Let Variable [ Name=$lenDBLP ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedDBLP ]
+        FROM [          Variable [ Name=$tokensUnrankedDBLP ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedCSX ]
+    Let Variable [ Name=$tokensUnrankedCSX ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenCSX ]
+    Let Variable [ Name=$lenCSX ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedCSX ]
+        Variable [ Name=$tokensUnrankedCSX ]
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedCSX ]
+        FROM [          Variable [ Name=$tokensUnrankedCSX ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenCSX ]
-              Variable [ Name=tokensUnrankedCSX ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenCSX ]
+               AS lenCSX
+              Variable [ Name=$tokensUnrankedCSX ]
+               AS tokensUnrankedCSX
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenDBLP ]
-        Variable [ Name=tokensDBLP ]
-        Variable [ Name=lenCSX ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=lenCSX ]
-      Variable [ Name=tokensUnrankedCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=lenDBLP ]
-      Variable [ Name=tokensUnrankedDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$idCSX ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$lenCSX ]
+       AS lenCSX
+      Variable [ Name=$tokensUnrankedCSX ]
+       AS tokensUnrankedCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$lenDBLP ]
+       AS lenDBLP
+      Variable [ Name=$tokensUnrankedDBLP ]
+       AS tokensUnrankedDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
index bf53a65..7f6a679 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,300 +90,370 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedDBLP ]
+    Let Variable [ Name=$tokensUnrankedDBLP ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenDBLP ]
+    Let Variable [ Name=$lenDBLP ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedDBLP ]
+        FROM [          Variable [ Name=$tokensUnrankedDBLP ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedCSX ]
+    Let Variable [ Name=$tokensUnrankedCSX ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenCSX ]
+    Let Variable [ Name=$lenCSX ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedCSX ]
+        Variable [ Name=$tokensUnrankedCSX ]
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedCSX ]
+        FROM [          Variable [ Name=$tokensUnrankedCSX ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenCSX ]
-              Variable [ Name=tokensUnrankedCSX ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenCSX ]
+               AS lenCSX
+              Variable [ Name=$tokensUnrankedCSX ]
+               AS tokensUnrankedCSX
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenDBLP ]
-        Variable [ Name=tokensDBLP ]
-        Variable [ Name=lenCSX ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=lenCSX ]
-      Variable [ Name=tokensUnrankedCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=lenDBLP ]
-      Variable [ Name=tokensUnrankedDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$idCSX ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$lenCSX ]
+       AS lenCSX
+      Variable [ Name=$tokensUnrankedCSX ]
+       AS tokensUnrankedCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$lenDBLP ]
+       AS lenDBLP
+      Variable [ Name=$tokensUnrankedDBLP ]
+       AS tokensUnrankedDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
index bf53a65..7f6a679 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,300 +90,370 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedDBLP ]
+    Let Variable [ Name=$tokensUnrankedDBLP ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenDBLP ]
+    Let Variable [ Name=$lenDBLP ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedDBLP ]
+        FROM [          Variable [ Name=$tokensUnrankedDBLP ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedCSX ]
+    Let Variable [ Name=$tokensUnrankedCSX ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenCSX ]
+    Let Variable [ Name=$lenCSX ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedCSX ]
+        Variable [ Name=$tokensUnrankedCSX ]
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedCSX ]
+        FROM [          Variable [ Name=$tokensUnrankedCSX ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenCSX ]
-              Variable [ Name=tokensUnrankedCSX ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenCSX ]
+               AS lenCSX
+              Variable [ Name=$tokensUnrankedCSX ]
+               AS tokensUnrankedCSX
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenDBLP ]
-        Variable [ Name=tokensDBLP ]
-        Variable [ Name=lenCSX ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=lenCSX ]
-      Variable [ Name=tokensUnrankedCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=lenDBLP ]
-      Variable [ Name=tokensUnrankedDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$idCSX ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$lenCSX ]
+       AS lenCSX
+      Variable [ Name=$tokensUnrankedCSX ]
+       AS tokensUnrankedCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$lenDBLP ]
+       AS lenDBLP
+      Variable [ Name=$tokensUnrankedDBLP ]
+       AS tokensUnrankedDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
index 7ca0193..4838a20 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,303 +90,373 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedDBLP ]
+    Let Variable [ Name=$tokensUnrankedDBLP ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenDBLP ]
+    Let Variable [ Name=$lenDBLP ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedDBLP ]
+        FROM [          Variable [ Name=$tokensUnrankedDBLP ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedCSX ]
+    Let Variable [ Name=$tokensUnrankedCSX ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenCSX ]
+    Let Variable [ Name=$lenCSX ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedCSX ]
+        Variable [ Name=$tokensUnrankedCSX ]
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedCSX ]
+        FROM [          Variable [ Name=$tokensUnrankedCSX ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenCSX ]
-              Variable [ Name=tokensUnrankedCSX ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenCSX ]
+               AS lenCSX
+              Variable [ Name=$tokensUnrankedCSX ]
+               AS tokensUnrankedCSX
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenDBLP ]
-        Variable [ Name=tokensDBLP ]
-        Variable [ Name=lenCSX ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      Variable [ Name=sim ]
+      Variable [ Name=$idCSX ]
+      Variable [ Name=$sim ]
       :=
-      Variable [ Name=sim ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=lenCSX ]
-      Variable [ Name=tokensUnrankedCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=lenDBLP ]
-      Variable [ Name=tokensUnrankedDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$sim ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$lenCSX ]
+       AS lenCSX
+      Variable [ Name=$tokensUnrankedCSX ]
+       AS tokensUnrankedCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$lenDBLP ]
+       AS lenDBLP
+      Variable [ Name=$tokensUnrankedDBLP ]
+       AS tokensUnrankedDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
index d778b00..3f963eb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
@@ -7,20 +7,20 @@
     LiteralExpr [STRING] [dblp]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=paperDBLP
     ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=sim
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   (
     SELECT ELEMENT [
@@ -39,7 +39,7 @@
         LiteralExpr [STRING] [idDBLP]
         :
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=id
         ]
       )
@@ -47,20 +47,20 @@
         LiteralExpr [STRING] [idCSX]
         :
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=idCSX
         ]
       )
       (
         LiteralExpr [STRING] [paperDBLP]
         :
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=sim
         ]
       )
@@ -70,7 +70,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       (
         SELECT ELEMENT [
@@ -78,18 +78,18 @@
           (
             LiteralExpr [STRING] [idDBLP]
             :
-            Variable [ Name=idDBLP ]
+            Variable [ Name=$idDBLP ]
           )
           (
             LiteralExpr [STRING] [idCSX]
             :
-            Variable [ Name=idCSX ]
+            Variable [ Name=$idCSX ]
           )
           (
             LiteralExpr [STRING] [sim]
             :
             IndexAccessor [
-              Variable [ Name=sim ]
+              Variable [ Name=$sim ]
               Index:               LiteralExpr [LONG] [0]
             ]
           )
@@ -99,7 +99,7 @@
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
             FunctionCall Metadata.dataset@1[
@@ -116,13 +116,13 @@
             ]
           ]
           AS
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [CSX]
           ]
           AS
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
             FunctionCall Metadata.dataset@1[
@@ -139,290 +139,360 @@
             ]
           ]
           AS
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
-        LetVariable [ Name=idDBLP ]
+        Let Variable [ Name=$idDBLP ]
           :=
           FieldAccessor [
-            Variable [ Name=paperDBLP ]
+            Variable [ Name=$paperDBLP ]
             Field=id
           ]
-        LetVariable [ Name=tokensUnrankedDBLP ]
+        Let Variable [ Name=$tokensUnrankedDBLP ]
           :=
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
-        LetVariable [ Name=lenDBLP ]
+        Let Variable [ Name=$lenDBLP ]
           :=
           FunctionCall fuzzyjoin.len@1[
-            Variable [ Name=tokensUnrankedDBLP ]
+            Variable [ Name=$tokensUnrankedDBLP ]
           ]
-        LetVariable [ Name=tokensDBLP ]
+        Let Variable [ Name=$tokensDBLP ]
           :=
           (
             SELECT ELEMENT [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             ]
-            FROM [              Variable [ Name=tokensUnrankedDBLP ]
+            FROM [              Variable [ Name=$tokensUnrankedDBLP ]
               AS
-              Variable [ Name=tokenUnranked ]
+              Variable [ Name=$tokenUnranked ]
 ,
               (
                 SELECT ELEMENT [
-                Variable [ Name=tokenGrouped ]
+                Variable [ Name=$tokenGrouped ]
                 ]
                 FROM [                  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [DBLP]
                   ]
                   AS
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
 ,
                   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                     FieldAccessor [
-                      Variable [ Name=paper ]
+                      Variable [ Name=$paper ]
                       Field=title
                     ]
                   ]
                   AS
-                  Variable [ Name=token ]
+                  Variable [ Name=$token ]
                 ]
-                LetVariable [ Name=id ]
+                Let Variable [ Name=$id ]
                   :=
                   FieldAccessor [
-                    Variable [ Name=paper ]
+                    Variable [ Name=$paper ]
                     Field=id
                   ]
                 Groupby
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   :=
-                  Variable [ Name=token ]
-                  With
-                  Variable [ Name=id ]
-                  Variable [ Name=paper ]
-                  Variable [ Name=token ]
-                  Variable [ Name=tokenUnranked ]
-                  Variable [ Name=lenDBLP ]
-                  Variable [ Name=tokensUnrankedDBLP ]
-                  Variable [ Name=idDBLP ]
-                  Variable [ Name=paperDBLP ]
-                  Variable [ Name=prefixTokenDBLP ]
-                  Variable [ Name=prefixTokenCSX ]
-                  Variable [ Name=paperCSX ]
+                  Variable [ Name=$token ]
+                  GROUP AS
+                  Variable [ Name=#1 ]
+                  (
+                  Variable [ Name=$id ]
+                   AS id
+                  Variable [ Name=$token ]
+                   AS token
+                  Variable [ Name=$paper ]
+                   AS paper
+                  Variable [ Name=$tokenUnranked ]
+                   AS tokenUnranked
+                  Variable [ Name=$lenDBLP ]
+                   AS lenDBLP
+                  Variable [ Name=$tokensUnrankedDBLP ]
+                   AS tokensUnrankedDBLP
+                  Variable [ Name=$idDBLP ]
+                   AS idDBLP
+                  Variable [ Name=$prefixTokenCSX ]
+                   AS prefixTokenCSX
+                  Variable [ Name=$paperCSX ]
+                   AS paperCSX
+                  Variable [ Name=$prefixTokenDBLP ]
+                   AS prefixTokenDBLP
+                  Variable [ Name=$paperDBLP ]
+                   AS paperDBLP
+                  )
 
                 Orderby
                   FunctionCall fuzzyjoin.count@1[
-                    Variable [ Name=id ]
+                    (
+                      SELECT ELEMENT [
+                      FieldAccessor [
+                        Variable [ Name=#2 ]
+                        Field=id
+                      ]
+                      ]
+                      FROM [                        Variable [ Name=#1 ]
+                        AS
+                        Variable [ Name=#2 ]
+                      ]
+                    )
                   ]
                   ASC
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   ASC
 
               )
               AS
-              Variable [ Name=tokenRanked ]
+              Variable [ Name=$tokenRanked ]
               AT
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
             Where
               OperatorExpr [
-                Variable [ Name=tokenUnranked ]
+                Variable [ Name=$tokenUnranked ]
                 =
-                Variable [ Name=tokenRanked ]
+                Variable [ Name=$tokenRanked ]
               ]
             Orderby
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               ASC
 
           )
-        LetVariable [ Name=idCSX ]
+        Let Variable [ Name=$idCSX ]
           :=
           FieldAccessor [
-            Variable [ Name=paperCSX ]
+            Variable [ Name=$paperCSX ]
             Field=id
           ]
-        LetVariable [ Name=tokensUnrankedCSX ]
+        Let Variable [ Name=$tokensUnrankedCSX ]
           :=
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
-        LetVariable [ Name=lenCSX ]
+        Let Variable [ Name=$lenCSX ]
           :=
           FunctionCall fuzzyjoin.len@1[
-            Variable [ Name=tokensUnrankedCSX ]
+            Variable [ Name=$tokensUnrankedCSX ]
           ]
-        LetVariable [ Name=tokensCSX ]
+        Let Variable [ Name=$tokensCSX ]
           :=
           (
             SELECT ELEMENT [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             ]
-            FROM [              Variable [ Name=tokensUnrankedCSX ]
+            FROM [              Variable [ Name=$tokensUnrankedCSX ]
               AS
-              Variable [ Name=tokenUnranked ]
+              Variable [ Name=$tokenUnranked ]
 ,
               (
                 SELECT ELEMENT [
-                Variable [ Name=tokenGrouped ]
+                Variable [ Name=$tokenGrouped ]
                 ]
                 FROM [                  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [DBLP]
                   ]
                   AS
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
 ,
                   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                     FieldAccessor [
-                      Variable [ Name=paper ]
+                      Variable [ Name=$paper ]
                       Field=title
                     ]
                   ]
                   AS
-                  Variable [ Name=token ]
+                  Variable [ Name=$token ]
                 ]
-                LetVariable [ Name=id ]
+                Let Variable [ Name=$id ]
                   :=
                   FieldAccessor [
-                    Variable [ Name=paper ]
+                    Variable [ Name=$paper ]
                     Field=id
                   ]
                 Groupby
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   :=
-                  Variable [ Name=token ]
-                  With
-                  Variable [ Name=id ]
-                  Variable [ Name=paper ]
-                  Variable [ Name=token ]
-                  Variable [ Name=tokenUnranked ]
-                  Variable [ Name=lenCSX ]
-                  Variable [ Name=tokensUnrankedCSX ]
-                  Variable [ Name=idCSX ]
-                  Variable [ Name=tokensDBLP ]
-                  Variable [ Name=lenDBLP ]
-                  Variable [ Name=tokensUnrankedDBLP ]
-                  Variable [ Name=idDBLP ]
-                  Variable [ Name=paperDBLP ]
-                  Variable [ Name=prefixTokenDBLP ]
-                  Variable [ Name=prefixTokenCSX ]
-                  Variable [ Name=paperCSX ]
+                  Variable [ Name=$token ]
+                  GROUP AS
+                  Variable [ Name=#3 ]
+                  (
+                  Variable [ Name=$id ]
+                   AS id
+                  Variable [ Name=$token ]
+                   AS token
+                  Variable [ Name=$paper ]
+                   AS paper
+                  Variable [ Name=$tokenUnranked ]
+                   AS tokenUnranked
+                  Variable [ Name=$lenCSX ]
+                   AS lenCSX
+                  Variable [ Name=$tokensUnrankedCSX ]
+                   AS tokensUnrankedCSX
+                  Variable [ Name=$idCSX ]
+                   AS idCSX
+                  Variable [ Name=$tokensDBLP ]
+                   AS tokensDBLP
+                  Variable [ Name=$lenDBLP ]
+                   AS lenDBLP
+                  Variable [ Name=$tokensUnrankedDBLP ]
+                   AS tokensUnrankedDBLP
+                  Variable [ Name=$idDBLP ]
+                   AS idDBLP
+                  Variable [ Name=$prefixTokenCSX ]
+                   AS prefixTokenCSX
+                  Variable [ Name=$paperCSX ]
+                   AS paperCSX
+                  Variable [ Name=$prefixTokenDBLP ]
+                   AS prefixTokenDBLP
+                  Variable [ Name=$paperDBLP ]
+                   AS paperDBLP
+                  )
 
                 Orderby
                   FunctionCall fuzzyjoin.count@1[
-                    Variable [ Name=id ]
+                    (
+                      SELECT ELEMENT [
+                      FieldAccessor [
+                        Variable [ Name=#4 ]
+                        Field=id
+                      ]
+                      ]
+                      FROM [                        Variable [ Name=#3 ]
+                        AS
+                        Variable [ Name=#4 ]
+                      ]
+                    )
                   ]
                   ASC
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   ASC
 
               )
               AS
-              Variable [ Name=tokenRanked ]
+              Variable [ Name=$tokenRanked ]
               AT
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
             Where
               OperatorExpr [
-                Variable [ Name=tokenUnranked ]
+                Variable [ Name=$tokenUnranked ]
                 =
-                Variable [ Name=tokenRanked ]
+                Variable [ Name=$tokenRanked ]
               ]
             Orderby
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               ASC
 
           )
-        LetVariable [ Name=sim ]
+        Let Variable [ Name=$sim ]
           :=
           FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-            Variable [ Name=lenDBLP ]
-            Variable [ Name=tokensDBLP ]
-            Variable [ Name=lenCSX ]
-            Variable [ Name=tokensCSX ]
-            Variable [ Name=prefixTokenDBLP ]
+            Variable [ Name=$lenDBLP ]
+            Variable [ Name=$tokensDBLP ]
+            Variable [ Name=$lenCSX ]
+            Variable [ Name=$tokensCSX ]
+            Variable [ Name=$prefixTokenDBLP ]
             LiteralExpr [FLOAT] [0.5]
           ]
         Where
           OperatorExpr [
             OperatorExpr [
-              Variable [ Name=prefixTokenDBLP ]
+              Variable [ Name=$prefixTokenDBLP ]
               =
-              Variable [ Name=prefixTokenCSX ]
+              Variable [ Name=$prefixTokenCSX ]
             ]
             and
             OperatorExpr [
-              Variable [ Name=sim ]
+              Variable [ Name=$sim ]
               >=
               LiteralExpr [FLOAT] [0.5]
             ]
           ]
         Groupby
-          Variable [ Name=idDBLP ]
+          Variable [ Name=$idDBLP ]
           :=
-          Variable [ Name=idDBLP ]
-          Variable [ Name=idCSX ]
+          Variable [ Name=$idDBLP ]
+          Variable [ Name=$idCSX ]
           :=
-          Variable [ Name=idCSX ]
-          With
-          Variable [ Name=sim ]
-          Variable [ Name=tokensCSX ]
-          Variable [ Name=lenCSX ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$idCSX ]
+          GROUP AS
+          Variable [ Name=#5 ]
+          (
+          Variable [ Name=$sim ]
+           AS sim
+          Variable [ Name=$tokensCSX ]
+           AS tokensCSX
+          Variable [ Name=$lenCSX ]
+           AS lenCSX
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
       )
       AS
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=idDBLP
         ]
         =
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=id
         ]
       ]
   )
   AS
-  Variable [ Name=paperDBLPridpair ]
+  Variable [ Name=$paperDBLPridpair ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=idCSX
     ]
     =
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLPridpair ]
+    Variable [ Name=$paperDBLPridpair ]
     Field=idDBLP
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperDBLPridpair ]
+    Variable [ Name=$paperDBLPridpair ]
     Field=idCSX
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
index b94b776..a9c8ad6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
@@ -7,20 +7,20 @@
     LiteralExpr [STRING] [dblp]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=paperDBLP
     ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=sim
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   (
     SELECT ELEMENT [
@@ -39,20 +39,20 @@
         LiteralExpr [STRING] [idDBLP]
         :
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=id
         ]
       )
       (
         LiteralExpr [STRING] [paperDBLP]
         :
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=idCSX
         ]
       )
@@ -60,7 +60,7 @@
         LiteralExpr [STRING] [sim]
         :
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=sim
         ]
       )
@@ -70,7 +70,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       (
         SELECT ELEMENT [
@@ -78,18 +78,18 @@
           (
             LiteralExpr [STRING] [idDBLP]
             :
-            Variable [ Name=idDBLP ]
+            Variable [ Name=$idDBLP ]
           )
           (
             LiteralExpr [STRING] [idCSX]
             :
-            Variable [ Name=idCSX ]
+            Variable [ Name=$idCSX ]
           )
           (
             LiteralExpr [STRING] [sim]
             :
             IndexAccessor [
-              Variable [ Name=sim ]
+              Variable [ Name=$sim ]
               Index:               LiteralExpr [LONG] [0]
             ]
           )
@@ -99,7 +99,7 @@
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
             FunctionCall Metadata.dataset@1[
@@ -116,13 +116,13 @@
             ]
           ]
           AS
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [CSX]
           ]
           AS
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
             FunctionCall Metadata.dataset@1[
@@ -139,293 +139,363 @@
             ]
           ]
           AS
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
-        LetVariable [ Name=idDBLP ]
+        Let Variable [ Name=$idDBLP ]
           :=
           FieldAccessor [
-            Variable [ Name=paperDBLP ]
+            Variable [ Name=$paperDBLP ]
             Field=id
           ]
-        LetVariable [ Name=tokensUnrankedDBLP ]
+        Let Variable [ Name=$tokensUnrankedDBLP ]
           :=
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
-        LetVariable [ Name=lenDBLP ]
+        Let Variable [ Name=$lenDBLP ]
           :=
           FunctionCall fuzzyjoin.len@1[
-            Variable [ Name=tokensUnrankedDBLP ]
+            Variable [ Name=$tokensUnrankedDBLP ]
           ]
-        LetVariable [ Name=tokensDBLP ]
+        Let Variable [ Name=$tokensDBLP ]
           :=
           (
             SELECT ELEMENT [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             ]
-            FROM [              Variable [ Name=tokensUnrankedDBLP ]
+            FROM [              Variable [ Name=$tokensUnrankedDBLP ]
               AS
-              Variable [ Name=tokenUnranked ]
+              Variable [ Name=$tokenUnranked ]
 ,
               (
                 SELECT ELEMENT [
-                Variable [ Name=tokenGrouped ]
+                Variable [ Name=$tokenGrouped ]
                 ]
                 FROM [                  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [DBLP]
                   ]
                   AS
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
 ,
                   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                     FieldAccessor [
-                      Variable [ Name=paper ]
+                      Variable [ Name=$paper ]
                       Field=title
                     ]
                   ]
                   AS
-                  Variable [ Name=token ]
+                  Variable [ Name=$token ]
                 ]
-                LetVariable [ Name=id ]
+                Let Variable [ Name=$id ]
                   :=
                   FieldAccessor [
-                    Variable [ Name=paper ]
+                    Variable [ Name=$paper ]
                     Field=id
                   ]
                 Groupby
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   :=
-                  Variable [ Name=token ]
-                  With
-                  Variable [ Name=id ]
-                  Variable [ Name=paper ]
-                  Variable [ Name=token ]
-                  Variable [ Name=tokenUnranked ]
-                  Variable [ Name=lenDBLP ]
-                  Variable [ Name=tokensUnrankedDBLP ]
-                  Variable [ Name=idDBLP ]
-                  Variable [ Name=paperDBLP ]
-                  Variable [ Name=prefixTokenDBLP ]
-                  Variable [ Name=prefixTokenCSX ]
-                  Variable [ Name=paperCSX ]
+                  Variable [ Name=$token ]
+                  GROUP AS
+                  Variable [ Name=#1 ]
+                  (
+                  Variable [ Name=$id ]
+                   AS id
+                  Variable [ Name=$token ]
+                   AS token
+                  Variable [ Name=$paper ]
+                   AS paper
+                  Variable [ Name=$tokenUnranked ]
+                   AS tokenUnranked
+                  Variable [ Name=$lenDBLP ]
+                   AS lenDBLP
+                  Variable [ Name=$tokensUnrankedDBLP ]
+                   AS tokensUnrankedDBLP
+                  Variable [ Name=$idDBLP ]
+                   AS idDBLP
+                  Variable [ Name=$prefixTokenCSX ]
+                   AS prefixTokenCSX
+                  Variable [ Name=$paperCSX ]
+                   AS paperCSX
+                  Variable [ Name=$prefixTokenDBLP ]
+                   AS prefixTokenDBLP
+                  Variable [ Name=$paperDBLP ]
+                   AS paperDBLP
+                  )
 
                 Orderby
                   FunctionCall fuzzyjoin.count@1[
-                    Variable [ Name=id ]
+                    (
+                      SELECT ELEMENT [
+                      FieldAccessor [
+                        Variable [ Name=#2 ]
+                        Field=id
+                      ]
+                      ]
+                      FROM [                        Variable [ Name=#1 ]
+                        AS
+                        Variable [ Name=#2 ]
+                      ]
+                    )
                   ]
                   ASC
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   ASC
 
               )
               AS
-              Variable [ Name=tokenRanked ]
+              Variable [ Name=$tokenRanked ]
               AT
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
             Where
               OperatorExpr [
-                Variable [ Name=tokenUnranked ]
+                Variable [ Name=$tokenUnranked ]
                 =
-                Variable [ Name=tokenRanked ]
+                Variable [ Name=$tokenRanked ]
               ]
             Orderby
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               ASC
 
           )
-        LetVariable [ Name=idCSX ]
+        Let Variable [ Name=$idCSX ]
           :=
           FieldAccessor [
-            Variable [ Name=paperCSX ]
+            Variable [ Name=$paperCSX ]
             Field=id
           ]
-        LetVariable [ Name=tokensUnrankedCSX ]
+        Let Variable [ Name=$tokensUnrankedCSX ]
           :=
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
-        LetVariable [ Name=lenCSX ]
+        Let Variable [ Name=$lenCSX ]
           :=
           FunctionCall fuzzyjoin.len@1[
-            Variable [ Name=tokensUnrankedCSX ]
+            Variable [ Name=$tokensUnrankedCSX ]
           ]
-        LetVariable [ Name=tokensCSX ]
+        Let Variable [ Name=$tokensCSX ]
           :=
           (
             SELECT ELEMENT [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             ]
-            FROM [              Variable [ Name=tokensUnrankedCSX ]
+            FROM [              Variable [ Name=$tokensUnrankedCSX ]
               AS
-              Variable [ Name=tokenUnranked ]
+              Variable [ Name=$tokenUnranked ]
 ,
               (
                 SELECT ELEMENT [
-                Variable [ Name=tokenGrouped ]
+                Variable [ Name=$tokenGrouped ]
                 ]
                 FROM [                  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [DBLP]
                   ]
                   AS
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
 ,
                   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                     FieldAccessor [
-                      Variable [ Name=paper ]
+                      Variable [ Name=$paper ]
                       Field=title
                     ]
                   ]
                   AS
-                  Variable [ Name=token ]
+                  Variable [ Name=$token ]
                 ]
-                LetVariable [ Name=id ]
+                Let Variable [ Name=$id ]
                   :=
                   FieldAccessor [
-                    Variable [ Name=paper ]
+                    Variable [ Name=$paper ]
                     Field=id
                   ]
                 Groupby
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   :=
-                  Variable [ Name=token ]
-                  With
-                  Variable [ Name=id ]
-                  Variable [ Name=paper ]
-                  Variable [ Name=token ]
-                  Variable [ Name=tokenUnranked ]
-                  Variable [ Name=lenCSX ]
-                  Variable [ Name=tokensUnrankedCSX ]
-                  Variable [ Name=idCSX ]
-                  Variable [ Name=tokensDBLP ]
-                  Variable [ Name=lenDBLP ]
-                  Variable [ Name=tokensUnrankedDBLP ]
-                  Variable [ Name=idDBLP ]
-                  Variable [ Name=paperDBLP ]
-                  Variable [ Name=prefixTokenDBLP ]
-                  Variable [ Name=prefixTokenCSX ]
-                  Variable [ Name=paperCSX ]
+                  Variable [ Name=$token ]
+                  GROUP AS
+                  Variable [ Name=#3 ]
+                  (
+                  Variable [ Name=$id ]
+                   AS id
+                  Variable [ Name=$token ]
+                   AS token
+                  Variable [ Name=$paper ]
+                   AS paper
+                  Variable [ Name=$tokenUnranked ]
+                   AS tokenUnranked
+                  Variable [ Name=$lenCSX ]
+                   AS lenCSX
+                  Variable [ Name=$tokensUnrankedCSX ]
+                   AS tokensUnrankedCSX
+                  Variable [ Name=$idCSX ]
+                   AS idCSX
+                  Variable [ Name=$tokensDBLP ]
+                   AS tokensDBLP
+                  Variable [ Name=$lenDBLP ]
+                   AS lenDBLP
+                  Variable [ Name=$tokensUnrankedDBLP ]
+                   AS tokensUnrankedDBLP
+                  Variable [ Name=$idDBLP ]
+                   AS idDBLP
+                  Variable [ Name=$prefixTokenCSX ]
+                   AS prefixTokenCSX
+                  Variable [ Name=$paperCSX ]
+                   AS paperCSX
+                  Variable [ Name=$prefixTokenDBLP ]
+                   AS prefixTokenDBLP
+                  Variable [ Name=$paperDBLP ]
+                   AS paperDBLP
+                  )
 
                 Orderby
                   FunctionCall fuzzyjoin.count@1[
-                    Variable [ Name=id ]
+                    (
+                      SELECT ELEMENT [
+                      FieldAccessor [
+                        Variable [ Name=#4 ]
+                        Field=id
+                      ]
+                      ]
+                      FROM [                        Variable [ Name=#3 ]
+                        AS
+                        Variable [ Name=#4 ]
+                      ]
+                    )
                   ]
                   ASC
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   ASC
 
               )
               AS
-              Variable [ Name=tokenRanked ]
+              Variable [ Name=$tokenRanked ]
               AT
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
             Where
               OperatorExpr [
-                Variable [ Name=tokenUnranked ]
+                Variable [ Name=$tokenUnranked ]
                 =
-                Variable [ Name=tokenRanked ]
+                Variable [ Name=$tokenRanked ]
               ]
             Orderby
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               ASC
 
           )
-        LetVariable [ Name=sim ]
+        Let Variable [ Name=$sim ]
           :=
           FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-            Variable [ Name=lenDBLP ]
-            Variable [ Name=tokensDBLP ]
-            Variable [ Name=lenCSX ]
-            Variable [ Name=tokensCSX ]
-            Variable [ Name=prefixTokenDBLP ]
+            Variable [ Name=$lenDBLP ]
+            Variable [ Name=$tokensDBLP ]
+            Variable [ Name=$lenCSX ]
+            Variable [ Name=$tokensCSX ]
+            Variable [ Name=$prefixTokenDBLP ]
             LiteralExpr [FLOAT] [0.5]
           ]
         Where
           OperatorExpr [
             OperatorExpr [
-              Variable [ Name=prefixTokenDBLP ]
+              Variable [ Name=$prefixTokenDBLP ]
               =
-              Variable [ Name=prefixTokenCSX ]
+              Variable [ Name=$prefixTokenCSX ]
             ]
             and
             OperatorExpr [
-              Variable [ Name=sim ]
+              Variable [ Name=$sim ]
               >=
               LiteralExpr [FLOAT] [0.5]
             ]
           ]
         Groupby
-          Variable [ Name=idDBLP ]
+          Variable [ Name=$idDBLP ]
           :=
-          Variable [ Name=idDBLP ]
-          Variable [ Name=idCSX ]
+          Variable [ Name=$idDBLP ]
+          Variable [ Name=$idCSX ]
           :=
-          Variable [ Name=idCSX ]
-          With
-          Variable [ Name=sim ]
-          Variable [ Name=tokensCSX ]
-          Variable [ Name=lenCSX ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$idCSX ]
+          GROUP AS
+          Variable [ Name=#5 ]
+          (
+          Variable [ Name=$sim ]
+           AS sim
+          Variable [ Name=$tokensCSX ]
+           AS tokensCSX
+          Variable [ Name=$lenCSX ]
+           AS lenCSX
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
       )
       AS
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=idDBLP
         ]
         =
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=id
         ]
       ]
   )
   AS
-  Variable [ Name=paperDBLPridpair ]
+  Variable [ Name=$paperDBLPridpair ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=idCSX
     ]
     =
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=paperDBLP
     ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperDBLPridpair ]
+    Variable [ Name=$paperDBLPridpair ]
     Field=idCSX
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
index 7ca0193..4838a20 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
@@ -6,18 +6,18 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,303 +90,373 @@
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedDBLP ]
+    Let Variable [ Name=$tokensUnrankedDBLP ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenDBLP ]
+    Let Variable [ Name=$lenDBLP ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedDBLP ]
+        FROM [          Variable [ Name=$tokensUnrankedDBLP ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedCSX ]
+    Let Variable [ Name=$tokensUnrankedCSX ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenCSX ]
+    Let Variable [ Name=$lenCSX ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedCSX ]
+        Variable [ Name=$tokensUnrankedCSX ]
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedCSX ]
+        FROM [          Variable [ Name=$tokensUnrankedCSX ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenCSX ]
-              Variable [ Name=tokensUnrankedCSX ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenCSX ]
+               AS lenCSX
+              Variable [ Name=$tokensUnrankedCSX ]
+               AS tokensUnrankedCSX
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenDBLP ]
-        Variable [ Name=tokensDBLP ]
-        Variable [ Name=lenCSX ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      Variable [ Name=sim ]
+      Variable [ Name=$idCSX ]
+      Variable [ Name=$sim ]
       :=
-      Variable [ Name=sim ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=lenCSX ]
-      Variable [ Name=tokensUnrankedCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=lenDBLP ]
-      Variable [ Name=tokensUnrankedDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$sim ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$lenCSX ]
+       AS lenCSX
+      Variable [ Name=$tokensUnrankedCSX ]
+       AS tokensUnrankedCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$lenDBLP ]
+       AS lenDBLP
+      Variable [ Name=$tokensUnrankedDBLP ]
+       AS tokensUnrankedDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_1/dblp-csx-aqlplus_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_1/dblp-csx-aqlplus_1.3.ast
index a9a458c..9db8681 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_1/dblp-csx-aqlplus_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_1/dblp-csx-aqlplus_1.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=j ]
+    Variable [ Name=$j ]
   )
 ]
 ]
@@ -19,38 +19,38 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
 ]
 Where
   OperatorExpr [
     FunctionCall fuzzyjoin.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=title
       ]
     ]
     ~=
     FunctionCall fuzzyjoin.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=j ]
+        Variable [ Name=$j ]
         Field=title
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=j ]
+    Variable [ Name=$j ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_2/dblp-csx-aqlplus_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_2/dblp-csx-aqlplus_2.3.ast
index f77792b..93d2c73 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_2/dblp-csx-aqlplus_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_2/dblp-csx-aqlplus_2.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=csx ]
+    Variable [ Name=$csx ]
   )
 ]
 ]
@@ -19,38 +19,38 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=csx ]
+  Variable [ Name=$csx ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=dblp ]
+  Variable [ Name=$dblp ]
 ]
 Where
   OperatorExpr [
     FunctionCall fuzzyjoin.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=dblp ]
+        Variable [ Name=$dblp ]
         Field=title
       ]
     ]
     ~=
     FunctionCall fuzzyjoin.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=csx ]
+        Variable [ Name=$csx ]
         Field=title
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=csx ]
+    Variable [ Name=$csx ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_3/dblp-csx-aqlplus_3.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_3/dblp-csx-aqlplus_3.3.ast
index f9a8e32..7c9153c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_3/dblp-csx-aqlplus_3.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-aqlplus_3/dblp-csx-aqlplus_3.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=csx ]
+    Variable [ Name=$csx ]
   )
 ]
 ]
@@ -19,38 +19,38 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=dblp ]
+  Variable [ Name=$dblp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=csx ]
+  Variable [ Name=$csx ]
 ]
 Where
   OperatorExpr [
     FunctionCall fuzzyjoin.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=csx ]
+        Variable [ Name=$csx ]
         Field=title
       ]
     ]
     ~=
     FunctionCall fuzzyjoin.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=dblp ]
+        Variable [ Name=$dblp ]
         Field=title
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=csx ]
+    Variable [ Name=$csx ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-dblp-aqlplus_1/dblp-csx-dblp-aqlplus_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-dblp-aqlplus_1/dblp-csx-dblp-aqlplus_1.3.ast
index 7fd0cb6..07128d6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-dblp-aqlplus_1/dblp-csx-dblp-aqlplus_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-dblp-aqlplus_1/dblp-csx-dblp-aqlplus_1.3.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=csx ]
+    Variable [ Name=$csx ]
   )
   (
     LiteralExpr [STRING] [dblp2]
     :
-    Variable [ Name=dblp2 ]
+    Variable [ Name=$dblp2 ]
   )
 ]
 ]
@@ -24,33 +24,33 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=dblp ]
+  Variable [ Name=$dblp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=csx ]
+  Variable [ Name=$csx ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=dblp2 ]
+  Variable [ Name=$dblp2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall fuzzyjoin.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=dblp ]
+          Variable [ Name=$dblp ]
           Field=title
         ]
       ]
       ~=
       FunctionCall fuzzyjoin.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=csx ]
+          Variable [ Name=$csx ]
           Field=title
         ]
       ]
@@ -59,14 +59,14 @@
     OperatorExpr [
       FunctionCall fuzzyjoin.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=csx ]
+          Variable [ Name=$csx ]
           Field=authors
         ]
       ]
       ~=
       FunctionCall fuzzyjoin.word-tokens@1[
         FieldAccessor [
-          Variable [ Name=dblp2 ]
+          Variable [ Name=$dblp2 ]
           Field=authors
         ]
       ]
@@ -74,17 +74,17 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=dblp ]
+    Variable [ Name=$dblp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=csx ]
+    Variable [ Name=$csx ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dblp2 ]
+    Variable [ Name=$dblp2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-lookup_1/dblp-lookup_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-lookup_1/dblp-lookup_1.3.ast
index 3d402f7..94dc5a1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-lookup_1/dblp-lookup_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-lookup_1/dblp-lookup_1.3.ast
@@ -1,18 +1,18 @@
 DataverseUse fuzzyjoin
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=id
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/opentype/opentype.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/opentype/opentype.3.ast
index 04c2dfa..6882190 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/opentype/opentype.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/opentype/opentype.3.ast
@@ -7,7 +7,7 @@
   (
     LiteralExpr [STRING] [tweet]
     :
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
   )
   (
     LiteralExpr [STRING] [similar-tweets]
@@ -15,7 +15,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=referred-topics
       ]
       ]
@@ -23,37 +23,37 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=referred-topics
             ]
             ~=
             FieldAccessor [
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
               Field=referred-topics
             ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -66,11 +66,11 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_02/hdfs_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_02/hdfs_02.3.ast
index 583e6f3..bad0fa1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_02/hdfs_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_02/hdfs_02.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [word]
     :
-    Variable [ Name=tok ]
+    Variable [ Name=$tok ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=token ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=token
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,26 +31,31 @@
     LiteralExpr [STRING] [TextDataset]
   ]
   AS
-  Variable [ Name=line ]
+  Variable [ Name=$line ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=line ]
+      Variable [ Name=$line ]
       Field=content
     ]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
 Groupby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=line ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$line ]
+   AS line
+  )
 
 Orderby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_03/hdfs_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_03/hdfs_03.3.ast
index 583e6f3..bad0fa1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_03/hdfs_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_03/hdfs_03.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [word]
     :
-    Variable [ Name=tok ]
+    Variable [ Name=$tok ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=token ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=token
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,26 +31,31 @@
     LiteralExpr [STRING] [TextDataset]
   ]
   AS
-  Variable [ Name=line ]
+  Variable [ Name=$line ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=line ]
+      Variable [ Name=$line ]
       Field=content
     ]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
 Groupby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=line ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$line ]
+   AS line
+  )
 
 Orderby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.ast
index 583e6f3..bad0fa1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [word]
     :
-    Variable [ Name=tok ]
+    Variable [ Name=$tok ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=token ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=token
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,26 +31,31 @@
     LiteralExpr [STRING] [TextDataset]
   ]
   AS
-  Variable [ Name=line ]
+  Variable [ Name=$line ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=line ]
+      Variable [ Name=$line ]
       Field=content
     ]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
 Groupby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=line ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$line ]
+   AS line
+  )
 
 Orderby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/issue_245_hdfs/issue_245_hdfs.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/issue_245_hdfs/issue_245_hdfs.3.ast
index 9abc4c7..fe2529e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/issue_245_hdfs/issue_245_hdfs.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/issue_245_hdfs/issue_245_hdfs.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TextDataset]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=line
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_5/issue_251_dataset_hint_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_5/issue_251_dataset_hint_5.3.ast
index 7f1360c..aa83cd5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_5/issue_251_dataset_hint_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_5/issue_251_dataset_hint_5.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPadm]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.ast
index 583e6f3..bad0fa1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [word]
     :
-    Variable [ Name=tok ]
+    Variable [ Name=$tok ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=token ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=token
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,26 +31,31 @@
     LiteralExpr [STRING] [TextDataset]
   ]
   AS
-  Variable [ Name=line ]
+  Variable [ Name=$line ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=line ]
+      Variable [ Name=$line ]
       Field=content
     ]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
 Groupby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=line ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$line ]
+   AS line
+  )
 
 Orderby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_7/issue_251_dataset_hint_7.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_7/issue_251_dataset_hint_7.3.ast
index 6c74030..e22a30b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_7/issue_251_dataset_hint_7.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_7/issue_251_dataset_hint_7.3.ast
@@ -1,17 +1,17 @@
 DataverseUse feeds
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Tweets]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.3.ast
index cada9fa..1babbbd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=tm ]
+  Variable [ Name=$tm ]
   Field=tweetid
 ]
 ]
@@ -10,49 +10,49 @@
     LiteralExpr [STRING] [TwitterUsers]
   ]
   AS
-  Variable [ Name=tu ]
+  Variable [ Name=$tu ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=tm ]
+  Variable [ Name=$tm ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [results]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=r ]
+        Variable [ Name=$r ]
         Field=vertexid
       ]
       =
       FieldAccessor [
-        Variable [ Name=tm ]
+        Variable [ Name=$tm ]
         Field=tweetid
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=tm ]
+        Variable [ Name=$tm ]
         Field=user
       ]
       =
       FieldAccessor [
-        Variable [ Name=tu ]
+        Variable [ Name=$tu ]
         Field=screen-name
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=tm ]
+    Variable [ Name=$tm ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-primary-equi-join/btree-primary-equi-join.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-primary-equi-join/btree-primary-equi-join.3.ast
index 44c462c..8f8841d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-primary-equi-join/btree-primary-equi-join.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-primary-equi-join/btree-primary-equi-join.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [cid]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=cid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [oid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=oid
     ]
   )
@@ -24,34 +24,34 @@
     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
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=oid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.4.ast
index e5857d1..89d28a6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [aid]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [bid]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=id
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
   )
@@ -32,34 +32,34 @@
     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 [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.4.ast
index e5857d1..89d28a6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [aid]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [bid]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=id
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
   )
@@ -32,34 +32,34 @@
     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 [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.4.ast
index e5857d1..89d28a6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [aid]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [bid]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=id
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
   )
@@ -32,34 +32,34 @@
     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 [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
index ccd4ff4..3d59488 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [aid]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [bid]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=id
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [apt]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [bp]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   )
@@ -40,47 +40,47 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.spatial-intersect@2[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=point
       ]
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=point
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       !=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
index d3b6da5..cec3efa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -46,23 +46,23 @@
           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
@@ -75,12 +75,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -90,7 +90,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
index 54e08f4..3d039dd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -46,37 +46,37 @@
           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
@@ -89,12 +89,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -104,7 +104,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx1/probe-pidx-with-join-invidx-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx1/probe-pidx-with-join-invidx-sidx1.3.ast
index f6a0c35..8369538 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx1/probe-pidx-with-join-invidx-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx1/probe-pidx-with-join-invidx-sidx1.3.ast
@@ -10,7 +10,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=tweetid
         ]
       )
@@ -18,7 +18,7 @@
         LiteralExpr [STRING] [topics]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=referred-topics
         ]
       )
@@ -34,7 +34,7 @@
           LiteralExpr [STRING] [id]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -42,7 +42,7 @@
           LiteralExpr [STRING] [topics]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=referred-topics
           ]
         )
@@ -52,17 +52,17 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.similarity-jaccard-check@3[
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=referred-topics
           ]
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=referred-topics
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -70,25 +70,25 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -101,12 +101,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     >
@@ -116,7 +116,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
index 873c814..14df5eb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
@@ -10,7 +10,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=tweetid
         ]
       )
@@ -18,7 +18,7 @@
         LiteralExpr [STRING] [topics]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=message-text
         ]
       )
@@ -34,7 +34,7 @@
           LiteralExpr [STRING] [id]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -42,7 +42,7 @@
           LiteralExpr [STRING] [topics]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
         )
@@ -52,17 +52,17 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.edit-distance-check@3[
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=message-text
           ]
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
           LiteralExpr [LONG] [7]
@@ -70,25 +70,25 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -101,12 +101,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     >
@@ -116,7 +116,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
index 317564b..ab69658 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -46,19 +46,19 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -71,13 +71,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -85,7 +85,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -95,7 +95,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
index 13d31f3..b7f77df 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -46,33 +46,33 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall test.spatial-intersect@2[
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=sender-location
             ]
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           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
@@ -85,13 +85,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -99,7 +99,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -109,7 +109,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.3.ast
index b02e5b2..4aa57c8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.3.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=fname
       ]
       >
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=lname
       ]
       >
@@ -31,7 +31,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=fname
       ]
       <=
@@ -40,7 +40,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=lname
       ]
       <
@@ -49,7 +49,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
index 03d433e..51ddbfe 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=fname
       ]
       =
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
index 51e1c4c..45d282e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [o_orderstatus]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderstatus
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [o_orderkey2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=o_orderkey
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [o_custkey2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=o_custkey
     ]
   )
@@ -46,7 +46,7 @@
     LiteralExpr [STRING] [o_orderstatus2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=o_orderstatus
     ]
   )
@@ -56,19 +56,19 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -77,7 +77,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=o_custkey
       ]
       =
@@ -86,24 +86,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderstatus
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=o_orderstatus
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.ast
index 9fa8d85..62e3142 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
     <
@@ -20,7 +20,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/disjunctive-predicate-1/disjunctive-predicate-1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/disjunctive-predicate-1/disjunctive-predicate-1.3.ast
index 3686366..de6088a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/disjunctive-predicate-1/disjunctive-predicate-1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/disjunctive-predicate-1/disjunctive-predicate-1.3.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TestSet]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=id
       ]
       =
@@ -22,7 +22,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=id
       ]
       =
@@ -31,7 +31,7 @@
     or
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
         Field=id
       ]
       =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
index 00a8321..84b8cef 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
index f2263bc..4cabd9d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   )
@@ -24,13 +24,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-contains@3[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
       LiteralExpr [STRING] [Multmedia]
@@ -40,7 +40,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
index e2eae18..555a803 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -21,6 +21,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast
index 81a4e5e..73897d2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   )
@@ -24,21 +24,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=word ]
+  Variable [ Name=$word ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=word ]
+      Variable [ Name=$word ]
       LiteralExpr [STRING] [Multmedia]
       LiteralExpr [LONG] [1]
     ]
@@ -46,7 +46,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
index 17024f4..9d4d6ce 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -21,6 +21,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
index ffd9986..7e2dc9c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
@@ -2,20 +2,20 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -30,6 +30,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.ast
index 70aa962..41c1d43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     OrderedListConstructor [
@@ -25,12 +25,12 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.ast
index ddafd0e..e9b8771 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     OrderedListConstructor [
@@ -25,12 +25,12 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.ast
index 9f1c165..6f6c0ec 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     OrderedListConstructor [
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.ast
index c67b4b8..cfa6fa4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=interests
     ]
     UnorderedListConstructor [
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
index 00a8321..84b8cef 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
@@ -1,25 +1,25 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
index e8fa4dd..fe9235b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -25,6 +25,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.ast
index dcce0d5..0ee151d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -24,13 +24,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_totalprice
       ]
       >
@@ -48,7 +48,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
index dcce0d5..0ee151d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -24,13 +24,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_totalprice
       ]
       >
@@ -48,7 +48,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.ast
index 8160020..474b619 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
     =
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey/orders-index-custkey.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey/orders-index-custkey.4.ast
index 8160020..474b619 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey/orders-index-custkey.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/orders-index-custkey/orders-index-custkey.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
     =
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/range-search-open/range-search-open.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/range-search-open/range-search-open.4.ast
index 120fe07..41b59ec 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/range-search-open/range-search-open.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/range-search-open/range-search-open.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       <
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       >
@@ -31,12 +31,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/range-search/range-search.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/range-search/range-search.4.ast
index 120fe07..41b59ec 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/range-search/range-search.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/range-search/range-search.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       <
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       >
@@ -31,12 +31,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-circular-query/rtree-secondary-index-circular-query.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-circular-query/rtree-secondary-index-circular-query.4.ast
index 21d3e25..b9dedb5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-circular-query/rtree-secondary-index-circular-query.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-circular-query/rtree-secondary-index-circular-query.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-circle@2[
@@ -34,7 +34,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.ast
index fe2fa6b..1302b5e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.ast
index fe2fa6b..1302b5e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
index fe2fa6b..1302b5e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
index fb57288..f986da7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=name
     ]
   )
@@ -14,14 +14,14 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=name
     ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -29,56 +29,56 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=name
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=name
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [4]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
-  Variable [ Name=ed ]
+  Variable [ Name=$ed ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance/ngram-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance/ngram-edit-distance.4.ast
index 9a1a1ad..4ef8770 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance/ngram-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-edit-distance/ngram-edit-distance.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=name
     ]
   )
@@ -24,24 +24,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=name
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=name
         ]
       ]
@@ -51,24 +51,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline/ngram-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
index e7c997a..28ffc1b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -15,14 +15,14 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -30,20 +30,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -51,7 +51,7 @@
     ]
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -61,33 +61,33 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard/ngram-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard/ngram-jaccard.4.ast
index bc3861b..43318ff 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard/ngram-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ngram-jaccard/ngram-jaccard.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -15,7 +15,7 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
@@ -25,13 +25,13 @@
     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 [
@@ -39,7 +39,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -47,7 +47,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -60,24 +60,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline/olist-edit-distance-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline/olist-edit-distance-inline.4.ast
index f00848c..9f6c4b4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline/olist-edit-distance-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance-inline/olist-edit-distance-inline.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -15,14 +15,14 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -30,23 +30,23 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
@@ -55,7 +55,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -66,7 +66,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -75,33 +75,33 @@
     ]
     and
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [1]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
-  Variable [ Name=ed ]
+  Variable [ Name=$ed ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance/olist-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance/olist-edit-distance.4.ast
index 2cb6af9..497e47f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance/olist-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-edit-distance/olist-edit-distance.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -15,7 +15,7 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
@@ -25,20 +25,20 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -49,7 +49,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -60,11 +60,11 @@
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -74,24 +74,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline/olist-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline/olist-jaccard-inline.4.ast
index 5809dea..eccc898 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline/olist-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard-inline/olist-jaccard-inline.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -15,14 +15,14 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -30,42 +30,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.9]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
@@ -73,7 +73,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -84,7 +84,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -93,15 +93,15 @@
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard/olist-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard/olist-jaccard.4.ast
index 1b1f7d9..5320d31 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard/olist-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/olist-jaccard/olist-jaccard.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -15,7 +15,7 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
@@ -25,24 +25,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -52,12 +52,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
@@ -65,7 +65,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -76,7 +76,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -86,12 +86,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline/ulist-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline/ulist-jaccard-inline.4.ast
index 5809dea..eccc898 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline/ulist-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard-inline/ulist-jaccard-inline.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -15,14 +15,14 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -30,42 +30,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.9]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
@@ -73,7 +73,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -84,7 +84,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -93,15 +93,15 @@
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard/ulist-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard/ulist-jaccard.4.ast
index 1b1f7d9..5320d31 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard/ulist-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/ulist-jaccard/ulist-jaccard.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
   )
@@ -15,7 +15,7 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   )
@@ -25,24 +25,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -52,12 +52,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
@@ -65,7 +65,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -76,7 +76,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -86,12 +86,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline/word-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline/word-jaccard-inline.4.ast
index e670ce9..7267747 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline/word-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard-inline/word-jaccard-inline.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -15,14 +15,14 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -30,26 +30,26 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
     ]
@@ -57,33 +57,33 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard/word-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard/word-jaccard.4.ast
index 1acfc8b..68c121d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard/word-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join-noeqjoin/word-jaccard/word-jaccard.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [a]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=title
     ]
   )
@@ -15,7 +15,7 @@
     LiteralExpr [STRING] [b]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=title
     ]
   )
@@ -25,13 +25,13 @@
     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 [
@@ -39,13 +39,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -56,24 +56,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
index 6ad6d9e..9522d38 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -23,56 +23,56 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=name
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=name
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [4]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
-  Variable [ Name=ed ]
+  Variable [ Name=$ed ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-edit-distance/ngram-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-edit-distance/ngram-edit-distance.4.ast
index e9fb1bc..81773e8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-edit-distance/ngram-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-edit-distance/ngram-edit-distance.4.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -18,24 +18,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=name
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=name
         ]
       ]
@@ -45,24 +45,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
index ef28532..15024a2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -24,20 +24,20 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -45,7 +45,7 @@
     ]
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -55,33 +55,33 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-jaccard/ngram-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-jaccard/ngram-jaccard.4.ast
index 371a565..8b33591 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-jaccard/ngram-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ngram-jaccard/ngram-jaccard.4.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -19,13 +19,13 @@
     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 [
@@ -33,7 +33,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -41,7 +41,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -54,24 +54,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.4.ast
index ed1da42..623e345 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-edit-distance-inline/olist-edit-distance-inline.4.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -23,23 +23,23 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
@@ -48,7 +48,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -59,7 +59,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -68,33 +68,33 @@
     ]
     and
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [1]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
-  Variable [ Name=ed ]
+  Variable [ Name=$ed ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-edit-distance/olist-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-edit-distance/olist-edit-distance.4.ast
index e18a355..562152c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-edit-distance/olist-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-edit-distance/olist-edit-distance.4.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -18,20 +18,20 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -42,7 +42,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -53,11 +53,11 @@
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -67,24 +67,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.4.ast
index 5218e0e..7d9918e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-jaccard-inline/olist-jaccard-inline.4.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -23,42 +23,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.9]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
@@ -66,7 +66,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -77,7 +77,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -86,15 +86,15 @@
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-jaccard/olist-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-jaccard/olist-jaccard.4.ast
index 7b9e57f..e58c7f5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-jaccard/olist-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/olist-jaccard/olist-jaccard.4.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -18,24 +18,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -45,12 +45,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
@@ -58,7 +58,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -69,7 +69,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -79,12 +79,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.4.ast
index 5218e0e..7d9918e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ulist-jaccard-inline/ulist-jaccard-inline.4.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -23,42 +23,42 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=interests
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=interests
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.9]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
@@ -66,7 +66,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -77,7 +77,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -86,15 +86,15 @@
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ulist-jaccard/ulist-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ulist-jaccard/ulist-jaccard.4.ast
index 7b9e57f..e58c7f5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ulist-jaccard/ulist-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/ulist-jaccard/ulist-jaccard.4.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [a]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [b]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -18,24 +18,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.similarity-jaccard@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -45,12 +45,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
@@ -58,7 +58,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=interests
         ]
       ]
@@ -69,7 +69,7 @@
     OperatorExpr [
       FunctionCall test.len@1[
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=interests
         ]
       ]
@@ -79,12 +79,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/word-jaccard-inline/word-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/word-jaccard-inline/word-jaccard-inline.4.ast
index 74ae0a8..cbc0f05 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/word-jaccard-inline/word-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/word-jaccard-inline/word-jaccard-inline.4.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -23,26 +23,26 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
     ]
@@ -50,33 +50,33 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/word-jaccard/word-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/word-jaccard/word-jaccard.4.ast
index 1fc8979..978c7ce 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/word-jaccard/word-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/inverted-index-join/word-jaccard/word-jaccard.4.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -18,13 +18,13 @@
     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 [
@@ -32,13 +32,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -49,24 +49,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue285-2/query_issue285-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue285-2/query_issue285-2.3.ast
index 57f2c39..79290f8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue285-2/query_issue285-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue285-2/query_issue285-2.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [aid]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=id
     ]
   )
@@ -16,7 +16,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
       ]
@@ -24,23 +24,23 @@
           LiteralExpr [STRING] [CSX]
         ]
         AS
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=authors
           ]
           =
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=authors
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=id
         ]
         ASC
@@ -53,11 +53,11 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue285/query_issue285.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue285/query_issue285.3.ast
index ed0638e..265ea02 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue285/query_issue285.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue285/query_issue285.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [aid]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=id
     ]
   )
@@ -16,7 +16,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
       ]
@@ -24,23 +24,23 @@
           LiteralExpr [STRING] [CSX]
         ]
         AS
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=authors
           ]
           =
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=authors
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=id
         ]
         ASC
@@ -53,11 +53,11 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue658/query_issue658.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue658/query_issue658.3.ast
index 3c6cea7..cbe0ff1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue658/query_issue658.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue658/query_issue658.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [aid]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=id
     ]
   )
@@ -16,7 +16,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
       ]
@@ -24,37 +24,37 @@
           LiteralExpr [STRING] [CSX]
         ]
         AS
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
       ]
       Where
         OperatorExpr [
           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=title
             ]
             !=
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=title
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=id
         ]
         ASC
@@ -67,11 +67,11 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue849-2/query_issue849-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue849-2/query_issue849-2.3.ast
index 6f7bde6..4f5b4e0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue849-2/query_issue849-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue849-2/query_issue849-2.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [x]
     :
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
   )
   (
     LiteralExpr [STRING] [y]
     :
-    Variable [ Name=y ]
+    Variable [ Name=$y ]
   )
 ]
 ]
@@ -18,12 +18,12 @@
     LiteralExpr [STRING] [s]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=z ]
+      Variable [ Name=$z ]
       Field=c
     ]
     ]
@@ -66,21 +66,21 @@
         ]
       ]
       AS
-      Variable [ Name=z ]
+      Variable [ Name=$z ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=b
         ]
         =
         FieldAccessor [
-          Variable [ Name=z ]
+          Variable [ Name=$z ]
           Field=a
         ]
       ]
   )
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue849/query_issue849.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue849/query_issue849.3.ast
index 19f3d09..654e008 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue849/query_issue849.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/leftouterjoin/query_issue849/query_issue849.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [x]
     :
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
   )
   (
     LiteralExpr [STRING] [y]
     :
-    Variable [ Name=y ]
+    Variable [ Name=$y ]
   )
 ]
 ]
@@ -31,12 +31,12 @@
     ]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=z ]
+      Variable [ Name=$z ]
       Field=b
     ]
     ]
@@ -44,21 +44,21 @@
         LiteralExpr [STRING] [s]
       ]
       AS
-      Variable [ Name=z ]
+      Variable [ Name=$z ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=a
         ]
         =
         FieldAccessor [
-          Variable [ Name=z ]
+          Variable [ Name=$z ]
           Field=b
         ]
       ]
   )
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/len_01/len_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/len_01/len_01.3.ast
index b485e15..94f0c25 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/len_01/len_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/len_01/len_01.3.ast
@@ -52,5 +52,5 @@
     LiteralExpr [LONG] [1]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_01/listify_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_01/listify_01.3.ast
index 3c7cc1a..19e047c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_01/listify_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_01/listify_01.3.ast
@@ -1,10 +1,10 @@
 DataverseUse test
 Query:
-LetVariable [ Name=token_list ]
+Let Variable [ Name=$token_list ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=token ]
+    Variable [ Name=$token ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [LONG] [1]
@@ -12,9 +12,9 @@
         LiteralExpr [LONG] [3]
       ]
       AS
-      Variable [ Name=token ]
+      Variable [ Name=$token ]
     ]
   )
 SELECT ELEMENT [
-Variable [ Name=token_list ]
+Variable [ Name=$token_list ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_02/listify_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_02/listify_02.3.ast
index 4d1a23c..7fb49b5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_02/listify_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_02/listify_02.3.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
-LetVariable [ Name=token_list ]
+Let Variable [ Name=$token_list ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=token ]
+    Variable [ Name=$token ]
     ]
     FROM [      OrderedListConstructor [
         LiteralExpr [STRING] [foo]
         LiteralExpr [STRING] [bar]
       ]
       AS
-      Variable [ Name=token ]
+      Variable [ Name=$token ]
     ]
   )
 SELECT ELEMENT [
-Variable [ Name=token_list ]
+Variable [ Name=$token_list ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_03/listify_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_03/listify_03.3.ast
index 81cb2a2..3eb686c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_03/listify_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/listify_03/listify_03.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FunctionCall test.min@1[
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
 ]
 FROM [  OrderedListConstructor [
@@ -10,14 +10,14 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
-LetVariable [ Name=y ]
+Let Variable [ Name=$y ]
   :=
   (
     SELECT ELEMENT [
     FunctionCall test.min@1[
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     ]
     FROM [      OrderedListConstructor [
@@ -38,6 +38,6 @@
         ]
       ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
   )
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/query-issue428/query-issue428.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/query-issue428/query-issue428.3.ast
index 912a549..e441381 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/query-issue428/query-issue428.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/query-issue428/query-issue428.3.ast
@@ -1,19 +1,19 @@
 Query:
 SELECT ELEMENT [
 QuantifiedExpression SOME [
-  [Variable [ Name=a1 ]
+  [Variable [ Name=$a1 ]
   In
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   ]
-  [Variable [ Name=b1 ]
+  [Variable [ Name=$b1 ]
   In
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   ]
   Satifies [
     OperatorExpr [
-      Variable [ Name=a1 ]
+      Variable [ Name=$a1 ]
       <
-      Variable [ Name=b1 ]
+      Variable [ Name=$b1 ]
     ]
   ]
 ]
@@ -30,7 +30,7 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   OrderedListConstructor [
     OrderedListConstructor [
@@ -44,5 +44,5 @@
     ]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/scan-collection_01/scan-collection_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/scan-collection_01/scan-collection_01.3.ast
index 53e2019..ff7058d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/scan-collection_01/scan-collection_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/list/scan-collection_01/scan-collection_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=u ]
+Variable [ Name=$u ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -9,5 +9,5 @@
     LiteralExpr [LONG] [3]
   ]
   AS
-  Variable [ Name=u ]
+  Variable [ Name=$u ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/adm_binary/adm_binary.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/adm_binary/adm_binary.3.ast
index dfdb7a9..3d46dd9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/adm_binary/adm_binary.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/adm_binary/adm_binary.3.ast
@@ -1,11 +1,11 @@
 DataverseUse temp
 Query:
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_01/csv_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_01/csv_01.3.ast
index b884844..76e0eec 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_01/csv_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_01/csv_01.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [double]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=double
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [date-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=date
     ]
   )
@@ -39,7 +39,7 @@
     :
     FunctionCall temp.date@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=date
       ]
     ]
@@ -48,7 +48,7 @@
     LiteralExpr [STRING] [time-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=time
     ]
   )
@@ -57,7 +57,7 @@
     :
     FunctionCall temp.time@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=time
       ]
     ]
@@ -66,7 +66,7 @@
     LiteralExpr [STRING] [datetime-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=datetime
     ]
   )
@@ -75,7 +75,7 @@
     :
     FunctionCall temp.datetime@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=datetime
       ]
     ]
@@ -86,11 +86,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_02/csv_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_02/csv_02.3.ast
index 482a28e..5b3143d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_02/csv_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_02/csv_02.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [double]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=double
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [date-string]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=date
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [time-string]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=time
     ]
   )
@@ -46,7 +46,7 @@
     LiteralExpr [STRING] [datetime-string]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=datetime
     ]
   )
@@ -56,11 +56,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_03/csv_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_03/csv_03.3.ast
index ac77c83..834efdf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_03/csv_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_03/csv_03.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [floatq]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=floatq
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [double]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=double
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [doubleq]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=doubleq
     ]
   )
@@ -46,7 +46,7 @@
     LiteralExpr [STRING] [string]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=string
     ]
   )
@@ -54,7 +54,7 @@
     LiteralExpr [STRING] [stringq]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=stringq
     ]
   )
@@ -64,11 +64,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_04/csv_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_04/csv_04.3.ast
index 8fd7d90..b7cbd4b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_04/csv_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_04/csv_04.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [stringa]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=stringa
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [stringb]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=stringb
     ]
   )
@@ -40,11 +40,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_05/csv_05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_05/csv_05.3.ast
index 8fd7d90..b7cbd4b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_05/csv_05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_05/csv_05.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [stringa]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=stringa
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [stringb]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=stringb
     ]
   )
@@ -40,11 +40,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_06/csv_06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_06/csv_06.3.ast
index 8fd7d90..b7cbd4b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_06/csv_06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_06/csv_06.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [stringa]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=stringa
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [stringb]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=stringb
     ]
   )
@@ -40,11 +40,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_07/csv_07.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_07/csv_07.3.ast
index 8fd7d90..b7cbd4b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_07/csv_07.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_07/csv_07.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [stringa]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=stringa
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [stringb]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=stringb
     ]
   )
@@ -40,11 +40,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_cr/csv_08.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_cr/csv_08.3.ast
index b884844..76e0eec 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_cr/csv_08.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_cr/csv_08.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [double]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=double
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [date-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=date
     ]
   )
@@ -39,7 +39,7 @@
     :
     FunctionCall temp.date@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=date
       ]
     ]
@@ -48,7 +48,7 @@
     LiteralExpr [STRING] [time-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=time
     ]
   )
@@ -57,7 +57,7 @@
     :
     FunctionCall temp.time@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=time
       ]
     ]
@@ -66,7 +66,7 @@
     LiteralExpr [STRING] [datetime-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=datetime
     ]
   )
@@ -75,7 +75,7 @@
     :
     FunctionCall temp.datetime@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=datetime
       ]
     ]
@@ -86,11 +86,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_crlf/csv_08.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_crlf/csv_08.3.ast
index b884844..76e0eec 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_crlf/csv_08.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_crlf/csv_08.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [double]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=double
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [date-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=date
     ]
   )
@@ -39,7 +39,7 @@
     :
     FunctionCall temp.date@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=date
       ]
     ]
@@ -48,7 +48,7 @@
     LiteralExpr [STRING] [time-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=time
     ]
   )
@@ -57,7 +57,7 @@
     :
     FunctionCall temp.time@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=time
       ]
     ]
@@ -66,7 +66,7 @@
     LiteralExpr [STRING] [datetime-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=datetime
     ]
   )
@@ -75,7 +75,7 @@
     :
     FunctionCall temp.datetime@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=datetime
       ]
     ]
@@ -86,11 +86,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_lf/csv_08.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_lf/csv_08.3.ast
index b884844..76e0eec 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_lf/csv_08.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/csv_08_header_lf/csv_08.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [float]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=float
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [double]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=double
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [date-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=date
     ]
   )
@@ -39,7 +39,7 @@
     :
     FunctionCall temp.date@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=date
       ]
     ]
@@ -48,7 +48,7 @@
     LiteralExpr [STRING] [time-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=time
     ]
   )
@@ -57,7 +57,7 @@
     :
     FunctionCall temp.time@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=time
       ]
     ]
@@ -66,7 +66,7 @@
     LiteralExpr [STRING] [datetime-before]
     :
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=datetime
     ]
   )
@@ -75,7 +75,7 @@
     :
     FunctionCall temp.datetime@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=datetime
       ]
     ]
@@ -86,11 +86,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/escapes01/escapes01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/escapes01/escapes01.3.ast
index 176ce1e..2b37a8e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/escapes01/escapes01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/escapes01/escapes01.3.ast
@@ -1,17 +1,17 @@
 DataverseUse TestDataverse
 Query:
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TestSet]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/escapes02/escapes02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/escapes02/escapes02.3.ast
index 176ce1e..2b37a8e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/escapes02/escapes02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/escapes02/escapes02.3.ast
@@ -1,17 +1,17 @@
 DataverseUse TestDataverse
 Query:
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TestSet]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/issue289_query/issue289_query.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/issue289_query/issue289_query.3.ast
index 323b20d..3645723 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/issue289_query/issue289_query.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/issue289_query/issue289_query.3.ast
@@ -4,13 +4,13 @@
 FunctionCall test.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Customers]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/type_promotion_0/type_promotion_0.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/type_promotion_0/type_promotion_0.3.ast
index 176ce1e..2b37a8e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/type_promotion_0/type_promotion_0.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/load/type_promotion_0/type_promotion_0.3.ast
@@ -1,17 +1,17 @@
 DataverseUse TestDataverse
 Query:
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TestSet]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/materialization/assign-reuse/assign-reuse.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/materialization/assign-reuse/assign-reuse.3.ast
index c0fdc765..23559fa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/materialization/assign-reuse/assign-reuse.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/materialization/assign-reuse/assign-reuse.3.ast
@@ -1,22 +1,22 @@
 DataverseUse TinySocial
 Query:
-LetVariable [ Name=lonelyusers ]
+Let Variable [ Name=$lonelyusers ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [FacebookUsers]
       ]
       AS
-      Variable [ Name=d ]
+      Variable [ Name=$d ]
     ]
     Where
       OperatorExpr [
         FunctionCall TinySocial.count@1[
           FieldAccessor [
-            Variable [ Name=d ]
+            Variable [ Name=$d ]
             Field=friend-ids
           ]
         ]
@@ -24,23 +24,23 @@
         LiteralExpr [LONG] [2]
       ]
   )
-LetVariable [ Name=lonelyusers2 ]
+Let Variable [ Name=$lonelyusers2 ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [FacebookUsers]
       ]
       AS
-      Variable [ Name=d ]
+      Variable [ Name=$d ]
     ]
     Where
       OperatorExpr [
         FunctionCall TinySocial.count@1[
           FieldAccessor [
-            Variable [ Name=d ]
+            Variable [ Name=$d ]
             Field=friend-ids
           ]
         ]
@@ -58,7 +58,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=id
         ]
       )
@@ -66,7 +66,7 @@
         LiteralExpr [STRING] [name]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=name
         ]
       )
@@ -80,7 +80,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=l2 ]
+          Variable [ Name=$l2 ]
           Field=id
         ]
       )
@@ -88,7 +88,7 @@
         LiteralExpr [STRING] [name]
         :
         FieldAccessor [
-          Variable [ Name=l2 ]
+          Variable [ Name=$l2 ]
           Field=name
         ]
       )
@@ -96,34 +96,34 @@
   )
 ]
 ]
-FROM [  Variable [ Name=lonelyusers ]
+FROM [  Variable [ Name=$lonelyusers ]
   AS
-  Variable [ Name=l1 ]
+  Variable [ Name=$l1 ]
 ,
-  Variable [ Name=lonelyusers2 ]
+  Variable [ Name=$lonelyusers2 ]
   AS
-  Variable [ Name=l2 ]
+  Variable [ Name=$l2 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l1 ]
+      Variable [ Name=$l1 ]
       Field=id
     ]
     <
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l1 ]
+    Variable [ Name=$l1 ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=l2 ]
+    Variable [ Name=$l2 ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/float_01/float_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/float_01/float_01.3.ast
index 69b596c..85ceb1a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/float_01/float_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/float_01/float_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=f ]
+Variable [ Name=$f ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [FLOAT] [1.0]
@@ -12,5 +12,5 @@
     LiteralExpr [FLOAT] [0.1]
   ]
   AS
-  Variable [ Name=f ]
+  Variable [ Name=$f ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/flushtest/flushtest.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/flushtest/flushtest.4.ast
index fc3a08a..cdd2ab6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/flushtest/flushtest.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/flushtest/flushtest.4.ast
@@ -1,11 +1,11 @@
 DataverseUse DMLTest
 Query:
 SELECT ELEMENT [
-Variable [ Name=t ]
+Variable [ Name=$t ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers2]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.ast
index c68fa11..2399e4b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [word]
     :
-    Variable [ Name=tok ]
+    Variable [ Name=$tok ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall twitter.count@1[
-      Variable [ Name=token ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=token
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,30 +31,46 @@
     LiteralExpr [STRING] [TwitterData]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ,
   FunctionCall twitter.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=text
     ]
   ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
 Groupby
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   :=
-  Variable [ Name=token ]
-  With
-  Variable [ Name=t ]
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$token ]
+   AS token
+  Variable [ Name=$t ]
+   AS t
+  )
 
 Orderby
   FunctionCall twitter.count@1[
-    Variable [ Name=token ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#3 ]
+        Field=token
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#3 ]
+      ]
+    )
   ]
   DESC
-  Variable [ Name=tok ]
+  Variable [ Name=$tok ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/nested-loop-join_01/nested-loop-join_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/nested-loop-join_01/nested-loop-join_01.3.ast
index 3c322fa..7e52ea1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/nested-loop-join_01/nested-loop-join_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/nested-loop-join_01/nested-loop-join_01.3.ast
@@ -5,19 +5,19 @@
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
   )
   (
     LiteralExpr [STRING] [visitor]
     :
-    Variable [ Name=visitor ]
+    Variable [ Name=$visitor ]
   )
   (
     LiteralExpr [STRING] [user-lottery_numbers-len]
     :
     FunctionCall test.len@1[
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=lottery_numbers
       ]
     ]
@@ -27,7 +27,7 @@
     :
     FunctionCall test.len@1[
       FieldAccessor [
-        Variable [ Name=visitor ]
+        Variable [ Name=$visitor ]
         Field=lottery_numbers
       ]
     ]
@@ -38,38 +38,38 @@
     LiteralExpr [STRING] [Users]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Visitors]
   ]
   AS
-  Variable [ Name=visitor ]
+  Variable [ Name=$visitor ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.len@1[
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=lottery_numbers
       ]
     ]
     =
     FunctionCall test.len@1[
       FieldAccessor [
-        Variable [ Name=visitor ]
+        Variable [ Name=$visitor ]
         Field=lottery_numbers
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=uid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=visitor ]
+    Variable [ Name=$visitor ]
     Field=vid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/partition-by-nonexistent-field/partition-by-nonexistent-field.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/partition-by-nonexistent-field/partition-by-nonexistent-field.3.ast
index 16bb849..ef5fc9e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/partition-by-nonexistent-field/partition-by-nonexistent-field.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/partition-by-nonexistent-field/partition-by-nonexistent-field.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/prefix-search/prefix-search.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/prefix-search/prefix-search.3.ast
index eb41e9f..f549338 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/prefix-search/prefix-search.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/prefix-search/prefix-search.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [l_linenumber]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_linenumber
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [l_l_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_orderkey
     ]
   )
@@ -24,13 +24,13 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
       >=
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
       <
@@ -48,7 +48,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/query_issue267/query_issue267.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/query_issue267/query_issue267.3.ast
index 59cf201..45b8f56 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/query_issue267/query_issue267.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/query_issue267/query_issue267.3.ast
@@ -1,33 +1,33 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [t1]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [t2]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.lowercase@1[
         FieldAccessor [
-          Variable [ Name=m ]
+          Variable [ Name=$m ]
           Field=name
         ]
       ]
       =
       FunctionCall test.lowercase@1[
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=name
         ]
       ]
@@ -36,14 +36,14 @@
     OperatorExpr [
       FunctionCall test.string-length@1[
         FieldAccessor [
-          Variable [ Name=m ]
+          Variable [ Name=$m ]
           Field=name
         ]
       ]
       =
       FunctionCall test.string-length@1[
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=name
         ]
       ]
@@ -51,7 +51,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/stable_sort/stable_sort.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/stable_sort/stable_sort.3.ast
index 92440cc..2627232 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/stable_sort/stable_sort.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/stable_sort/stable_sort.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     Field=l_partkey
   ]
   DESC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/string_eq_01/string_eq_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/string_eq_01/string_eq_01.3.ast
index 9e8ab09..52e2b67 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/string_eq_01/string_eq_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/string_eq_01/string_eq_01.3.ast
@@ -1,18 +1,18 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=alias
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/compact-dataset-and-its-indexes/compact-dataset-and-its-indexes.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/compact-dataset-and-its-indexes/compact-dataset-and-its-indexes.5.ast
index 2a1d058..1b58438 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/compact-dataset-and-its-indexes/compact-dataset-and-its-indexes.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/compact-dataset-and-its-indexes/compact-dataset-and-its-indexes.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=l_suppkey
@@ -27,7 +27,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=l_orderkey
@@ -35,7 +35,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=l_linenumber
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast
index 8daa275..f7e4fee 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast
@@ -1,19 +1,19 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=user
       ]
       Field=statuses_count
@@ -23,7 +23,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/drop-index/drop-index.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/drop-index/drop-index.4.ast
index 3301a9a..da06490 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/drop-index/drop-index.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/drop-index/drop-index.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [t1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=unique1
@@ -29,7 +29,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=stringu1
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.ast
index 7fa9617..f2f7887 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.ast
@@ -1,20 +1,20 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=user
         ]
         Field=name
@@ -26,7 +26,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=user
         ]
         Field=statuses_count
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-loaded-dataset-with-index_01/insert-into-loaded-dataset-with-index_01.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-loaded-dataset-with-index_01/insert-into-loaded-dataset-with-index_01.5.ast
index beac285..0ff9dd0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-loaded-dataset-with-index_01/insert-into-loaded-dataset-with-index_01.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-loaded-dataset-with-index_01/insert-into-loaded-dataset-with-index_01.5.ast
@@ -1,20 +1,20 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=user
         ]
         Field=name
@@ -26,7 +26,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=user
         ]
         Field=statuses_count
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.ast
index a7e785e..3b3131a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.ast
@@ -1,20 +1,20 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=user
         ]
         Field=name
@@ -26,7 +26,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=user
         ]
         Field=statuses_count
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-index/load-with-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-index/load-with-index.3.ast
index a7e785e..3b3131a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-index/load-with-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-index/load-with-index.3.ast
@@ -1,20 +1,20 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=user
         ]
         Field=name
@@ -26,7 +26,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=user
         ]
         Field=statuses_count
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-ngram-index/load-with-ngram-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-ngram-index/load-with-ngram-index.3.ast
index 30e9f36..7080c0a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-ngram-index/load-with-ngram-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-ngram-index/load-with-ngram-index.3.ast
@@ -1,19 +1,19 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   FunctionCall TinySocial.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=user
       ]
       Field=name
@@ -22,7 +22,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-rtree-index/load-with-rtree-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-rtree-index/load-with-rtree-index.3.ast
index 959db3e..1ef42e0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-rtree-index/load-with-rtree-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-rtree-index/load-with-rtree-index.3.ast
@@ -1,19 +1,19 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   FunctionCall TinySocial.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=user
       ]
       Field=sender-location
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-word-index/load-with-word-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-word-index/load-with-word-index.3.ast
index 31da348..6a17d33 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-word-index/load-with-word-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/load-with-word-index/load-with-word-index.3.ast
@@ -1,21 +1,21 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall TinySocial.similarity-jaccard-check@3[
     FunctionCall TinySocial.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=user
         ]
         Field=name
@@ -28,12 +28,12 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/nested-uuid-insert/nested-uuid-insert.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/nested-uuid-insert/nested-uuid-insert.3.ast
index 1c078f0..09b20c6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/nested-uuid-insert/nested-uuid-insert.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/nested-uuid-insert/nested-uuid-insert.3.ast
@@ -4,7 +4,7 @@
 FieldAccessor [
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=test ]
+      Variable [ Name=$test ]
       Field=nested
     ]
     Field=nested
@@ -16,5 +16,5 @@
     LiteralExpr [STRING] [doublenests]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/nested-uuid-load/nested-uuid-load.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/nested-uuid-load/nested-uuid-load.3.ast
index 29b491c..86133b1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/nested-uuid-load/nested-uuid-load.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/nested-uuid-load/nested-uuid-load.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid]
     :
     FieldAccessor [
-      Variable [ Name=test ]
+      Variable [ Name=$test ]
       Field=tweetid
     ]
   )
@@ -15,7 +15,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=test ]
+        Variable [ Name=$test ]
         Field=user
       ]
       Field=screen-name
@@ -27,11 +27,11 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=test ]
+    Variable [ Name=$test ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-btree-secondary-index-nullable/scan-delete-btree-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-btree-secondary-index-nullable/scan-delete-btree-secondary-index-nullable.5.ast
index 4e91616..3802830 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-btree-secondary-index-nullable/scan-delete-btree-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-btree-secondary-index-nullable/scan-delete-btree-secondary-index-nullable.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=age
@@ -27,7 +27,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-ngram-secondary-index-nullable/scan-delete-inverted-index-ngram-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-ngram-secondary-index-nullable/scan-delete-inverted-index-ngram-secondary-index-nullable.5.ast
index 5b4ffed..b9753d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-ngram-secondary-index-nullable/scan-delete-inverted-index-ngram-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-ngram-secondary-index-nullable/scan-delete-inverted-index-ngram-secondary-index-nullable.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -26,7 +26,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-ngram-secondary-index/scan-delete-inverted-index-ngram-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-ngram-secondary-index/scan-delete-inverted-index-ngram-secondary-index.5.ast
index 5b4ffed..b9753d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-ngram-secondary-index/scan-delete-inverted-index-ngram-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-ngram-secondary-index/scan-delete-inverted-index-ngram-secondary-index.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -26,7 +26,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-word-secondary-index-nullable/scan-delete-inverted-index-word-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-word-secondary-index-nullable/scan-delete-inverted-index-word-secondary-index-nullable.5.ast
index 522ef24..53b355e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-word-secondary-index-nullable/scan-delete-inverted-index-word-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-word-secondary-index-nullable/scan-delete-inverted-index-word-secondary-index-nullable.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,15 +10,15 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-word-secondary-index/scan-delete-inverted-index-word-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-word-secondary-index/scan-delete-inverted-index-word-secondary-index.5.ast
index 522ef24..53b355e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-word-secondary-index/scan-delete-inverted-index-word-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-inverted-index-word-secondary-index/scan-delete-inverted-index-word-secondary-index.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,15 +10,15 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-rtree-secondary-index-nullable/scan-delete-rtree-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-rtree-secondary-index-nullable/scan-delete-rtree-secondary-index-nullable.5.ast
index 46784ea..413b4a8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-rtree-secondary-index-nullable/scan-delete-rtree-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-rtree-secondary-index-nullable/scan-delete-rtree-secondary-index-nullable.5.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast
index 46784ea..413b4a8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-btree-secondary-index-nullable/scan-insert-btree-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-btree-secondary-index-nullable/scan-insert-btree-secondary-index-nullable.5.ast
index 50b2522..db1c69c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-btree-secondary-index-nullable/scan-insert-btree-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-btree-secondary-index-nullable/scan-insert-btree-secondary-index-nullable.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [CustomersMini]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=age
@@ -27,7 +27,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-ngram-secondary-index-nullable/scan-insert-inverted-index-ngram-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-ngram-secondary-index-nullable/scan-insert-inverted-index-ngram-secondary-index-nullable.5.ast
index 5b4ffed..b9753d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-ngram-secondary-index-nullable/scan-insert-inverted-index-ngram-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-ngram-secondary-index-nullable/scan-insert-inverted-index-ngram-secondary-index-nullable.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -26,7 +26,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-ngram-secondary-index/scan-insert-inverted-index-ngram-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-ngram-secondary-index/scan-insert-inverted-index-ngram-secondary-index.5.ast
index 5b4ffed..b9753d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-ngram-secondary-index/scan-insert-inverted-index-ngram-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-ngram-secondary-index/scan-insert-inverted-index-ngram-secondary-index.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -26,7 +26,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-word-secondary-index-nullable/scan-insert-inverted-index-word-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-word-secondary-index-nullable/scan-insert-inverted-index-word-secondary-index-nullable.5.ast
index 522ef24..53b355e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-word-secondary-index-nullable/scan-insert-inverted-index-word-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-word-secondary-index-nullable/scan-insert-inverted-index-word-secondary-index-nullable.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,15 +10,15 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-word-secondary-index/scan-insert-inverted-index-word-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-word-secondary-index/scan-insert-inverted-index-word-secondary-index.5.ast
index 522ef24..53b355e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-word-secondary-index/scan-insert-inverted-index-word-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-inverted-index-word-secondary-index/scan-insert-inverted-index-word-secondary-index.5.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,15 +10,15 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-rtree-secondary-index-nullable/scan-insert-rtree-secondary-index-nullable.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-rtree-secondary-index-nullable/scan-insert-rtree-secondary-index-nullable.5.ast
index aac1fb7..2c6acd8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-rtree-secondary-index-nullable/scan-insert-rtree-secondary-index-nullable.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-rtree-secondary-index-nullable/scan-insert-rtree-secondary-index-nullable.5.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyMiniData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast
index aac1fb7..2c6acd8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index-dml/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyMiniData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/adm-format/adm-format.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/adm-format/adm-format.3.ast
index eec61a4..cfbd249 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/adm-format/adm-format.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/adm-format/adm-format.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=id
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=point
@@ -29,7 +29,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=kwds
@@ -40,7 +40,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=line1
@@ -51,7 +51,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=line2
@@ -62,7 +62,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=poly1
@@ -73,7 +73,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=poly2
@@ -84,7 +84,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=rec
@@ -95,7 +95,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=circle
@@ -107,13 +107,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
index fa1c6b5..c72f9aa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -58,23 +58,23 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -89,14 +89,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -107,7 +107,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -120,7 +120,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/leftouterjoin/leftouterjoin.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/leftouterjoin/leftouterjoin.3.ast
index 75e1630..7edd08b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/leftouterjoin/leftouterjoin.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/leftouterjoin/leftouterjoin.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -58,13 +58,13 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=countA
@@ -72,7 +72,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -81,7 +81,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -96,13 +96,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -115,7 +115,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/rtree-index/rtree-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/rtree-index/rtree-index.3.ast
index 85d9f1c..3700f65 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/rtree-index/rtree-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/external-indexing/rtree-index/rtree-index.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/btree-primary-equi-join/btree-primary-equi-join.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/btree-primary-equi-join/btree-primary-equi-join.3.ast
index 7b8e706..e973940 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/btree-primary-equi-join/btree-primary-equi-join.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/btree-primary-equi-join/btree-primary-equi-join.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=cid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=oid
@@ -30,19 +30,19 @@
     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 [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=cid
@@ -50,7 +50,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=cid
@@ -59,7 +59,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
@@ -67,7 +67,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=oid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast
index 0eb3809..8aa1e0c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=id
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=id
@@ -29,7 +29,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=authors
@@ -41,19 +41,19 @@
     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 [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=authors
@@ -61,7 +61,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=authors
@@ -70,7 +70,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -78,7 +78,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
index 858596e..92067a4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -14,14 +14,14 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -29,27 +29,27 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=name
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=name
@@ -58,7 +58,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [4]
     ]
@@ -66,7 +66,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -74,7 +74,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
@@ -82,11 +82,11 @@
     ]
   ]
 Orderby
-  Variable [ Name=ed ]
+  Variable [ Name=$ed ]
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=cid
@@ -94,7 +94,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-edit-distance/ngram-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-edit-distance/ngram-edit-distance.4.ast
index e72556b..46f589e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-edit-distance/ngram-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-edit-distance/ngram-edit-distance.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
@@ -24,13 +24,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -38,14 +38,14 @@
       FunctionCall test.edit-distance@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=name
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=name
@@ -58,7 +58,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -66,7 +66,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
@@ -76,7 +76,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=cid
@@ -84,7 +84,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
index c358727..9bab9ba 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -15,14 +15,14 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -30,21 +30,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -55,7 +55,7 @@
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -67,7 +67,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
@@ -75,7 +75,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -83,7 +83,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -91,11 +91,11 @@
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -103,7 +103,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-jaccard/ngram-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-jaccard/ngram-jaccard.4.ast
index 9008db8..58e116f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-jaccard/ngram-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/ngram-jaccard/ngram-jaccard.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -15,7 +15,7 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
@@ -25,13 +25,13 @@
     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 [
@@ -40,7 +40,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -51,7 +51,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -67,7 +67,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -75,7 +75,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -85,7 +85,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -93,7 +93,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
index 3cdd4de..6e695da 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=id
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=id
@@ -29,7 +29,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
@@ -40,7 +40,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=point
@@ -52,27 +52,27 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.spatial-intersect@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=point
       ]
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=point
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -90,7 +90,7 @@
       !=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -100,7 +100,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -108,7 +108,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/word-jaccard-inline/word-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/word-jaccard-inline/word-jaccard-inline.4.ast
index 96bb7a3..5441f6f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/word-jaccard-inline/word-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/word-jaccard-inline/word-jaccard-inline.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -14,14 +14,14 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -29,21 +29,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -52,7 +52,7 @@
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -62,7 +62,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
@@ -70,7 +70,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -78,7 +78,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -86,11 +86,11 @@
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -98,7 +98,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/word-jaccard/word-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/word-jaccard/word-jaccard.4.ast
index 4d58f03..c893d37 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/word-jaccard/word-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-join/word-jaccard/word-jaccard.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
@@ -24,13 +24,13 @@
     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 [
@@ -39,7 +39,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -48,7 +48,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -70,7 +70,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -80,7 +80,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -88,7 +88,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
index 75e1630..7edd08b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -58,13 +58,13 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=countA
@@ -72,7 +72,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -81,7 +81,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -96,13 +96,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -115,7 +115,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
index 22e08c7..bb46aec 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -58,14 +58,14 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=countA
@@ -73,7 +73,7 @@
             =
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=countB
@@ -83,7 +83,7 @@
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -91,7 +91,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -101,7 +101,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -116,13 +116,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -135,7 +135,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx1/probe-pidx-with-join-invidx-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx1/probe-pidx-with-join-invidx-sidx1.3.ast
index b164f90..8530ff2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx1/probe-pidx-with-join-invidx-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx1/probe-pidx-with-join-invidx-sidx1.3.ast
@@ -11,7 +11,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=tweetid
@@ -22,7 +22,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=referred-topics
@@ -41,7 +41,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -52,7 +52,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=referred-topics
@@ -64,21 +64,21 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.similarity-jaccard-check@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=referred-topics
           ]
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=referred-topics
@@ -88,14 +88,14 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -103,7 +103,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -113,7 +113,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -128,13 +128,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -147,7 +147,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
index 86d00ac..24d2dae 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
@@ -11,7 +11,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=tweetid
@@ -22,7 +22,7 @@
         :
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=nested
           ]
           Field=message-text
@@ -41,7 +41,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -52,7 +52,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=message-text
@@ -64,21 +64,21 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.edit-distance-check@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=message-text
           ]
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=message-text
@@ -88,14 +88,14 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -103,7 +103,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -113,7 +113,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -128,13 +128,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -147,7 +147,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
index fa1c6b5..c72f9aa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -58,23 +58,23 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -89,14 +89,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -107,7 +107,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -120,7 +120,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
index 47049b7..ec18922 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -58,25 +58,25 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall test.spatial-intersect@2[
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=sender-location
             ]
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -84,7 +84,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -94,7 +94,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -109,14 +109,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -127,7 +127,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -140,7 +140,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast
index 2918cae..936ea3d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=fname
@@ -29,7 +29,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=lname
@@ -41,7 +41,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=fname
@@ -53,7 +53,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=lname
@@ -65,7 +65,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
index 233c544..312fec7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=fname
@@ -29,7 +29,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=lname
@@ -41,7 +41,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
index 0219928..90d33a6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderkey
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -29,7 +29,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderstatus
@@ -40,7 +40,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=nested
       ]
       Field=o_orderkey
@@ -51,7 +51,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=nested
       ]
       Field=o_custkey
@@ -62,7 +62,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=nested
       ]
       Field=o_orderstatus
@@ -74,20 +74,20 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_custkey
@@ -99,7 +99,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o2 ]
+          Variable [ Name=$o2 ]
           Field=nested
         ]
         Field=o_custkey
@@ -111,7 +111,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_orderstatus
@@ -119,7 +119,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o2 ]
+          Variable [ Name=$o2 ]
           Field=nested
         ]
         Field=o_orderstatus
@@ -129,7 +129,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=o_orderkey
@@ -137,7 +137,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=nested
     ]
     Field=o_orderkey
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.ast
index 4e91616..3802830 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=age
@@ -27,7 +27,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
index 5b4ffed..b9753d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -26,7 +26,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
index bee7846..09d1286 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=id
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
@@ -30,14 +30,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-contains@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=nested
         ]
         Field=title
@@ -50,7 +50,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
index 52f5d52..cdbc35f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -27,6 +27,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast
index df078be..e88d40a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=id
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
@@ -30,24 +30,24 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=word ]
+  Variable [ Name=$word ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=word ]
+      Variable [ Name=$word ]
       LiteralExpr [STRING] [Multmedia]
       LiteralExpr [LONG] [1]
     ]
@@ -56,7 +56,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
index a4ac5f5..9b1b3bb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -27,6 +27,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
index 9b7c3f8..8d3099e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
@@ -3,7 +3,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -11,15 +11,15 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -36,6 +36,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.ast
index 7be42cb..5835c97 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
@@ -31,13 +31,13 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.ast
index 1517ba1..afeb86c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
@@ -31,13 +31,13 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.ast
index 22f03a0..98642fe 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.ast
index 015bb92..d25eefc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=nested
       ]
       Field=interests
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
index 5b4ffed..b9753d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -26,7 +26,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
index 522ef24..53b355e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,15 +10,15 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.ast
index b788785..bc34ba4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderkey
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -30,14 +30,14 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_custkey
@@ -49,7 +49,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_totalprice
@@ -61,7 +61,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=o_orderkey
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
index b788785..bc34ba4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderkey
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -30,14 +30,14 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_custkey
@@ -49,7 +49,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_totalprice
@@ -61,7 +61,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=o_orderkey
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.ast
index 9e1279f..aec9fc9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderkey
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -30,13 +30,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -47,7 +47,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=o_orderkey
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey/orders-index-custkey.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey/orders-index-custkey.4.ast
index 9e1279f..aec9fc9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey/orders-index-custkey.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/orders-index-custkey/orders-index-custkey.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderkey
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -30,13 +30,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -47,7 +47,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=o_orderkey
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/range-search-open/range-search-open.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/range-search-open/range-search-open.4.ast
index ba54bfe..b601d1d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/range-search-open/range-search-open.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/range-search-open/range-search-open.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=l_suppkey
@@ -29,7 +29,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=l_suppkey
@@ -41,7 +41,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=l_orderkey
@@ -49,7 +49,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=l_linenumber
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/range-search/range-search.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/range-search/range-search.4.ast
index ba54bfe..b601d1d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/range-search/range-search.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/range-search/range-search.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=l_suppkey
@@ -29,7 +29,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=l_suppkey
@@ -41,7 +41,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=l_orderkey
@@ -49,7 +49,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=l_linenumber
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.ast
index 85d9f1c..3700f65 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.ast
index 85d9f1c..3700f65 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
index 85d9f1c..3700f65 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/adm-format/adm-format.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/adm-format/adm-format.3.ast
index eec61a4..cfbd249 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/adm-format/adm-format.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/adm-format/adm-format.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=id
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=point
@@ -29,7 +29,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=kwds
@@ -40,7 +40,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=line1
@@ -51,7 +51,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=line2
@@ -62,7 +62,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=poly1
@@ -73,7 +73,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=poly2
@@ -84,7 +84,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=rec
@@ -95,7 +95,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=circle
@@ -107,13 +107,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=nested
       ]
       Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
index fa1c6b5..c72f9aa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -58,23 +58,23 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -89,14 +89,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -107,7 +107,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -120,7 +120,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.3.ast
index 75e1630..7edd08b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/leftouterjoin/leftouterjoin.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -58,13 +58,13 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=countA
@@ -72,7 +72,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -81,7 +81,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -96,13 +96,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -115,7 +115,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/rtree-index/rtree-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/rtree-index/rtree-index.3.ast
index 85d9f1c..3700f65 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/rtree-index/rtree-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/external-indexing/rtree-index/rtree-index.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.3.ast
index 00d2bb7..f18d049 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-closed-top-closed/bottom-closed-top-closed.3.ast
@@ -1,13 +1,13 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=test ]
+Variable [ Name=$test ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
 Where
   OperatorExpr [
@@ -20,7 +20,7 @@
                 FieldAccessor [
                   FieldAccessor [
                     FieldAccessor [
-                      Variable [ Name=test ]
+                      Variable [ Name=$test ]
                       Field=class
                     ]
                     Field=fullClassification
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.3.ast
index 00d2bb7..f18d049 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-closed-top-open/bottom-closed-top-open.3.ast
@@ -1,13 +1,13 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=test ]
+Variable [ Name=$test ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
 Where
   OperatorExpr [
@@ -20,7 +20,7 @@
                 FieldAccessor [
                   FieldAccessor [
                     FieldAccessor [
-                      Variable [ Name=test ]
+                      Variable [ Name=$test ]
                       Field=class
                     ]
                     Field=fullClassification
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.3.ast
index 00d2bb7..f18d049 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-open-top-closed/bottom-open-top-closed.3.ast
@@ -1,13 +1,13 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=test ]
+Variable [ Name=$test ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
 Where
   OperatorExpr [
@@ -20,7 +20,7 @@
                 FieldAccessor [
                   FieldAccessor [
                     FieldAccessor [
-                      Variable [ Name=test ]
+                      Variable [ Name=$test ]
                       Field=class
                     ]
                     Field=fullClassification
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.3.ast
index 00d2bb7..f18d049 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/highly-open-highly-nested/bottom-open-top-open/bottom-open-top-open.3.ast
@@ -1,13 +1,13 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=test ]
+Variable [ Name=$test ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
 Where
   OperatorExpr [
@@ -20,7 +20,7 @@
                 FieldAccessor [
                   FieldAccessor [
                     FieldAccessor [
-                      Variable [ Name=test ]
+                      Variable [ Name=$test ]
                       Field=class
                     ]
                     Field=fullClassification
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast
index 0eb3809..8aa1e0c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=id
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=id
@@ -29,7 +29,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=authors
@@ -41,19 +41,19 @@
     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 [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=authors
@@ -61,7 +61,7 @@
     =
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=authors
@@ -70,7 +70,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -78,7 +78,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
index 858596e..92067a4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -14,14 +14,14 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -29,27 +29,27 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=name
     ]
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=name
@@ -58,7 +58,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [4]
     ]
@@ -66,7 +66,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -74,7 +74,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
@@ -82,11 +82,11 @@
     ]
   ]
 Orderby
-  Variable [ Name=ed ]
+  Variable [ Name=$ed ]
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=cid
@@ -94,7 +94,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.4.ast
index e72556b..46f589e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-edit-distance/ngram-edit-distance.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
@@ -24,13 +24,13 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -38,14 +38,14 @@
       FunctionCall test.edit-distance@2[
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=nested
           ]
           Field=name
         ]
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=nested
           ]
           Field=name
@@ -58,7 +58,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=cid
@@ -66,7 +66,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=cid
@@ -76,7 +76,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=cid
@@ -84,7 +84,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=cid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
index c6eed2e..f5d0407 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -15,14 +15,14 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -30,21 +30,21 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -55,7 +55,7 @@
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -67,7 +67,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
@@ -75,7 +75,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -83,7 +83,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -91,11 +91,11 @@
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -103,7 +103,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-jaccard/ngram-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-jaccard/ngram-jaccard.4.ast
index a0482a9..8f5cc23 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-jaccard/ngram-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/ngram-jaccard/ngram-jaccard.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -15,7 +15,7 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
@@ -25,13 +25,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Where
   OperatorExpr [
@@ -40,7 +40,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -51,7 +51,7 @@
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -67,7 +67,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -75,7 +75,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -85,7 +85,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -93,7 +93,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
index 3cdd4de..6e695da 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=id
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=id
@@ -29,7 +29,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=nested
       ]
       Field=point
@@ -40,7 +40,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=nested
       ]
       Field=point
@@ -52,27 +52,27 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.spatial-intersect@2[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=point
       ]
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=point
@@ -82,7 +82,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -90,7 +90,7 @@
       !=
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -100,7 +100,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -108,7 +108,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/word-jaccard-inline/word-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/word-jaccard-inline/word-jaccard-inline.4.ast
index 96bb7a3..5441f6f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/word-jaccard-inline/word-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/word-jaccard-inline/word-jaccard-inline.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -14,14 +14,14 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -29,21 +29,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=title
@@ -52,7 +52,7 @@
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=title
@@ -62,7 +62,7 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
@@ -70,7 +70,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -78,7 +78,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -86,11 +86,11 @@
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -98,7 +98,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/word-jaccard/word-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/word-jaccard/word-jaccard.4.ast
index 4d58f03..c893d37 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/word-jaccard/word-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-join/word-jaccard/word-jaccard.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [arec]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [brec]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
   )
@@ -24,13 +24,13 @@
     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 [
@@ -39,7 +39,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=a ]
+              Variable [ Name=$a ]
               Field=nested
             ]
             Field=title
@@ -48,7 +48,7 @@
         FunctionCall test.word-tokens@1[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=b ]
+              Variable [ Name=$b ]
               Field=nested
             ]
             Field=title
@@ -62,7 +62,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=nested
         ]
         Field=id
@@ -70,7 +70,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=nested
         ]
         Field=id
@@ -80,7 +80,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=nested
     ]
     Field=id
@@ -88,7 +88,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
index 75e1630..7edd08b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -58,13 +58,13 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=nested
             ]
             Field=countA
@@ -72,7 +72,7 @@
           =
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -81,7 +81,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -96,13 +96,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -115,7 +115,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
index 22e08c7..bb46aec 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=countA
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=countB
@@ -58,14 +58,14 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=countA
@@ -73,7 +73,7 @@
             =
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=countB
@@ -83,7 +83,7 @@
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -91,7 +91,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -101,7 +101,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -116,13 +116,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -135,7 +135,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
index 93da0d9..86082f1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
@@ -10,7 +10,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=tweetid
         ]
       )
@@ -18,7 +18,7 @@
         LiteralExpr [STRING] [topics]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=message-text
         ]
       )
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=message-text
@@ -58,18 +58,18 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.edit-distance-check@3[
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=message-text
           ]
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=message-text
@@ -79,21 +79,21 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=tweetid
             ]
           ]
@@ -101,7 +101,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -116,12 +116,12 @@
     LiteralExpr [STRING] [TweetMessagesTmp]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     >
@@ -131,7 +131,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
index fa1c6b5..c72f9aa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -58,23 +58,23 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -89,14 +89,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -107,7 +107,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -120,7 +120,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
index 47049b7..ec18922 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -35,7 +35,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=tweetid
@@ -46,7 +46,7 @@
           :
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=nested
             ]
             Field=sender-location
@@ -58,25 +58,25 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall test.spatial-intersect@2[
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=sender-location
             ]
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=nested
               ]
               Field=tweetid
@@ -84,7 +84,7 @@
             !=
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=t2 ]
+                Variable [ Name=$t2 ]
                 Field=nested
               ]
               Field=tweetid
@@ -94,7 +94,7 @@
       Orderby
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=nested
           ]
           Field=tweetid
@@ -109,14 +109,14 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=sender-location
@@ -127,7 +127,7 @@
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=nested
       ]
       Field=tweetid
@@ -140,7 +140,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=nested
     ]
     Field=tweetid
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast
index 2918cae..936ea3d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=fname
@@ -29,7 +29,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=lname
@@ -41,7 +41,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=fname
@@ -53,7 +53,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=lname
@@ -65,7 +65,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
index 233c544..312fec7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=fname
@@ -29,7 +29,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=nested
         ]
         Field=lname
@@ -41,7 +41,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
index 0219928..90d33a6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderkey
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -29,7 +29,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderstatus
@@ -40,7 +40,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=nested
       ]
       Field=o_orderkey
@@ -51,7 +51,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=nested
       ]
       Field=o_custkey
@@ -62,7 +62,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=nested
       ]
       Field=o_orderstatus
@@ -74,20 +74,20 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_custkey
@@ -99,7 +99,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o2 ]
+          Variable [ Name=$o2 ]
           Field=nested
         ]
         Field=o_custkey
@@ -111,7 +111,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_orderstatus
@@ -119,7 +119,7 @@
       <
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o2 ]
+          Variable [ Name=$o2 ]
           Field=nested
         ]
         Field=o_orderstatus
@@ -129,7 +129,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=o_orderkey
@@ -137,7 +137,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=nested
     ]
     Field=o_orderkey
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
index 5b4ffed..b9753d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -26,7 +26,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
index bee7846..09d1286 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=id
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=nested
       ]
       Field=title
@@ -30,14 +30,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-contains@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=paper ]
+          Variable [ Name=$paper ]
           Field=nested
         ]
         Field=title
@@ -50,7 +50,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
index 52f5d52..cdbc35f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -27,6 +27,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
index a4ac5f5..9b1b3bb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=authors
@@ -27,6 +27,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
index 9b7c3f8..8d3099e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
@@ -3,7 +3,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -11,15 +11,15 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -36,6 +36,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
index 5b4ffed..b9753d1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,13 +10,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=title
@@ -26,7 +26,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
index 522ef24..53b355e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   Field=nested
 ]
 ]
@@ -10,15 +10,15 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=title
@@ -31,6 +31,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
index b788785..bc34ba4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderkey
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -30,14 +30,14 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_custkey
@@ -49,7 +49,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=nested
         ]
         Field=o_totalprice
@@ -61,7 +61,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=o_orderkey
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.4.ast
index 9e1279f..aec9fc9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/orders-index-custkey/orders-index-custkey.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_orderkey
@@ -18,7 +18,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -30,13 +30,13 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=o_custkey
@@ -47,7 +47,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=o_orderkey
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/range-search/range-search.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/range-search/range-search.4.ast
index ba54bfe..b601d1d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/range-search/range-search.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/range-search/range-search.4.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   Field=nested
 ]
 ]
@@ -10,14 +10,14 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=l_suppkey
@@ -29,7 +29,7 @@
     OperatorExpr [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=nested
         ]
         Field=l_suppkey
@@ -41,7 +41,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=l_orderkey
@@ -49,7 +49,7 @@
   ASC
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=nested
     ]
     Field=l_linenumber
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
index 85d9f1c..3700f65 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nested-open-index/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
@@ -7,7 +7,7 @@
     :
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=id
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=nested
       ]
       Field=point
@@ -46,7 +46,7 @@
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=nested
     ]
     Field=id
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nestrecords/nestrecord/nestrecord.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nestrecords/nestrecord/nestrecord.3.ast
index ecce0a8..1c6d7f0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nestrecords/nestrecord/nestrecord.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/nestrecords/nestrecord/nestrecord.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/heterog-list-ordered01/heterog-list-ordered01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/heterog-list-ordered01/heterog-list-ordered01.3.ast
index 002d421..69306dc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/heterog-list-ordered01/heterog-list-ordered01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/heterog-list-ordered01/heterog-list-ordered01.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [T1]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/heterog-list01/heterog-list01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/heterog-list01/heterog-list01.3.ast
index 002d421..69306dc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/heterog-list01/heterog-list01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/heterog-list01/heterog-list01.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [T1]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-01/open-closed-01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-01/open-closed-01.3.ast
index 25fd257..b3df586 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-01/open-closed-01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-01/open-closed-01.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-12/open-closed-12.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-12/open-closed-12.3.ast
index 07560d2..f646e71 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-12/open-closed-12.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-12/open-closed-12.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds01]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-14/open-closed-14.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-14/open-closed-14.3.ast
index 07560d2..f646e71 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-14/open-closed-14.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-14/open-closed-14.3.ast
@@ -1,17 +1,17 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds01]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-24/open-closed-24.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-24/open-closed-24.3.ast
index 16bb849..ef5fc9e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-24/open-closed-24.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-24/open-closed-24.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-25/open-closed-25.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-25/open-closed-25.3.ast
index 16bb849..ef5fc9e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-25/open-closed-25.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-25/open-closed-25.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-26/open-closed-26.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-26/open-closed-26.3.ast
index 16bb849..ef5fc9e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-26/open-closed-26.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-26/open-closed-26.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-29/open-closed-29.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-29/open-closed-29.3.ast
index a5a324d..267c4a4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-29/open-closed-29.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-29/open-closed-29.3.ast
@@ -1,26 +1,26 @@
 DataverseUse testdv2
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds01]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=h ]
+    [Variable [ Name=$h ]
     In
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=hobbies
       ]
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=h ]
+        Variable [ Name=$h ]
         =
         LiteralExpr [STRING] [hiking]
       ]
@@ -28,7 +28,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-31/open-closed-31.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-31/open-closed-31.3.ast
index 1435afe..17806f1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-31/open-closed-31.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-31/open-closed-31.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
   Field=hobbies
 ]
 ]
@@ -10,20 +10,20 @@
     LiteralExpr [STRING] [testds01]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=h ]
+    [Variable [ Name=$h ]
     In
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=hobbies
       ]
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=h ]
+        Variable [ Name=$h ]
         =
         LiteralExpr [STRING] [hiking]
       ]
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-32/open-closed-32.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-32/open-closed-32.3.ast
index c6c43cf..7f55a44 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-32/open-closed-32.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-32/open-closed-32.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
   Field=interests
 ]
 ]
@@ -10,20 +10,20 @@
     LiteralExpr [STRING] [testds01]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=h ]
+    [Variable [ Name=$h ]
     In
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=h ]
+        Variable [ Name=$h ]
         =
         LiteralExpr [STRING] [biking]
       ]
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-33/open-closed-33.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-33/open-closed-33.3.ast
index c6c43cf..7f55a44 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-33/open-closed-33.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/open-closed-33/open-closed-33.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
   Field=interests
 ]
 ]
@@ -10,20 +10,20 @@
     LiteralExpr [STRING] [testds01]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=h ]
+    [Variable [ Name=$h ]
     In
       FieldAccessor [
-        Variable [ Name=d ]
+        Variable [ Name=$d ]
         Field=interests
       ]
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=h ]
+        Variable [ Name=$h ]
         =
         LiteralExpr [STRING] [biking]
       ]
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue196/query-issue196.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue196/query-issue196.3.ast
index 5ec0d31..edae02b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue196/query-issue196.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue196/query-issue196.3.ast
@@ -6,17 +6,17 @@
     :
     (
       SELECT ELEMENT [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       ]
       FROM [        FunctionCall Metadata.dataset@1[
           LiteralExpr [STRING] [t1]
         ]
         AS
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
       ]
       Orderby
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=id
         ]
         ASC
@@ -28,17 +28,17 @@
     :
     (
       SELECT ELEMENT [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       ]
       FROM [        FunctionCall Metadata.dataset@1[
           LiteralExpr [STRING] [t2]
         ]
         AS
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
       ]
       Orderby
         FieldAccessor [
-          Variable [ Name=m ]
+          Variable [ Name=$m ]
           Field=id
         ]
         ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue208/query-issue208.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue208/query-issue208.3.ast
index 997d5f8..83a56f6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue208/query-issue208.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue208/query-issue208.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=uid ]
+    Variable [ Name=$uid ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall OpenSocialNetworkData.count@1[
-      Variable [ Name=t ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=t
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,13 +31,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=send-time
       ]
       >=
@@ -37,7 +48,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=send-time
       ]
       <=
@@ -47,19 +58,23 @@
     ]
   ]
 Groupby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   :=
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=user
     ]
     Field=screen-name
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
 Orderby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue236/query-issue236.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue236/query-issue236.3.ast
index 3317b03..47ffdfb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue236/query-issue236.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue236/query-issue236.3.ast
@@ -1,11 +1,11 @@
 DataverseUse SocialNetworkData
 Query:
 SELECT ELEMENT [
-Variable [ Name=r ]
+Variable [ Name=$r ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue258/query-issue258.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue258/query-issue258.3.ast
index 610ef261..30ad54e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue258/query-issue258.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue258/query-issue258.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [ds1]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue343-2/query-issue343-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue343-2/query-issue343-2.3.ast
index 1655396..3c2f800 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue343-2/query-issue343-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue343-2/query-issue343-2.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [All]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue343/query-issue343.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue343/query-issue343.3.ast
index 1655396..3c2f800 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue343/query-issue343.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue343/query-issue343.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [All]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue350-2/query-issue350-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue350-2/query-issue350-2.3.ast
index be95a14..2deffa7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue350-2/query-issue350-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue350-2/query-issue350-2.3.ast
@@ -1,21 +1,21 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=tm ]
+Variable [ Name=$tm ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=tm ]
+  Variable [ Name=$tm ]
 ]
 Where
   QuantifiedExpression EVERY [
-    [Variable [ Name=h ]
+    [Variable [ Name=$h ]
     In
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=tm ]
+          Variable [ Name=$tm ]
           Field=user
         ]
         Field=hobbies
@@ -23,7 +23,7 @@
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=h ]
+        Variable [ Name=$h ]
         =
         LiteralExpr [STRING] [basket weaving]
       ]
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=tm ]
+    Variable [ Name=$tm ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue350/query-issue350.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue350/query-issue350.3.ast
index a0847c0..5cd7e6b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue350/query-issue350.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue350/query-issue350.3.ast
@@ -1,21 +1,21 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=tm ]
+Variable [ Name=$tm ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=tm ]
+  Variable [ Name=$tm ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=h ]
+    [Variable [ Name=$h ]
     In
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=tm ]
+          Variable [ Name=$tm ]
           Field=user
         ]
         Field=hobbies
@@ -23,7 +23,7 @@
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=h ]
+        Variable [ Name=$h ]
         =
         LiteralExpr [STRING] [basket weaving]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue377/query-issue377.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue377/query-issue377.3.ast
index ece5063..ba39c82 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue377/query-issue377.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue377/query-issue377.3.ast
@@ -8,7 +8,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=id
     ]
   )
@@ -16,7 +16,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=name
     ]
   )
@@ -30,7 +30,7 @@
           LiteralExpr [STRING] [twitter-screenname]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=screen-name
           ]
         )
@@ -38,7 +38,7 @@
           LiteralExpr [STRING] [twitter-name]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=name
           ]
         )
@@ -48,23 +48,23 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
       ]
-      LetVariable [ Name=tu ]
+      Let Variable [ Name=$tu ]
         :=
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=user
         ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=name
           ]
           ~=
           FieldAccessor [
-            Variable [ Name=fbu ]
+            Variable [ Name=$fbu ]
             Field=name
           ]
         ]
@@ -76,11 +76,11 @@
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=fbu ]
+  Variable [ Name=$fbu ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue410/query-issue410.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue410/query-issue410.3.ast
index 1b4ae26..ee20fb7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue410/query-issue410.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue410/query-issue410.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Employee]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue423-2/query-issue423-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue423-2/query-issue423-2.3.ast
index ede9e5f..be43c46 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue423-2/query-issue423-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue423-2/query-issue423-2.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [l]
     :
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
   )
   (
     LiteralExpr [STRING] [m]
     :
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
   )
 ]
 ]
@@ -18,23 +18,23 @@
     LiteralExpr [STRING] [t1]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [t2]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=age
     ]
     >
     FieldAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Field=age
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue423/query-issue423.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue423/query-issue423.3.ast
index 75a5727..8ac9af5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue423/query-issue423.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue423/query-issue423.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [l]
     :
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
   )
   (
     LiteralExpr [STRING] [m]
     :
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
   )
 ]
 ]
@@ -18,23 +18,23 @@
     LiteralExpr [STRING] [t1]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [t2]
   ]
   AS
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=name
     ]
     =
     FieldAccessor [
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
       Field=name
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue442/query-issue442.1.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue442/query-issue442.1.ast
index f523bca..deb43af 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue442/query-issue442.1.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue442/query-issue442.1.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     RecordConstructor [
@@ -54,11 +54,11 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=f
   ]
   DESC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue453-2/query-issue453-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue453-2/query-issue453-2.3.ast
index 58b7098..a4e44c9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue453-2/query-issue453-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue453-2/query-issue453-2.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DataOpen]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue453/query-issue453.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue453/query-issue453.3.ast
index 58b7098..a4e44c9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue453/query-issue453.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue453/query-issue453.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DataOpen]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
index 8783570..4c5e405 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
@@ -2,9 +2,20 @@
 Query:
 SELECT ELEMENT [
 OrderedListConstructor [
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
   FunctionCall test.count@1[
-    Variable [ Name=id ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=id
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
 ]
 ]
@@ -12,22 +23,27 @@
     LiteralExpr [STRING] [DataOpen]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
-LetVariable [ Name=id ]
+Let Variable [ Name=$id ]
   :=
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=id
   ]
 Groupby
-  Variable [ Name=m ]
+  Variable [ Name=$m ]
   :=
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=int_m
   ]
-  With
-  Variable [ Name=id ]
-  Variable [ Name=x ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$id ]
+   AS id
+  Variable [ Name=$x ]
+   AS x
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue487/query-issue487.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue487/query-issue487.3.ast
index af7f457..83f1bf6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue487/query-issue487.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue487/query-issue487.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue55-1/query-issue55-1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue55-1/query-issue55-1.3.ast
index 289595f..6a5b504 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue55-1/query-issue55-1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue55-1/query-issue55-1.3.ast
@@ -1,5 +1,5 @@
 Query:
-LetVariable [ Name=l ]
+Let Variable [ Name=$l ]
   :=
   OrderedListConstructor [
     LiteralExpr [FLOAT] [1.1]
@@ -12,45 +12,45 @@
   ]
 SELECT ELEMENT [
 OrderedListConstructor [
-  Variable [ Name=i ]
-  Variable [ Name=j ]
+  Variable [ Name=$i ]
+  Variable [ Name=$j ]
   LiteralExpr [STRING] [=]
   OperatorExpr [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     =
-    Variable [ Name=j ]
+    Variable [ Name=$j ]
   ]
   LiteralExpr [STRING] [<]
   OperatorExpr [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     <
-    Variable [ Name=j ]
+    Variable [ Name=$j ]
   ]
   LiteralExpr [STRING] [<=]
   OperatorExpr [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     <=
-    Variable [ Name=j ]
+    Variable [ Name=$j ]
   ]
   LiteralExpr [STRING] [>]
   OperatorExpr [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     >
-    Variable [ Name=j ]
+    Variable [ Name=$j ]
   ]
   LiteralExpr [STRING] [>=]
   OperatorExpr [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     >=
-    Variable [ Name=j ]
+    Variable [ Name=$j ]
   ]
 ]
 ]
-FROM [  Variable [ Name=l ]
+FROM [  Variable [ Name=$l ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ,
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue55/query-issue55.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue55/query-issue55.3.ast
index 0fe628b..086073e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue55/query-issue55.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue55/query-issue55.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     OrderedListConstructor [
@@ -22,5 +22,5 @@
     ]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue592/query-issue592.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue592/query-issue592.3.ast
index 60d7624..18131ad 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue592/query-issue592.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue592/query-issue592.3.ast
@@ -1,11 +1,11 @@
 DataverseUse fooverse
 Query:
 SELECT ELEMENT [
-Variable [ Name=f ]
+Variable [ Name=$f ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [fooset]
   ]
   AS
-  Variable [ Name=f ]
+  Variable [ Name=$f ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue625/query-issue625.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue625/query-issue625.3.ast
index fba4dc7..4003453 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue625/query-issue625.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue625/query-issue625.3.ast
@@ -1,11 +1,11 @@
 DataverseUse fooverse
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Foo]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-proposal/query-proposal.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-proposal/query-proposal.3.ast
index 13c7cf3..c634a18 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-proposal/query-proposal.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-proposal/query-proposal.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [topic]
     :
-    Variable [ Name=tp2 ]
+    Variable [ Name=$tp2 ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=tp1 ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=tp1
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -22,7 +33,7 @@
       (
         LiteralExpr [STRING] [topic]
         :
-        Variable [ Name=tp ]
+        Variable [ Name=$tp ]
       )
     ]
     ]
@@ -30,46 +41,50 @@
         LiteralExpr [STRING] [TweetMessages]
       ]
       AS
-      Variable [ Name=tweet ]
+      Variable [ Name=$tweet ]
 ,
       FieldAccessor [
-        Variable [ Name=tweet ]
+        Variable [ Name=$tweet ]
         Field=referred-topics
       ]
       AS
-      Variable [ Name=tp ]
+      Variable [ Name=$tp ]
     ]
     Where
       QuantifiedExpression SOME [
-        [Variable [ Name=topic ]
+        [Variable [ Name=$topic ]
         In
           FieldAccessor [
-            Variable [ Name=tweet ]
+            Variable [ Name=$tweet ]
             Field=referred-topics
           ]
         ]
         Satifies [
           FunctionCall test.contains@2[
-            Variable [ Name=topic ]
+            Variable [ Name=$topic ]
             LiteralExpr [STRING] [verizon]
           ]
         ]
       ]
   )
   AS
-  Variable [ Name=tp1 ]
+  Variable [ Name=$tp1 ]
 ]
 Groupby
-  Variable [ Name=tp2 ]
+  Variable [ Name=$tp2 ]
   :=
   FieldAccessor [
-    Variable [ Name=tp1 ]
+    Variable [ Name=$tp1 ]
     Field=topic
   ]
-  With
-  Variable [ Name=tp1 ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$tp1 ]
+   AS tp1
+  )
 
 Orderby
-  Variable [ Name=tp2 ]
+  Variable [ Name=$tp2 ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-proposal02/query-proposal02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-proposal02/query-proposal02.3.ast
index d58a2f4..1981fc7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-proposal02/query-proposal02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-proposal02/query-proposal02.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [topic]
     :
-    Variable [ Name=topic ]
+    Variable [ Name=$topic ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=tweet ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=tweet
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,40 +31,45 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=tweet ]
+  Variable [ Name=$tweet ]
 ,
   FieldAccessor [
-    Variable [ Name=tweet ]
+    Variable [ Name=$tweet ]
     Field=referred-topics
   ]
   AS
-  Variable [ Name=reftopic ]
+  Variable [ Name=$reftopic ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=reftopic ]
+    [Variable [ Name=$reftopic ]
     In
       FieldAccessor [
-        Variable [ Name=tweet ]
+        Variable [ Name=$tweet ]
         Field=referred-topics
       ]
     ]
     Satifies [
       FunctionCall test.contains@2[
-        Variable [ Name=reftopic ]
+        Variable [ Name=$reftopic ]
         LiteralExpr [STRING] [verizon]
       ]
     ]
   ]
 Groupby
-  Variable [ Name=topic ]
+  Variable [ Name=$topic ]
   :=
-  Variable [ Name=reftopic ]
-  With
-  Variable [ Name=tweet ]
-  Variable [ Name=reftopic ]
+  Variable [ Name=$reftopic ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$reftopic ]
+   AS reftopic
+  Variable [ Name=$tweet ]
+   AS tweet
+  )
 
 Orderby
-  Variable [ Name=topic ]
+  Variable [ Name=$topic ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/adm-format/adm-format.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/adm-format/adm-format.3.ast
index a4fec17..0244805 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/adm-format/adm-format.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/adm-format/adm-format.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=d ]
+Variable [ Name=$d ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=d ]
+      Variable [ Name=$d ]
       Field=id
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
index 317564b..ab69658 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/leftouterjoin-rtree/leftouterjoin-rtree.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -46,19 +46,19 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -71,13 +71,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -85,7 +85,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -95,7 +95,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.3.ast
index d3b6da5..cec3efa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/leftouterjoin/leftouterjoin.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -46,23 +46,23 @@
           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
@@ -75,12 +75,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -90,7 +90,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/rtree-index/rtree-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/rtree-index/rtree-index.3.ast
index fe2fa6b..1302b5e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/rtree-index/rtree-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/external-indexing/rtree-index/rtree-index.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast
index 9a0aef7..0b9e26c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [aid]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [bid]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=id
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
   )
@@ -32,34 +32,34 @@
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=authors
     ]
     =
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=authors
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
index 6ad6d9e..9522d38 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-edit-distance-inline/ngram-edit-distance-inline.4.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [ed]
     :
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
   )
 ]
 ]
@@ -23,56 +23,56 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance@2[
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=name
     ]
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=name
     ]
   ]
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=ed ]
+      Variable [ Name=$ed ]
       <=
       LiteralExpr [LONG] [4]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
-  Variable [ Name=ed ]
+  Variable [ Name=$ed ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.4.ast
index e9fb1bc..81773e8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-edit-distance/ngram-edit-distance.4.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -18,24 +18,24 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FunctionCall test.edit-distance@2[
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=name
         ]
         FieldAccessor [
-          Variable [ Name=b ]
+          Variable [ Name=$b ]
           Field=name
         ]
       ]
@@ -45,24 +45,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=cid
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=cid
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=cid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
index 476b69b..0323a1f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-jaccard-inline/ngram-jaccard-inline.4.ast
@@ -6,17 +6,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -24,20 +24,20 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -45,7 +45,7 @@
     ]
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -55,33 +55,33 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.4.ast
index b47c49e..6676c21 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/ngram-jaccard/ngram-jaccard.4.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -19,13 +19,13 @@
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Where
   OperatorExpr [
@@ -33,7 +33,7 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -41,7 +41,7 @@
         ]
         FunctionCall test.gram-tokens@3[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
           LiteralExpr [LONG] [3]
@@ -54,24 +54,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
index ccd4ff4..3d59488 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/rtree-spatial-intersect-point/rtree-spatial-intersect-point.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [aid]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [bid]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=id
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [apt]
     :
     FieldAccessor [
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       Field=point
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [bp]
     :
     FieldAccessor [
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       Field=point
     ]
   )
@@ -40,47 +40,47 @@
     LiteralExpr [STRING] [MyData1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [MyData2]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.spatial-intersect@2[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=point
       ]
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=point
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       !=
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.4.ast
index 4d1c988..7e52dbd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/word-jaccard-inline/word-jaccard-inline.4.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
   (
     LiteralExpr [STRING] [jacc]
     :
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
   )
 ]
 ]
@@ -23,26 +23,26 @@
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard@2[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=title
       ]
     ]
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=title
       ]
     ]
@@ -50,33 +50,33 @@
 Where
   OperatorExpr [
     OperatorExpr [
-      Variable [ Name=jacc ]
+      Variable [ Name=$jacc ]
       >=
       LiteralExpr [FLOAT] [0.5]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
-  Variable [ Name=jacc ]
+  Variable [ Name=$jacc ]
   ASC
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/word-jaccard/word-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/word-jaccard/word-jaccard.4.ast
index 0ec37cd..4805b30 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/word-jaccard/word-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-join/word-jaccard/word-jaccard.4.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [arec]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [brec]
     :
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
   )
 ]
 ]
@@ -18,13 +18,13 @@
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
 ]
 Where
   OperatorExpr [
@@ -32,13 +32,13 @@
       FunctionCall test.similarity-jaccard@2[
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=a ]
+            Variable [ Name=$a ]
             Field=title
           ]
         ]
         FunctionCall test.word-tokens@1[
           FieldAccessor [
-            Variable [ Name=b ]
+            Variable [ Name=$b ]
             Field=title
           ]
         ]
@@ -49,24 +49,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       <
       FieldAccessor [
-        Variable [ Name=b ]
+        Variable [ Name=$b ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=b ]
+    Variable [ Name=$b ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
index d3b6da5..cec3efa 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx1/probe-pidx-with-join-btree-sidx1.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -46,23 +46,23 @@
           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
@@ -75,12 +75,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -90,7 +90,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
index 54e08f4..3d039dd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-btree-sidx2/probe-pidx-with-join-btree-sidx2.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [count1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=countA
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [count2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=countB
           ]
         )
@@ -46,37 +46,37 @@
           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
@@ -89,12 +89,12 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -104,7 +104,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
index 9579313..e036e4d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-invidx-sidx2/probe-pidx-with-join-invidx-sidx2.3.ast
@@ -10,7 +10,7 @@
         LiteralExpr [STRING] [id]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=tweetid
         ]
       )
@@ -18,7 +18,7 @@
         LiteralExpr [STRING] [topics]
         :
         FieldAccessor [
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
           Field=message-text
         ]
       )
@@ -34,7 +34,7 @@
           LiteralExpr [STRING] [id]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -42,7 +42,7 @@
           LiteralExpr [STRING] [topics]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
         )
@@ -52,17 +52,17 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
-      LetVariable [ Name=sim ]
+      Let Variable [ Name=$sim ]
         :=
         FunctionCall test.edit-distance-check@3[
           FieldAccessor [
-            Variable [ Name=t1 ]
+            Variable [ Name=$t1 ]
             Field=message-text
           ]
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
           LiteralExpr [LONG] [7]
@@ -70,25 +70,25 @@
       Where
         OperatorExpr [
           IndexAccessor [
-            Variable [ Name=sim ]
+            Variable [ Name=$sim ]
             Index:             LiteralExpr [LONG] [0]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -101,12 +101,12 @@
     LiteralExpr [STRING] [TweetMessagesTmp]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     >
@@ -116,7 +116,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
index 317564b..ab69658 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx1/probe-pidx-with-join-rtree-sidx1.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -46,19 +46,19 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         FunctionCall test.spatial-intersect@2[
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -71,13 +71,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -85,7 +85,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -95,7 +95,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
index 13d31f3..b7f77df 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-leftouterjoin/probe-pidx-with-join-rtree-sidx2/probe-pidx-with-join-rtree-sidx2.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [tweetid1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [loc1]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
   )
@@ -28,7 +28,7 @@
           LiteralExpr [STRING] [tweetid2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=tweetid
           ]
         )
@@ -36,7 +36,7 @@
           LiteralExpr [STRING] [loc2]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sender-location
           ]
         )
@@ -46,33 +46,33 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall test.spatial-intersect@2[
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=sender-location
             ]
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           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
@@ -85,13 +85,13 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
-LetVariable [ Name=n ]
+Let Variable [ Name=$n ]
   :=
   FunctionCall test.create-circle@2[
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=sender-location
     ]
     LiteralExpr [DOUBLE] [0.5]
@@ -99,7 +99,7 @@
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=tweetid
     ]
     <
@@ -109,7 +109,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast
index 4374c0a..406debe 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-composite-key-mixed-intervals/btree-index-composite-key-mixed-intervals.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [fname]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=fname
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [lname]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=lname
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [age]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=age
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [dept]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=dept
     ]
   )
@@ -48,13 +48,13 @@
     LiteralExpr [STRING] [employeeOpen]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=fname
       ]
       >
@@ -63,7 +63,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=lname
       ]
       >
@@ -72,7 +72,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=fname
       ]
       <=
@@ -81,7 +81,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=lname
       ]
       <
@@ -90,7 +90,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
index 4538044..62f447c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-composite-key/btree-index-composite-key.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [fname]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=fname
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [lname]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=lname
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [age]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=age
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [dept]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=dept
     ]
   )
@@ -48,13 +48,13 @@
     LiteralExpr [STRING] [employeeOpen]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=fname
       ]
       =
@@ -63,7 +63,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=lname
       ]
       =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
index 8a15b80..c86de28 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [o_orderstatus]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderstatus
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [o_orderkey2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=o_orderkey
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [o_custkey2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=o_custkey
     ]
   )
@@ -46,7 +46,7 @@
     LiteralExpr [STRING] [o_orderstatus2]
     :
     FieldAccessor [
-      Variable [ Name=o2 ]
+      Variable [ Name=$o2 ]
       Field=o_orderstatus
     ]
   )
@@ -56,19 +56,19 @@
     LiteralExpr [STRING] [OrdersOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [OrdersOpen]
   ]
   AS
-  Variable [ Name=o2 ]
+  Variable [ Name=$o2 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -77,7 +77,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=o_custkey
       ]
       =
@@ -86,24 +86,24 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderstatus
       ]
       <
       FieldAccessor [
-        Variable [ Name=o2 ]
+        Variable [ Name=$o2 ]
         Field=o_orderstatus
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=o2 ]
+    Variable [ Name=$o2 ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
index ec2521b..a0b8175 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dblpid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=dblpid
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [misc]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=misc
     ]
   )
@@ -48,19 +48,19 @@
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
index f2263bc..4cabd9d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-contains/inverted-index-ngram-edit-distance-contains.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   )
@@ -24,13 +24,13 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-contains@3[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
       LiteralExpr [STRING] [Multmedia]
@@ -40,7 +40,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
index 439ed75..a545fe2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dblpid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=dblpid
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [misc]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=misc
     ]
   )
@@ -48,13 +48,13 @@
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -62,6 +62,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast
index 81a4e5e..73897d2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance-word-tokens/inverted-index-ngram-edit-distance-word-tokens.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   )
@@ -24,21 +24,21 @@
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ,
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
   AS
-  Variable [ Name=word ]
+  Variable [ Name=$word ]
 ]
 Where
   IndexAccessor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=word ]
+      Variable [ Name=$word ]
       LiteralExpr [STRING] [Multmedia]
       LiteralExpr [LONG] [1]
     ]
@@ -46,7 +46,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
index 8d0c1ac..b290bfc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dblpid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=dblpid
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [misc]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=misc
     ]
   )
@@ -48,13 +48,13 @@
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=ed ]
+Let Variable [ Name=$ed ]
   :=
   FunctionCall test.edit-distance-check@3[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
     LiteralExpr [STRING] [Amihay Motro]
@@ -62,6 +62,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=ed ]
+    Variable [ Name=$ed ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
index 74af353..0044993 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.ast
@@ -7,7 +7,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -15,7 +15,7 @@
     LiteralExpr [STRING] [dblpid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=dblpid
     ]
   )
@@ -23,7 +23,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
   )
@@ -31,7 +31,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
   )
@@ -39,7 +39,7 @@
     LiteralExpr [STRING] [misc]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=misc
     ]
   )
@@ -49,14 +49,14 @@
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.gram-tokens@3[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
       LiteralExpr [LONG] [3]
@@ -71,6 +71,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
index ec2521b..a0b8175 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dblpid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=dblpid
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [misc]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=misc
     ]
   )
@@ -48,19 +48,19 @@
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.contains@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
     LiteralExpr [STRING] [Multimedia]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
index 9674565..3a09fdc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dblpid]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=dblpid
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [title]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=title
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [authors]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=authors
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [misc]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=misc
     ]
   )
@@ -48,14 +48,14 @@
     LiteralExpr [STRING] [DBLPOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=title
       ]
     ]
@@ -66,6 +66,6 @@
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
index 3afcf57..974a605 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -24,13 +24,13 @@
     LiteralExpr [STRING] [OrdersOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
       =
@@ -39,7 +39,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_totalprice
       ]
       >
@@ -48,7 +48,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/orders-index-custkey/orders-index-custkey.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/orders-index-custkey/orders-index-custkey.4.ast
index 0b2750d..bc40add 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/orders-index-custkey/orders-index-custkey.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/orders-index-custkey/orders-index-custkey.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [OrdersOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
     =
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/range-search/range-search.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/range-search/range-search.4.ast
index d84a04d9..53ad9b5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/range-search/range-search.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/range-search/range-search.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItemOpen]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       <
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=l_suppkey
       ]
       >
@@ -31,12 +31,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
index 7ab550f..7de4b89 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-index-enforced/index-selection/rtree-secondary-index/rtree-secondary-index.4.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyDataOpen]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/everysat_01/everysat_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/everysat_01/everysat_01.3.ast
index d836e4d..aee5069 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/everysat_01/everysat_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/everysat_01/everysat_01.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [10]
     NEGATIVE LiteralExpr [LONG] [30]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   QuantifiedExpression EVERY [
-    [Variable [ Name=y ]
+    [Variable [ Name=$y ]
     In
       OrderedListConstructor [
         NEGATIVE LiteralExpr [LONG] [20]
@@ -21,9 +21,9 @@
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
         >
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/everysat_04/everysat_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/everysat_04/everysat_04.3.ast
index 44d3f63..5808cbf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/everysat_04/everysat_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/everysat_04/everysat_04.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=x ]
+Let Variable [ Name=$x ]
   :=
   OrderedListConstructor [
     QuantifiedExpression EVERY [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [FALSE]
@@ -13,11 +13,11 @@
         ]
       ]
       Satifies [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
     QuantifiedExpression EVERY [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [TRUE]
@@ -25,11 +25,11 @@
         ]
       ]
       Satifies [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
     QuantifiedExpression EVERY [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [FALSE]
@@ -37,11 +37,11 @@
         ]
       ]
       Satifies [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
     QuantifiedExpression EVERY [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [TRUE]
@@ -49,11 +49,11 @@
         ]
       ]
       Satifies [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
     QuantifiedExpression EVERY [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [FALSE]
@@ -62,12 +62,12 @@
       ]
       Satifies [
         FunctionCall test.not@1[
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       ]
     ]
     QuantifiedExpression EVERY [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [TRUE]
@@ -76,12 +76,12 @@
       ]
       Satifies [
         FunctionCall test.not@1[
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       ]
     ]
     QuantifiedExpression EVERY [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [FALSE]
@@ -90,12 +90,12 @@
       ]
       Satifies [
         FunctionCall test.not@1[
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       ]
     ]
     QuantifiedExpression EVERY [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [TRUE]
@@ -104,15 +104,15 @@
       ]
       Satifies [
         FunctionCall test.not@1[
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       ]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=x ]
+FROM [  Variable [ Name=$x ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_01/somesat_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_01/somesat_01.3.ast
index a39bcb5..e1e8b65 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_01/somesat_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_01/somesat_01.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [10]
@@ -10,11 +10,11 @@
     LiteralExpr [LONG] [50]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=y ]
+    [Variable [ Name=$y ]
     In
       OrderedListConstructor [
         NEGATIVE LiteralExpr [LONG] [20]
@@ -23,9 +23,9 @@
     ]
     Satifies [
       OperatorExpr [
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
         >
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_02/somesat_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_02/somesat_02.3.ast
index ab31857..7aebb09 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_02/somesat_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_02/somesat_02.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
   Field=cid
 ]
 ]
@@ -10,11 +10,11 @@
     LiteralExpr [STRING] [CustomerSomeSat02]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=y ]
+    [Variable [ Name=$y ]
     In
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [OrdersSomeSat02]
@@ -23,12 +23,12 @@
     Satifies [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=y ]
+          Variable [ Name=$y ]
           Field=cid
         ]
         =
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=cid
         ]
       ]
@@ -36,7 +36,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_06/somesat_06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_06/somesat_06.3.ast
index 2ed5885..d0d67f4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_06/somesat_06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/quantifiers/somesat_06/somesat_06.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=x ]
+Let Variable [ Name=$x ]
   :=
   OrderedListConstructor [
     QuantifiedExpression SOME [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [FALSE]
@@ -13,11 +13,11 @@
         ]
       ]
       Satifies [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
     QuantifiedExpression SOME [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [TRUE]
@@ -25,11 +25,11 @@
         ]
       ]
       Satifies [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
     QuantifiedExpression SOME [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [FALSE]
@@ -37,11 +37,11 @@
         ]
       ]
       Satifies [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
     QuantifiedExpression SOME [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [TRUE]
@@ -49,11 +49,11 @@
         ]
       ]
       Satifies [
-        Variable [ Name=x ]
+        Variable [ Name=$x ]
       ]
     ]
     QuantifiedExpression SOME [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [FALSE]
@@ -62,12 +62,12 @@
       ]
       Satifies [
         FunctionCall test.not@1[
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       ]
     ]
     QuantifiedExpression SOME [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [TRUE]
@@ -76,12 +76,12 @@
       ]
       Satifies [
         FunctionCall test.not@1[
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       ]
     ]
     QuantifiedExpression SOME [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [FALSE]
@@ -90,12 +90,12 @@
       ]
       Satifies [
         FunctionCall test.not@1[
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       ]
     ]
     QuantifiedExpression SOME [
-      [Variable [ Name=x ]
+      [Variable [ Name=$x ]
       In
         OrderedListConstructor [
           LiteralExpr [TRUE]
@@ -104,15 +104,15 @@
       ]
       Satifies [
         FunctionCall test.not@1[
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
         ]
       ]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=x ]
+FROM [  Variable [ Name=$x ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.4.ast
index bfdfa6a..b071d6b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.4.ast
@@ -1,17 +1,17 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=screen-name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.5.ast
index bea7ba6..eea3f99 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.5.ast
@@ -1,17 +1,17 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=screen-name
   ]
   DESC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.6.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.6.ast
index f355a3e..b4cd41e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.6.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.6.ast
@@ -1,17 +1,17 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=friends_count
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.7.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.7.ast
index 0a275c4..3aafcb2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.7.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.7.ast
@@ -1,17 +1,17 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=friends_count
   ]
   DESC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.10.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.10.ast
index f0ad634..816bb17 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.10.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.10.ast
@@ -1,26 +1,26 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=test ]
+      Variable [ Name=$test ]
       Field=class
     ]
     Field=fullClassification
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.11.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.11.ast
index a6821b5..2198926 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.11.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.11.ast
@@ -1,23 +1,23 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FieldAccessor [
-    Variable [ Name=test ]
+    Variable [ Name=$test ]
     Field=class
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.12.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.12.ast
index 803de17..4cf3180 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.12.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.12.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.3.ast
index 8e283f1..640f2f4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.3.ast
@@ -1,15 +1,15 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FieldAccessor [
     FieldAccessor [
@@ -20,7 +20,7 @@
               FieldAccessor [
                 FieldAccessor [
                   FieldAccessor [
-                    Variable [ Name=test ]
+                    Variable [ Name=$test ]
                     Field=class
                   ]
                   Field=fullClassification
@@ -40,6 +40,6 @@
     Field=Species
   ]
 Orderby
-  Variable [ Name=result ]
+  Variable [ Name=$result ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.4.ast
index 37657b9..8f6dd8a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.4.ast
@@ -1,15 +1,15 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FieldAccessor [
     FieldAccessor [
@@ -19,7 +19,7 @@
             FieldAccessor [
               FieldAccessor [
                 FieldAccessor [
-                  Variable [ Name=test ]
+                  Variable [ Name=$test ]
                   Field=class
                 ]
                 Field=fullClassification
@@ -38,7 +38,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.5.ast
index d7bf2cc..c990329 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.5.ast
@@ -1,15 +1,15 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FieldAccessor [
     FieldAccessor [
@@ -18,7 +18,7 @@
           FieldAccessor [
             FieldAccessor [
               FieldAccessor [
-                Variable [ Name=test ]
+                Variable [ Name=$test ]
                 Field=class
               ]
               Field=fullClassification
@@ -35,7 +35,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.6.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.6.ast
index f1eba54..683e01e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.6.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.6.ast
@@ -1,15 +1,15 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FieldAccessor [
     FieldAccessor [
@@ -17,7 +17,7 @@
         FieldAccessor [
           FieldAccessor [
             FieldAccessor [
-              Variable [ Name=test ]
+              Variable [ Name=$test ]
               Field=class
             ]
             Field=fullClassification
@@ -32,7 +32,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.7.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.7.ast
index dc420c6..fb9178e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.7.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.7.ast
@@ -1,22 +1,22 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FieldAccessor [
     FieldAccessor [
       FieldAccessor [
         FieldAccessor [
           FieldAccessor [
-            Variable [ Name=test ]
+            Variable [ Name=$test ]
             Field=class
           ]
           Field=fullClassification
@@ -29,7 +29,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.8.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.8.ast
index b3dd91b..dcf8218 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.8.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.8.ast
@@ -1,21 +1,21 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FieldAccessor [
     FieldAccessor [
       FieldAccessor [
         FieldAccessor [
-          Variable [ Name=test ]
+          Variable [ Name=$test ]
           Field=class
         ]
         Field=fullClassification
@@ -26,7 +26,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.9.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.9.ast
index eebd261..c4f4972 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.9.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/access-nested-fields/access-nested-fields.9.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FieldAccessor [
     FieldAccessor [
       FieldAccessor [
-        Variable [ Name=test ]
+        Variable [ Name=$test ]
         Field=class
       ]
       Field=fullClassification
@@ -23,7 +23,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/expFieldName/expFieldName.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/expFieldName/expFieldName.3.ast
index c13fcb9..b688023 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/expFieldName/expFieldName.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/expFieldName/expFieldName.3.ast
@@ -3,7 +3,7 @@
 SELECT ELEMENT [
 RecordConstructor [
   (
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     :
     LiteralExpr [LONG] [1]
   )
@@ -14,5 +14,5 @@
     LiteralExpr [STRING] [field2]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/field-access-on-open-field/field-access-on-open-field.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/field-access-on-open-field/field-access-on-open-field.3.ast
index f429567..5d42e18 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/field-access-on-open-field/field-access-on-open-field.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/field-access-on-open-field/field-access-on-open-field.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
   Field=zip
 ]
 ]
@@ -10,11 +10,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=address
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-closed/highly-nested-open.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-closed/highly-nested-open.3.ast
index 6e63c7e..ae7ba39 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-closed/highly-nested-open.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-closed/highly-nested-open.3.ast
@@ -1,23 +1,23 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FunctionCall test.get-record-field-value@2[
-    Variable [ Name=test ]
+    Variable [ Name=$test ]
     LiteralExpr [STRING] [class]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.ast
index 6e63c7e..ae7ba39 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.ast
@@ -1,23 +1,23 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FunctionCall test.get-record-field-value@2[
-    Variable [ Name=test ]
+    Variable [ Name=$test ]
     LiteralExpr [STRING] [class]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-open/highly-nested-open.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-open/highly-nested-open.3.ast
index 6e63c7e..ae7ba39 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-open/highly-nested-open.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/highly-nested-open/highly-nested-open.3.ast
@@ -1,23 +1,23 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Animals]
   ]
   AS
-  Variable [ Name=test ]
+  Variable [ Name=$test ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FunctionCall test.get-record-field-value@2[
-    Variable [ Name=test ]
+    Variable [ Name=$test ]
     LiteralExpr [STRING] [class]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=result ]
+    Variable [ Name=$result ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/tiny-social-example/tiny-social-example.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/tiny-social-example/tiny-social-example.4.ast
index 5d8ed8c..ca6eb96 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/tiny-social-example/tiny-social-example.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-field-value/tiny-social-example/tiny-social-example.4.ast
@@ -1,39 +1,39 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=result ]
+Variable [ Name=$result ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ,
   FunctionCall TinySocial.get-record-fields@1[
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
   ]
   AS
-  Variable [ Name=f ]
+  Variable [ Name=$f ]
 ]
-LetVariable [ Name=result ]
+Let Variable [ Name=$result ]
   :=
   FunctionCall TinySocial.get-record-field-value@2[
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     FieldAccessor [
-      Variable [ Name=f ]
+      Variable [ Name=$f ]
       Field=field-name
     ]
   ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=f ]
+      Variable [ Name=$f ]
       Field=field-type
     ]
     =
     LiteralExpr [STRING] [STRING]
   ]
 Orderby
-  Variable [ Name=result ]
+  Variable [ Name=$result ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.ast
index bed8129..7ff030a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.ast
@@ -2,19 +2,19 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsersAlternate]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.ast
index 1be4993..dea8797 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsersAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.ast
index 5eb193e..d79e7dd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessagesAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=message-id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.ast
index 47fd6ad..a665395 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsersAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=screen-name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.ast
index 783d5d6..823c7a5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessagesAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.ast
index 3fe1794..ee81dc9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [field-name]
     :
-    Variable [ Name=n ]
+    Variable [ Name=$n ]
   )
   (
     LiteralExpr [STRING] [field-type]
     :
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
   )
   (
     LiteralExpr [STRING] [count]
     :
-    Variable [ Name=count ]
+    Variable [ Name=$count ]
   )
 ]
 ]
@@ -23,39 +23,55 @@
     LiteralExpr [STRING] [TweetMessagesAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ,
   FunctionCall TinySocial.get-record-fields@1[
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
   ]
   AS
-  Variable [ Name=f ]
+  Variable [ Name=$f ]
 ]
 Groupby
-  Variable [ Name=n ]
+  Variable [ Name=$n ]
   :=
   FieldAccessor [
-    Variable [ Name=f ]
+    Variable [ Name=$f ]
     Field=field-name
   ]
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
   :=
   FieldAccessor [
-    Variable [ Name=f ]
+    Variable [ Name=$f ]
     Field=field-type
   ]
-  With
-  Variable [ Name=r ]
-  Variable [ Name=f ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$f ]
+   AS f
+  Variable [ Name=$r ]
+   AS r
+  )
 
-LetVariable [ Name=count ]
+Let Variable [ Name=$count ]
   :=
   FunctionCall TinySocial.count@1[
-    Variable [ Name=r ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=r
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=n ]
+  Variable [ Name=$n ]
   ASC
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.ast
index bed8129..7ff030a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.ast
@@ -2,19 +2,19 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsersAlternate]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.ast
index 1be4993..dea8797 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsersAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.ast
index 5eb193e..d79e7dd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessagesAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=message-id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.ast
index 47fd6ad..a665395 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsersAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=screen-name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.ast
index 783d5d6..823c7a5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessagesAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.ast
index 3fe1794..ee81dc9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [field-name]
     :
-    Variable [ Name=n ]
+    Variable [ Name=$n ]
   )
   (
     LiteralExpr [STRING] [field-type]
     :
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
   )
   (
     LiteralExpr [STRING] [count]
     :
-    Variable [ Name=count ]
+    Variable [ Name=$count ]
   )
 ]
 ]
@@ -23,39 +23,55 @@
     LiteralExpr [STRING] [TweetMessagesAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ,
   FunctionCall TinySocial.get-record-fields@1[
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
   ]
   AS
-  Variable [ Name=f ]
+  Variable [ Name=$f ]
 ]
 Groupby
-  Variable [ Name=n ]
+  Variable [ Name=$n ]
   :=
   FieldAccessor [
-    Variable [ Name=f ]
+    Variable [ Name=$f ]
     Field=field-name
   ]
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
   :=
   FieldAccessor [
-    Variable [ Name=f ]
+    Variable [ Name=$f ]
     Field=field-type
   ]
-  With
-  Variable [ Name=r ]
-  Variable [ Name=f ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$f ]
+   AS f
+  Variable [ Name=$r ]
+   AS r
+  )
 
-LetVariable [ Name=count ]
+Let Variable [ Name=$count ]
   :=
   FunctionCall TinySocial.count@1[
-    Variable [ Name=r ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=r
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=n ]
+  Variable [ Name=$n ]
   ASC
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.ast
index bed8129..7ff030a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.ast
@@ -2,19 +2,19 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsersAlternate]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.ast
index 1be4993..dea8797 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsersAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.ast
index 5eb193e..d79e7dd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessagesAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=message-id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.ast
index 47fd6ad..a665395 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TwitterUsersAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=screen-name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.ast
index 783d5d6..823c7a5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT ELEMENT [
 FunctionCall TinySocial.get-record-fields@1[
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessagesAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.ast
index 3fe1794..ee81dc9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.ast
@@ -5,17 +5,17 @@
   (
     LiteralExpr [STRING] [field-name]
     :
-    Variable [ Name=n ]
+    Variable [ Name=$n ]
   )
   (
     LiteralExpr [STRING] [field-type]
     :
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
   )
   (
     LiteralExpr [STRING] [count]
     :
-    Variable [ Name=count ]
+    Variable [ Name=$count ]
   )
 ]
 ]
@@ -23,39 +23,55 @@
     LiteralExpr [STRING] [TweetMessagesAlternate]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ,
   FunctionCall TinySocial.get-record-fields@1[
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
   ]
   AS
-  Variable [ Name=f ]
+  Variable [ Name=$f ]
 ]
 Groupby
-  Variable [ Name=n ]
+  Variable [ Name=$n ]
   :=
   FieldAccessor [
-    Variable [ Name=f ]
+    Variable [ Name=$f ]
     Field=field-name
   ]
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
   :=
   FieldAccessor [
-    Variable [ Name=f ]
+    Variable [ Name=$f ]
     Field=field-type
   ]
-  With
-  Variable [ Name=r ]
-  Variable [ Name=f ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$f ]
+   AS f
+  Variable [ Name=$r ]
+   AS r
+  )
 
-LetVariable [ Name=count ]
+Let Variable [ Name=$count ]
   :=
   FunctionCall TinySocial.count@1[
-    Variable [ Name=r ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=r
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=n ]
+  Variable [ Name=$n ]
   ASC
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/open-closed-fieldname-conflict_issue173/open-closed-fieldname-conflict_issue173.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/open-closed-fieldname-conflict_issue173/open-closed-fieldname-conflict_issue173.3.ast
index 0fa6075..87409c1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/open-closed-fieldname-conflict_issue173/open-closed-fieldname-conflict_issue173.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/open-closed-fieldname-conflict_issue173/open-closed-fieldname-conflict_issue173.3.ast
@@ -4,7 +4,7 @@
 RecordConstructor [
   (
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=fname
     ]
     :
@@ -23,5 +23,5 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/open-open-fieldname-conflict_issue173/open-open-fieldname-conflict_issue173.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/open-open-fieldname-conflict_issue173/open-open-fieldname-conflict_issue173.3.ast
index 6509c79..a9424e7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/open-open-fieldname-conflict_issue173/open-open-fieldname-conflict_issue173.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/records/open-open-fieldname-conflict_issue173/open-open-fieldname-conflict_issue173.3.ast
@@ -4,7 +4,7 @@
 RecordConstructor [
   (
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=fname1
     ]
     :
@@ -12,7 +12,7 @@
   )
   (
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=fname2
     ]
     :
@@ -24,5 +24,5 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/10/10.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/10/10.3.ast
index ddad342..5cf4e83 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/10/10.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/10/10.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP1]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/20/20.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/20/20.3.ast
index 7f1360c..aa83cd5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/20/20.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/20/20.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPadm]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/30/30.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/30/30.3.ast
index f71c9bc..6dcdc5e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/30/30.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/30/30.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPsplits]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/alltypes_01/alltypes_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/alltypes_01/alltypes_01.3.ast
index d119287..bbf821c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/alltypes_01/alltypes_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/alltypes_01/alltypes_01.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [All]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/alltypes_02/alltypes_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/alltypes_02/alltypes_02.3.ast
index d119287..bbf821c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/alltypes_02/alltypes_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/alltypes_02/alltypes_02.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [All]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/invalid-scan-syntax/invalid-scan-syntax.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/invalid-scan-syntax/invalid-scan-syntax.3.ast
index 2a6caa5..ab80da6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/invalid-scan-syntax/invalid-scan-syntax.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/invalid-scan-syntax/invalid-scan-syntax.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=t ]
+Variable [ Name=$t ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test.Office]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/issue238_query_1/issue238_query_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/issue238_query_1/issue238_query_1.3.ast
index 7f1360c..aa83cd5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/issue238_query_1/issue238_query_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/issue238_query_1/issue238_query_1.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPadm]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/issue238_query_2/issue238_query_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/issue238_query_2/issue238_query_2.3.ast
index 7f1360c..aa83cd5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/issue238_query_2/issue238_query_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/issue238_query_2/issue238_query_2.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLPadm]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paper ]
+    Variable [ Name=$paper ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/numeric_types_01/numeric_types_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/numeric_types_01/numeric_types_01.3.ast
index 78fb696..10710a1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/numeric_types_01/numeric_types_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/numeric_types_01/numeric_types_01.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Numeric]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/spatial_types_01/spatial_types_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/spatial_types_01/spatial_types_01.3.ast
index a9aa43f..0b11a5b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/spatial_types_01/spatial_types_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/spatial_types_01/spatial_types_01.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Spatial]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/temp_types_01/temp_types_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/temp_types_01/temp_types_01.3.ast
index 469457b..9b47058 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/temp_types_01/temp_types_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/scan/temp_types_01/temp_types_01.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Temp]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/count-nullable/count-nullable.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/count-nullable/count-nullable.3.ast
index bc36184..5fc4078 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/count-nullable/count-nullable.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/count-nullable/count-nullable.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [custage]
     :
-    Variable [ Name=age ]
+    Variable [ Name=$age ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=c ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=c
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,19 +31,23 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Groupby
-  Variable [ Name=age ]
+  Variable [ Name=$age ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=age
   ]
-  With
-  Variable [ Name=c ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$c ]
+   AS c
+  )
 
 Orderby
-  Variable [ Name=age ]
+  Variable [ Name=$age ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/cust-filter/cust-filter.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/cust-filter/cust-filter.3.ast
index 32003f3..5055704 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/cust-filter/cust-filter.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/cust-filter/cust-filter.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [custname]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [custage]
     :
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=age
     ]
     <
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=cid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/has-param1/has-param1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/has-param1/has-param1.3.ast
index b8827d6..29d89dd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/has-param1/has-param1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/has-param1/has-param1.3.ast
@@ -2,26 +2,26 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=o ]
+Variable [ Name=$o ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.not@1[
     FunctionCall test.is-null@1[
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=param1
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=oid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_ints/edit-distance-check_ints.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_ints/edit-distance-check_ints.3.ast
index 441a66b..c3dde01 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_ints/edit-distance-check_ints.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_ints/edit-distance-check_ints.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -11,7 +11,7 @@
     LiteralExpr [LONG] [6]
     LiteralExpr [LONG] [7]
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -21,34 +21,34 @@
     LiteralExpr [LONG] [7]
     LiteralExpr [LONG] [8]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [3]
     ]
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [3]
     ]
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [2]
     ]
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [2]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_strings/edit-distance-check_strings.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_strings/edit-distance-check_strings.3.ast
index bc90e22..c2b52e7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_strings/edit-distance-check_strings.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_strings/edit-distance-check_strings.3.ast
@@ -1,39 +1,39 @@
 DataverseUse test
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   LiteralExpr [STRING] [Nalini Venkatasubramanian]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   LiteralExpr [STRING] [Nalini Wekatasupramanian]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [3]
     ]
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [3]
     ]
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [2]
     ]
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [2]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_unicode/edit-distance-check_unicode.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_unicode/edit-distance-check_unicode.3.ast
index 227a6b6..edaf11d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_unicode/edit-distance-check_unicode.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-check_unicode/edit-distance-check_unicode.3.ast
@@ -1,42 +1,42 @@
 DataverseUse test
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   LiteralExpr [STRING] [사랑]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   LiteralExpr [STRING] [사랑해]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   LiteralExpr [STRING] [사과]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [1]
     ]
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [1]
     ]
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=c ]
+      Variable [ Name=$b ]
+      Variable [ Name=$c ]
       LiteralExpr [LONG] [1]
     ]
     FunctionCall test.edit-distance-check@3[
-      Variable [ Name=c ]
-      Variable [ Name=b ]
+      Variable [ Name=$c ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [2]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-list-is-filterable/edit-distance-list-is-filterable.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-list-is-filterable/edit-distance-list-is-filterable.3.ast
index adabd87..9c7b92e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-list-is-filterable/edit-distance-list-is-filterable.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-list-is-filterable/edit-distance-list-is-filterable.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -19,38 +19,38 @@
     LiteralExpr [LONG] [9]
     LiteralExpr [LONG] [10]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.edit-distance-list-is-filterable@2[
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [0]
     ]
     FunctionCall test.edit-distance-list-is-filterable@2[
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [3]
     ]
     FunctionCall test.edit-distance-list-is-filterable@2[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [0]
     ]
     FunctionCall test.edit-distance-list-is-filterable@2[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [3]
     ]
     FunctionCall test.edit-distance-list-is-filterable@2[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [8]
     ]
     FunctionCall test.edit-distance-list-is-filterable@2[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [11]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-string-is-filterable/edit-distance-string-is-filterable.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-string-is-filterable/edit-distance-string-is-filterable.3.ast
index f3ca20c..59e5a9b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-string-is-filterable/edit-distance-string-is-filterable.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance-string-is-filterable/edit-distance-string-is-filterable.3.ast
@@ -1,140 +1,140 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   LiteralExpr [STRING] []
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   LiteralExpr [STRING] [abcdefghij]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [0]
       LiteralExpr [LONG] [2]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [0]
       LiteralExpr [LONG] [2]
       LiteralExpr [TRUE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [1]
       LiteralExpr [LONG] [2]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
       LiteralExpr [LONG] [1]
       LiteralExpr [LONG] [2]
       LiteralExpr [TRUE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [0]
       LiteralExpr [LONG] [2]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [0]
       LiteralExpr [LONG] [2]
       LiteralExpr [TRUE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [1]
       LiteralExpr [LONG] [2]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [1]
       LiteralExpr [LONG] [2]
       LiteralExpr [TRUE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [4]
       LiteralExpr [LONG] [2]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [5]
       LiteralExpr [LONG] [2]
       LiteralExpr [TRUE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [5]
       LiteralExpr [LONG] [2]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [6]
       LiteralExpr [LONG] [2]
       LiteralExpr [TRUE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [0]
       LiteralExpr [LONG] [3]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [0]
       LiteralExpr [LONG] [3]
       LiteralExpr [TRUE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [1]
       LiteralExpr [LONG] [3]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [1]
       LiteralExpr [LONG] [3]
       LiteralExpr [TRUE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [2]
       LiteralExpr [LONG] [3]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [3]
       LiteralExpr [LONG] [3]
       LiteralExpr [TRUE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [3]
       LiteralExpr [LONG] [3]
       LiteralExpr [FALSE]
     ]
     FunctionCall test.edit-distance-string-is-filterable@4[
-      Variable [ Name=b ]
+      Variable [ Name=$b ]
       LiteralExpr [LONG] [4]
       LiteralExpr [LONG] [3]
       LiteralExpr [TRUE]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance_ints/edit-distance_ints.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance_ints/edit-distance_ints.3.ast
index 2f80a0b..b9c16e9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance_ints/edit-distance_ints.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance_ints/edit-distance_ints.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -11,7 +11,7 @@
     LiteralExpr [LONG] [6]
     LiteralExpr [LONG] [7]
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -21,22 +21,22 @@
     LiteralExpr [LONG] [7]
     LiteralExpr [LONG] [8]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.edit-distance@2[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
     ]
     FunctionCall test.edit-distance@2[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance_strings/edit-distance_strings.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance_strings/edit-distance_strings.3.ast
index e59acfb..53e3c7a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance_strings/edit-distance_strings.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/edit-distance_strings/edit-distance_strings.3.ast
@@ -1,27 +1,27 @@
 DataverseUse test
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   LiteralExpr [STRING] [Nalini Venkatasubramanian]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   LiteralExpr [STRING] [Nalini Wekatasupramanian]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.edit-distance@2[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
     ]
     FunctionCall test.edit-distance@2[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/fuzzyeq-edit-distance/fuzzyeq-edit-distance.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/fuzzyeq-edit-distance/fuzzyeq-edit-distance.3.ast
index 6453100..9ae7bd0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/fuzzyeq-edit-distance/fuzzyeq-edit-distance.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/fuzzyeq-edit-distance/fuzzyeq-edit-distance.3.ast
@@ -3,18 +3,18 @@
 Set simthreshold=2
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=authors
     ]
     ~=
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/fuzzyeq-similarity-jaccard/fuzzyeq-similarity-jaccard.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/fuzzyeq-similarity-jaccard/fuzzyeq-similarity-jaccard.3.ast
index 8a076b8..73bb666 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/fuzzyeq-similarity-jaccard/fuzzyeq-similarity-jaccard.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/fuzzyeq-similarity-jaccard/fuzzyeq-similarity-jaccard.3.ast
@@ -3,19 +3,19 @@
 Set simthreshold=0.5f
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.word-tokens@1[
       FieldAccessor [
-        Variable [ Name=paper ]
+        Variable [ Name=$paper ]
         Field=title
       ]
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/prefix-len-jaccard/prefix-len-jaccard.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/prefix-len-jaccard/prefix-len-jaccard.3.ast
index fbd95f5..e556368 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/prefix-len-jaccard/prefix-len-jaccard.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/prefix-len-jaccard/prefix-len-jaccard.3.ast
@@ -33,5 +33,5 @@
     LiteralExpr [LONG] [1]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_ints/similarity-jaccard-check_ints.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_ints/similarity-jaccard-check_ints.3.ast
index 2b7864d..b567211 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_ints/similarity-jaccard-check_ints.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_ints/similarity-jaccard-check_ints.3.ast
@@ -1,10 +1,10 @@
 DataverseUse test
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -13,7 +13,7 @@
     LiteralExpr [LONG] [4]
     LiteralExpr [LONG] [5]
   ]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [4]
@@ -24,7 +24,7 @@
     LiteralExpr [LONG] [2]
     LiteralExpr [LONG] [1]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [7]
@@ -38,7 +38,7 @@
     LiteralExpr [LONG] [11]
     LiteralExpr [LONG] [4]
   ]
-LetVariable [ Name=e ]
+Let Variable [ Name=$e ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [11]
@@ -53,7 +53,7 @@
     LiteralExpr [LONG] [20]
     LiteralExpr [LONG] [21]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -67,74 +67,74 @@
     LiteralExpr [LONG] [10]
     LiteralExpr [LONG] [11]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [FLOAT] [0.0]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [FLOAT] [0.0]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [FLOAT] [0.1]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [FLOAT] [0.1]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
       LiteralExpr [FLOAT] [0.05]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
       LiteralExpr [FLOAT] [0.05]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
       LiteralExpr [FLOAT] [0.8]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_query/similarity-jaccard-check_query.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_query/similarity-jaccard-check_query.3.ast
index 619e42f..841a312 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_query/similarity-jaccard-check_query.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_query/similarity-jaccard-check_query.3.ast
@@ -1,36 +1,36 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     LiteralExpr [STRING] [Environments for Cooperative Transactions]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_strings/similarity-jaccard-check_strings.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_strings/similarity-jaccard-check_strings.3.ast
index 3e87cf1..dc782ff 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_strings/similarity-jaccard-check_strings.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_strings/similarity-jaccard-check_strings.3.ast
@@ -1,10 +1,10 @@
 DataverseUse test
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -13,7 +13,7 @@
     LiteralExpr [STRING] [def]
     LiteralExpr [STRING] [efg]
   ]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [efg]
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [ijk]
     LiteralExpr [STRING] [bcd]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [jkl]
     LiteralExpr [STRING] [cde]
   ]
-LetVariable [ Name=e ]
+Let Variable [ Name=$e ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [Efg]
@@ -49,7 +49,7 @@
     LiteralExpr [STRING] [IjK]
     LiteralExpr [STRING] [BCD]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -63,7 +63,7 @@
     LiteralExpr [STRING] [jkl]
     LiteralExpr [STRING] [cde]
   ]
-LetVariable [ Name=g ]
+Let Variable [ Name=$g ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [cde]
@@ -78,7 +78,7 @@
     LiteralExpr [STRING] [zfe]
     LiteralExpr [STRING] [wab]
   ]
-LetVariable [ Name=h ]
+Let Variable [ Name=$h ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -92,94 +92,94 @@
     LiteralExpr [STRING] [jkl]
     LiteralExpr [STRING] [cde]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [FLOAT] [0.0]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [FLOAT] [0.0]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [FLOAT] [0.1]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [FLOAT] [0.1]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=g ]
-      Variable [ Name=h ]
+      Variable [ Name=$g ]
+      Variable [ Name=$h ]
       LiteralExpr [FLOAT] [0.05]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=h ]
-      Variable [ Name=g ]
+      Variable [ Name=$h ]
+      Variable [ Name=$g ]
       LiteralExpr [FLOAT] [0.05]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=g ]
-      Variable [ Name=h ]
+      Variable [ Name=$g ]
+      Variable [ Name=$h ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=h ]
-      Variable [ Name=g ]
+      Variable [ Name=$h ]
+      Variable [ Name=$g ]
       LiteralExpr [FLOAT] [0.8]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_strings_issue628/similarity-jaccard-check_strings_issue628.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_strings_issue628/similarity-jaccard-check_strings_issue628.3.ast
index 8af77eb..a0ac61a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_strings_issue628/similarity-jaccard-check_strings_issue628.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-check_strings_issue628/similarity-jaccard-check_strings_issue628.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=v1 ]
+Let Variable [ Name=$v1 ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [query]
@@ -10,7 +10,7 @@
     LiteralExpr [STRING] [multidatabase]
     LiteralExpr [STRING] [systems]
   ]
-LetVariable [ Name=v2 ]
+Let Variable [ Name=$v2 ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [query]
@@ -21,7 +21,7 @@
     LiteralExpr [STRING] [database]
     LiteralExpr [STRING] [systems]
   ]
-LetVariable [ Name=v3 ]
+Let Variable [ Name=$v3 ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [dynamic]
@@ -35,7 +35,7 @@
     LiteralExpr [STRING] [systems]
     LiteralExpr [STRING] [1]
   ]
-LetVariable [ Name=v4 ]
+Let Variable [ Name=$v4 ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [transaction]
@@ -44,7 +44,7 @@
     LiteralExpr [STRING] [multidatabase]
     LiteralExpr [STRING] [systems]
   ]
-LetVariable [ Name=v5 ]
+Let Variable [ Name=$v5 ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [overview]
@@ -53,29 +53,29 @@
     LiteralExpr [STRING] [transaction]
     LiteralExpr [STRING] [management]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=v1 ]
-      Variable [ Name=v2 ]
+      Variable [ Name=$v1 ]
+      Variable [ Name=$v2 ]
       LiteralExpr [FLOAT] [0.5]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=v1 ]
-      Variable [ Name=v3 ]
+      Variable [ Name=$v1 ]
+      Variable [ Name=$v3 ]
       LiteralExpr [FLOAT] [0.5]
     ]
     FunctionCall test.similarity-jaccard-check@3[
-      Variable [ Name=v4 ]
-      Variable [ Name=v5 ]
+      Variable [ Name=$v4 ]
+      Variable [ Name=$v5 ]
       LiteralExpr [FLOAT] [0.5]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-prefix-check/similarity-jaccard-prefix-check.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-prefix-check/similarity-jaccard-prefix-check.3.ast
index 59e3f1a..00a73db 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-prefix-check/similarity-jaccard-prefix-check.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-prefix-check/similarity-jaccard-prefix-check.3.ast
@@ -105,5 +105,5 @@
     LiteralExpr [LONG] [1]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-prefix/similarity-jaccard-prefix.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-prefix/similarity-jaccard-prefix.3.ast
index aceda8c..22cfd87 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-prefix/similarity-jaccard-prefix.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-prefix/similarity-jaccard-prefix.3.ast
@@ -105,5 +105,5 @@
     LiteralExpr [LONG] [1]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_ints/similarity-jaccard-sorted-check_ints.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_ints/similarity-jaccard-sorted-check_ints.3.ast
index c4b1dbf..c9f2183 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_ints/similarity-jaccard-sorted-check_ints.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_ints/similarity-jaccard-sorted-check_ints.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -14,7 +14,7 @@
     LiteralExpr [LONG] [4]
     LiteralExpr [LONG] [5]
   ]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -25,7 +25,7 @@
     LiteralExpr [LONG] [8]
     LiteralExpr [LONG] [9]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -39,54 +39,54 @@
     LiteralExpr [LONG] [10]
     LiteralExpr [LONG] [11]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [FLOAT] [0.0]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [FLOAT] [0.0]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [FLOAT] [0.1]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [FLOAT] [0.1]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
       LiteralExpr [FLOAT] [0.8]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_query/similarity-jaccard-sorted-check_query.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_query/similarity-jaccard-sorted-check_query.3.ast
index faf857a..d22b4df 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_query/similarity-jaccard-sorted-check_query.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_query/similarity-jaccard-sorted-check_query.3.ast
@@ -2,36 +2,36 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     LiteralExpr [STRING] [Cooperative Transactions for Environments]
   ]
-LetVariable [ Name=jacc ]
+Let Variable [ Name=$jacc ]
   :=
   FunctionCall test.similarity-jaccard-sorted-check@3[
-    Variable [ Name=paper_tokens ]
-    Variable [ Name=query_tokens ]
+    Variable [ Name=$paper_tokens ]
+    Variable [ Name=$query_tokens ]
     LiteralExpr [FLOAT] [0.5]
   ]
 Where
   IndexAccessor [
-    Variable [ Name=jacc ]
+    Variable [ Name=$jacc ]
     Index:     LiteralExpr [LONG] [0]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_strings/similarity-jaccard-sorted-check_strings.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_strings/similarity-jaccard-sorted-check_strings.3.ast
index 647f261..52b7090 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_strings/similarity-jaccard-sorted-check_strings.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted-check_strings/similarity-jaccard-sorted-check_strings.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [def]
     LiteralExpr [STRING] [efg]
   ]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [hij]
     LiteralExpr [STRING] [ijk]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -39,7 +39,7 @@
     LiteralExpr [STRING] [ijk]
     LiteralExpr [STRING] [jkl]
   ]
-LetVariable [ Name=e ]
+Let Variable [ Name=$e ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [Abc]
@@ -50,7 +50,7 @@
     LiteralExpr [STRING] [HiJ]
     LiteralExpr [STRING] [IJK]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -64,74 +64,74 @@
     LiteralExpr [STRING] [ijk]
     LiteralExpr [STRING] [jkl]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [FLOAT] [0.0]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [FLOAT] [0.0]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
       LiteralExpr [FLOAT] [0.1]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
       LiteralExpr [FLOAT] [0.1]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
       LiteralExpr [FLOAT] [0.6]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
       LiteralExpr [FLOAT] [0.8]
     ]
     FunctionCall test.similarity-jaccard-sorted-check@3[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
       LiteralExpr [FLOAT] [0.8]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_ints/similarity-jaccard-sorted_ints.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_ints/similarity-jaccard-sorted_ints.3.ast
index ccf6b9d..7b2a57d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_ints/similarity-jaccard-sorted_ints.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_ints/similarity-jaccard-sorted_ints.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -14,7 +14,7 @@
     LiteralExpr [LONG] [4]
     LiteralExpr [LONG] [5]
   ]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -25,7 +25,7 @@
     LiteralExpr [LONG] [8]
     LiteralExpr [LONG] [9]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -39,30 +39,30 @@
     LiteralExpr [LONG] [10]
     LiteralExpr [LONG] [11]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
     ]
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
     ]
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
     ]
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_query/similarity-jaccard-sorted_query.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_query/similarity-jaccard-sorted_query.3.ast
index 3da839d..2919e6c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_query/similarity-jaccard-sorted_query.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_query/similarity-jaccard-sorted_query.3.ast
@@ -2,23 +2,23 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     LiteralExpr [STRING] [Cooperative Transactions for Environments]
@@ -26,8 +26,8 @@
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=paper_tokens ]
-      Variable [ Name=query_tokens ]
+      Variable [ Name=$paper_tokens ]
+      Variable [ Name=$query_tokens ]
     ]
     >=
     LiteralExpr [DOUBLE] [0.5]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_strings/similarity-jaccard-sorted_strings.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_strings/similarity-jaccard-sorted_strings.3.ast
index 061753a..f630472 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_strings/similarity-jaccard-sorted_strings.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard-sorted_strings/similarity-jaccard-sorted_strings.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [def]
     LiteralExpr [STRING] [efg]
   ]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [hij]
     LiteralExpr [STRING] [ijk]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -39,7 +39,7 @@
     LiteralExpr [STRING] [ijk]
     LiteralExpr [STRING] [jkl]
   ]
-LetVariable [ Name=e ]
+Let Variable [ Name=$e ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [Abc]
@@ -50,7 +50,7 @@
     LiteralExpr [STRING] [HiJ]
     LiteralExpr [STRING] [IJK]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -64,38 +64,38 @@
     LiteralExpr [STRING] [ijk]
     LiteralExpr [STRING] [jkl]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
     ]
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
     ]
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
     ]
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
     ]
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
     ]
     FunctionCall test.similarity-jaccard-sorted@2[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_ints/similarity-jaccard_ints.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_ints/similarity-jaccard_ints.3.ast
index 2a62f96..54acef8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_ints/similarity-jaccard_ints.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_ints/similarity-jaccard_ints.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -14,7 +14,7 @@
     LiteralExpr [LONG] [4]
     LiteralExpr [LONG] [5]
   ]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -25,7 +25,7 @@
     LiteralExpr [LONG] [8]
     LiteralExpr [LONG] [9]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [1]
@@ -39,7 +39,7 @@
     LiteralExpr [LONG] [10]
     LiteralExpr [LONG] [11]
   ]
-LetVariable [ Name=e ]
+Let Variable [ Name=$e ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [4]
@@ -50,7 +50,7 @@
     LiteralExpr [LONG] [2]
     LiteralExpr [LONG] [1]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   OrderedListConstructor [
     LiteralExpr [LONG] [7]
@@ -64,38 +64,38 @@
     LiteralExpr [LONG] [11]
     LiteralExpr [LONG] [4]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_query/similarity-jaccard_query.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_query/similarity-jaccard_query.3.ast
index cdb4b9a..f78738b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_query/similarity-jaccard_query.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_query/similarity-jaccard_query.3.ast
@@ -2,23 +2,23 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=paper ]
+Variable [ Name=$paper ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paper ]
+  Variable [ Name=$paper ]
 ]
-LetVariable [ Name=paper_tokens ]
+Let Variable [ Name=$paper_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     FieldAccessor [
-      Variable [ Name=paper ]
+      Variable [ Name=$paper ]
       Field=title
     ]
   ]
-LetVariable [ Name=query_tokens ]
+Let Variable [ Name=$query_tokens ]
   :=
   FunctionCall test.word-tokens@1[
     LiteralExpr [STRING] [Transactions for Cooperative Environments]
@@ -26,8 +26,8 @@
 Where
   OperatorExpr [
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=paper_tokens ]
-      Variable [ Name=query_tokens ]
+      Variable [ Name=$paper_tokens ]
+      Variable [ Name=$query_tokens ]
     ]
     >=
     LiteralExpr [FLOAT] [0.5]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_strings/similarity-jaccard_strings.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_strings/similarity-jaccard_strings.3.ast
index 8689182..4135197 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_strings/similarity-jaccard_strings.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/similarity/similarity-jaccard_strings/similarity-jaccard_strings.3.ast
@@ -1,11 +1,11 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [def]
     LiteralExpr [STRING] [efg]
   ]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -25,7 +25,7 @@
     LiteralExpr [STRING] [hij]
     LiteralExpr [STRING] [ijk]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -39,7 +39,7 @@
     LiteralExpr [STRING] [ijk]
     LiteralExpr [STRING] [jkl]
   ]
-LetVariable [ Name=e ]
+Let Variable [ Name=$e ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [efg]
@@ -50,7 +50,7 @@
     LiteralExpr [STRING] [ijk]
     LiteralExpr [STRING] [bcd]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -64,7 +64,7 @@
     LiteralExpr [STRING] [jkl]
     LiteralExpr [STRING] [cde]
   ]
-LetVariable [ Name=g ]
+Let Variable [ Name=$g ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [Efg]
@@ -75,7 +75,7 @@
     LiteralExpr [STRING] [IjK]
     LiteralExpr [STRING] [BCD]
   ]
-LetVariable [ Name=h ]
+Let Variable [ Name=$h ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -89,46 +89,46 @@
     LiteralExpr [STRING] [jkl]
     LiteralExpr [STRING] [cde]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=g ]
-      Variable [ Name=h ]
+      Variable [ Name=$g ]
+      Variable [ Name=$h ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=h ]
-      Variable [ Name=g ]
+      Variable [ Name=$h ]
+      Variable [ Name=$g ]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.ast
index e8b514c..06ca346 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [cell]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
   (
     LiteralExpr [STRING] [count]
     :
-    Variable [ Name=num ]
+    Variable [ Name=$num ]
   )
 ]
 ]
@@ -18,12 +18,12 @@
     LiteralExpr [STRING] [TwitterData]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
-LetVariable [ Name=keywords ]
+Let Variable [ Name=$keywords ]
   :=
   LiteralExpr [STRING] [Allergies]
-LetVariable [ Name=region ]
+Let Variable [ Name=$region ]
   :=
   FunctionCall test.polygon@1[
     LiteralExpr [STRING] [
@@ -36,15 +36,15 @@
   OperatorExpr [
     FunctionCall test.spatial-intersect@2[
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=loc
       ]
-      Variable [ Name=region ]
+      Variable [ Name=$region ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=time
       ]
       >
@@ -55,7 +55,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=time
       ]
       <
@@ -66,18 +66,18 @@
     and
     FunctionCall test.contains@2[
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=text
       ]
-      Variable [ Name=keywords ]
+      Variable [ Name=$keywords ]
     ]
   ]
 Groupby
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   :=
   FunctionCall test.spatial-cell@4[
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=loc
     ]
     FunctionCall test.create-point@2[
@@ -87,17 +87,34 @@
     LiteralExpr [DOUBLE] [3.0]
     LiteralExpr [DOUBLE] [3.0]
   ]
-  With
-  Variable [ Name=region ]
-  Variable [ Name=keywords ]
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$region ]
+   AS region
+  Variable [ Name=$keywords ]
+   AS keywords
+  Variable [ Name=$t ]
+   AS t
+  )
 
-LetVariable [ Name=num ]
+Let Variable [ Name=$num ]
   :=
   FunctionCall test.count@1[
-    Variable [ Name=t ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=t
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=num ]
+  Variable [ Name=$num ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation/cell-aggregation.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation/cell-aggregation.3.ast
index 94ca33d..e337bdd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation/cell-aggregation.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation/cell-aggregation.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=grid ]
+Let Variable [ Name=$grid ]
   :=
   (
     SELECT ELEMENT [
@@ -8,12 +8,12 @@
       (
         LiteralExpr [STRING] [cell]
         :
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
       )
       (
         LiteralExpr [STRING] [count]
         :
-        Variable [ Name=num ]
+        Variable [ Name=$num ]
       )
     ]
     ]
@@ -21,14 +21,14 @@
         LiteralExpr [STRING] [MyData]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
     ]
     Groupby
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       :=
       FunctionCall test.spatial-cell@4[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=loc
         ]
         FunctionCall test.create-point@2[
@@ -38,23 +38,38 @@
         LiteralExpr [DOUBLE] [5.0]
         LiteralExpr [DOUBLE] [5.0]
       ]
-      With
-      Variable [ Name=o ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$o ]
+       AS o
+      )
 
-    LetVariable [ Name=num ]
+    Let Variable [ Name=$num ]
       :=
       FunctionCall test.count@1[
-        Variable [ Name=o ]
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            Variable [ Name=#2 ]
+            Field=o
+          ]
+          ]
+          FROM [            Variable [ Name=#1 ]
+            AS
+            Variable [ Name=#2 ]
+          ]
+        )
       ]
     Orderby
-      Variable [ Name=num ]
+      Variable [ Name=$num ]
       ASC
 
   )
 SELECT ELEMENT [
-Variable [ Name=g ]
+Variable [ Name=$g ]
 ]
-FROM [  Variable [ Name=grid ]
+FROM [  Variable [ Name=$grid ]
   AS
-  Variable [ Name=g ]
+  Variable [ Name=$g ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/circle-intersect-circle/circle-intersect-circle.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/circle-intersect-circle/circle-intersect-circle.3.ast
index ffa8c05..9050973 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/circle-intersect-circle/circle-intersect-circle.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/circle-intersect-circle/circle-intersect-circle.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,7 +16,7 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
@@ -28,13 +28,13 @@
       LiteralExpr [DOUBLE] [5.0]
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=circle
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/create-rtree-index/create-rtree-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/create-rtree-index/create-rtree-index.3.ast
index 86fa211..3ee94ac 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/create-rtree-index/create-rtree-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/create-rtree-index/create-rtree-index.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
   Field=id
 ]
 ]
@@ -10,11 +10,11 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/distance-between-points/distance-between-points.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/distance-between-points/distance-between-points.3.ast
index b1f61da..db3c587 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/distance-between-points/distance-between-points.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/distance-between-points/distance-between-points.3.ast
@@ -6,14 +6,14 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
   (
     LiteralExpr [STRING] [distance]
     :
-    Variable [ Name=distance ]
+    Variable [ Name=$distance ]
   )
 ]
 ]
@@ -21,13 +21,13 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
-LetVariable [ Name=distance ]
+Let Variable [ Name=$distance ]
   :=
   FunctionCall test.spatial-distance@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-point@2[
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-circle/line-intersect-circle.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-circle/line-intersect-circle.3.ast
index 1a927eb..2e49bf9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-circle/line-intersect-circle.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-circle/line-intersect-circle.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line1
     ]
     FunctionCall test.create-circle@2[
@@ -34,7 +34,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-line/line-intersect-line.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-line/line-intersect-line.3.ast
index 245b3cb..139341c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-line/line-intersect-line.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-line/line-intersect-line.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,22 +16,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line1
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line2
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-polygon/line-intersect-polygon.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-polygon/line-intersect-polygon.3.ast
index e9d363d..95cdc4b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-polygon/line-intersect-polygon.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-polygon/line-intersect-polygon.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,22 +16,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line1
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly1
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-rectangle/line-intersect-rectangle.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-rectangle/line-intersect-rectangle.3.ast
index 7812f4f..4ff1311 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-rectangle/line-intersect-rectangle.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line-intersect-rectangle/line-intersect-rectangle.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,22 +16,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line1
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=rec
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line_accessor/line_accessor.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line_accessor/line_accessor.3.ast
index 08f656a..124efed 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line_accessor/line_accessor.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/line_accessor/line_accessor.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=line ]
+Let Variable [ Name=$line ]
   :=
   FunctionCall test.create-line@2[
     FunctionCall test.create-point@2[
@@ -12,15 +12,15 @@
       NEGATIVE LiteralExpr [DOUBLE] [876.9]
     ]
   ]
-LetVariable [ Name=line_list ]
+Let Variable [ Name=$line_list ]
   :=
   FunctionCall test.get-points@1[
-    Variable [ Name=line ]
+    Variable [ Name=$line ]
   ]
 SELECT ELEMENT [
-Variable [ Name=p ]
+Variable [ Name=$p ]
 ]
-FROM [  Variable [ Name=line_list ]
+FROM [  Variable [ Name=$line_list ]
   AS
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-equals-point/point-equals-point.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-equals-point/point-equals-point.3.ast
index c754d98..c435d3f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-equals-point/point-equals-point.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-equals-point/point-equals-point.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-point@2[
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-circle/point-in-circle.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-circle/point-in-circle.3.ast
index 940a203..69ff5d8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-circle/point-in-circle.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-circle/point-in-circle.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-circle@2[
@@ -34,7 +34,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-polygon/point-in-polygon.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-polygon/point-in-polygon.3.ast
index 8bcaa53..540234c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-polygon/point-in-polygon.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-polygon/point-in-polygon.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,22 +16,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly1
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-rectangle/point-in-rectangle.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-rectangle/point-in-rectangle.3.ast
index 796923a..24d2e96 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-rectangle/point-in-rectangle.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-in-rectangle/point-in-rectangle.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,22 +16,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=rec
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-on-line/point-on-line.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-on-line/point-on-line.3.ast
index 94574c9..57740ac 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-on-line/point-on-line.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/point-on-line/point-on-line.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,22 +16,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=line1
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-circle/polygon-intersect-circle.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-circle/polygon-intersect-circle.3.ast
index d597bb2..af19447 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-circle/polygon-intersect-circle.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-circle/polygon-intersect-circle.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly1
     ]
     FunctionCall test.create-circle@2[
@@ -34,7 +34,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-polygon/polygon-intersect-polygon.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-polygon/polygon-intersect-polygon.3.ast
index aa394ce..1daf590 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-polygon/polygon-intersect-polygon.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-polygon/polygon-intersect-polygon.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,22 +16,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly1
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly2
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-rectangle/polygon-intersect-rectangle.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-rectangle/polygon-intersect-rectangle.3.ast
index a9fa6b2..0743d46 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-rectangle/polygon-intersect-rectangle.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon-intersect-rectangle/polygon-intersect-rectangle.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,22 +16,22 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=poly1
     ]
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=rec
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon_accessor/polygon_accessor.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon_accessor/polygon_accessor.3.ast
index fec7111..7c020d5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon_accessor/polygon_accessor.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/polygon_accessor/polygon_accessor.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=polygon ]
+Let Variable [ Name=$polygon ]
   :=
   FunctionCall test.create-polygon@1[
     OrderedListConstructor [
@@ -14,15 +14,15 @@
       LiteralExpr [DOUBLE] [4.0]
     ]
   ]
-LetVariable [ Name=polygon_list ]
+Let Variable [ Name=$polygon_list ]
   :=
   FunctionCall test.get-points@1[
-    Variable [ Name=polygon ]
+    Variable [ Name=$polygon ]
   ]
 SELECT ELEMENT [
-Variable [ Name=p ]
+Variable [ Name=$p ]
 ]
-FROM [  Variable [ Name=polygon_list ]
+FROM [  Variable [ Name=$polygon_list ]
   AS
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle-intersect-circle/rectangle-intersect-circle.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle-intersect-circle/rectangle-intersect-circle.3.ast
index 505572f..8589e06 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle-intersect-circle/rectangle-intersect-circle.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle-intersect-circle/rectangle-intersect-circle.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=rec
     ]
     FunctionCall test.create-circle@2[
@@ -34,7 +34,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle-intersect-rectangle/rectangle-intersect-rectangle.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle-intersect-rectangle/rectangle-intersect-rectangle.3.ast
index 5043ef9..24f8602 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle-intersect-rectangle/rectangle-intersect-rectangle.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle-intersect-rectangle/rectangle-intersect-rectangle.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=rec
     ]
     FunctionCall test.create-rectangle@2[
@@ -37,7 +37,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle_accessor/rectangle_accessor.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle_accessor/rectangle_accessor.3.ast
index c9af06a..8499f01 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle_accessor/rectangle_accessor.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/rectangle_accessor/rectangle_accessor.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=rectangle ]
+Let Variable [ Name=$rectangle ]
   :=
   FunctionCall test.create-rectangle@2[
     FunctionCall test.create-point@2[
@@ -12,15 +12,15 @@
       LiteralExpr [DOUBLE] [111.1]
     ]
   ]
-LetVariable [ Name=rectangle_list ]
+Let Variable [ Name=$rectangle_list ]
   :=
   FunctionCall test.get-points@1[
-    Variable [ Name=rectangle ]
+    Variable [ Name=$rectangle ]
   ]
 SELECT ELEMENT [
-Variable [ Name=p ]
+Variable [ Name=$p ]
 ]
-FROM [  Variable [ Name=rectangle_list ]
+FROM [  Variable [ Name=$rectangle_list ]
   AS
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/concat_03/concat_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/concat_03/concat_03.3.ast
index 3658912..e80c1d8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/concat_03/concat_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/concat_03/concat_03.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=k ]
+Let Variable [ Name=$k ]
   :=
   OrderedListConstructor [
     RecordConstructor [
@@ -42,21 +42,21 @@
 FunctionCall test.string-concat@1[
   OrderedListConstructor [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=b
     ]
     LiteralExpr [STRING] [ world]
   ]
 ]
 ]
-FROM [  Variable [ Name=k ]
+FROM [  Variable [ Name=$k ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=a
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/constructor/constructor.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/constructor/constructor.3.ast
index 8c4d21b..68da092 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/constructor/constructor.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/constructor/constructor.3.ast
@@ -1,27 +1,27 @@
 DataverseUse test
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   LiteralExpr [LONG] [1]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   LiteralExpr [LONG] [2]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   LiteralExpr [STRING] [c]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
-    Variable [ Name=a ]
-    Variable [ Name=b ]
-    Variable [ Name=c ]
+    Variable [ Name=$a ]
+    Variable [ Name=$b ]
+    Variable [ Name=$c ]
   ]
 SELECT ELEMENT [
 FunctionCall test.string@1[
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 ]
-FROM [  Variable [ Name=d ]
+FROM [  Variable [ Name=$d ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/contains_01/contains_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/contains_01/contains_01.3.ast
index 0d7d8d2..ae17f9b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/contains_01/contains_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/contains_01/contains_01.3.ast
@@ -3,11 +3,11 @@
 SELECT ELEMENT [
 OrderedListConstructor [
   FunctionCall test.contains@2[
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     LiteralExpr [STRING] [ofo]
   ]
   FunctionCall test.contains@2[
-    Variable [ Name=y ]
+    Variable [ Name=$y ]
     LiteralExpr [STRING] [ofo]
   ]
 ]
@@ -16,11 +16,11 @@
     LiteralExpr [STRING] [foofoo]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ,
   OrderedListConstructor [
     LiteralExpr [STRING] [barbar]
   ]
   AS
-  Variable [ Name=y ]
+  Variable [ Name=$y ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/cpttostr01/cpttostr01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/cpttostr01/cpttostr01.3.ast
index 5c4a2b3..94575ae 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/cpttostr01/cpttostr01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/cpttostr01/cpttostr01.3.ast
@@ -3,7 +3,7 @@
 SELECT ELEMENT [
 FunctionCall test.codepoint-to-string@1[
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=cpt
   ]
 ]
@@ -12,5 +12,5 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/escapes02/escapes02.1.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/escapes02/escapes02.1.ast
index ffb8d5e..2933ff6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/escapes02/escapes02.1.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/escapes02/escapes02.1.ast
Binary files differ
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/length_02/length_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/length_02/length_02.3.ast
index 0381cea..6e24f11 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/length_02/length_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/length_02/length_02.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FunctionCall test.string-length@1[
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 ]
 FROM [  OrderedListConstructor [
@@ -16,5 +16,5 @@
     LiteralExpr [STRING] [ninety]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches03/matches03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches03/matches03.3.ast
index f8bfc44..ceff0d5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches03/matches03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches03/matches03.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     FunctionCall null.matches@2[
@@ -57,5 +57,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches04/matches04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches04/matches04.3.ast
index 48f202f..afdde9e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches04/matches04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches04/matches04.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     FunctionCall null.matches@2[
@@ -33,5 +33,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches05/matches05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches05/matches05.3.ast
index ea963e9..b76cf0e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches05/matches05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches05/matches05.3.ast
@@ -1,28 +1,28 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [testds1]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   FunctionCall test.matches@2[
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=fname
     ]
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=lname
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches06/matches06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches06/matches06.3.ast
index 2bae6ae..4d54025 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches06/matches06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches06/matches06.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     FunctionCall null.matches@2[
@@ -69,5 +69,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches11/matches11.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches11/matches11.3.ast
index e7004ec..98a44a6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches11/matches11.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/matches11/matches11.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [NULL]
@@ -26,5 +26,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strconcat01/strconcat01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strconcat01/strconcat01.3.ast
index 7d1aceb..59d7802 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strconcat01/strconcat01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strconcat01/strconcat01.3.ast
@@ -8,11 +8,11 @@
     FunctionCall test.string-concat@1[
       OrderedListConstructor [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=fname
         ]
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=lname
         ]
       ]
@@ -24,11 +24,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strconcat02/strconcat02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strconcat02/strconcat02.3.ast
index 364d6f5..490cabd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strconcat02/strconcat02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strconcat02/strconcat02.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     FunctionCall null.string-concat@1[
@@ -51,5 +51,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strlen02/strlen02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strlen02/strlen02.3.ast
index f1e9119..c4f3ca0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strlen02/strlen02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strlen02/strlen02.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     FunctionCall null.string-length@1[
@@ -23,5 +23,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strlen03/strlen03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strlen03/strlen03.3.ast
index 0d292a8..574e800 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strlen03/strlen03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/strlen03/strlen03.3.ast
@@ -3,7 +3,7 @@
 SELECT ELEMENT [
 FunctionCall test.string-length@1[
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=name
   ]
 ]
@@ -12,11 +12,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr04/substr04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr04/substr04.3.ast
index 2d990a6..d27a6e9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr04/substr04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr04/substr04.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     FunctionCall null.substring@3[
@@ -58,5 +58,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr05/substr05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr05/substr05.3.ast
index 8857ab6..55bd101 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr05/substr05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr05/substr05.3.ast
@@ -3,14 +3,14 @@
 SELECT ELEMENT [
 FunctionCall test.substring@3[
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=name
   ]
   LiteralExpr [LONG] [4]
   OperatorExpr [
     FunctionCall test.string-length@1[
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=name
       ]
     ]
@@ -23,11 +23,11 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr06/substr06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr06/substr06.3.ast
index 0019ab6..be34cac 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr06/substr06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr06/substr06.3.ast
@@ -3,7 +3,7 @@
 SELECT ELEMENT [
 FunctionCall test.substring@2[
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=name
   ]
   LiteralExpr [LONG] [4]
@@ -13,11 +13,11 @@
     LiteralExpr [STRING] [testdst]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     Field=name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring_01/substring_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring_01/substring_01.3.ast
index 4443e58..7be3bf5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring_01/substring_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring_01/substring_01.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FunctionCall test.substring@3[
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
   LiteralExpr [LONG] [2]
   LiteralExpr [LONG] [3]
 ]
@@ -11,5 +11,5 @@
     LiteralExpr [STRING] [foobar]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase02/toLowerCase02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase02/toLowerCase02.3.ast
index a2e342b..59fe8b6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase02/toLowerCase02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase02/toLowerCase02.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     FunctionCall null.lowercase@1[
@@ -44,5 +44,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase03/toLowerCase03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase03/toLowerCase03.3.ast
index 8c8e6cc..a53ef3f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase03/toLowerCase03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase03/toLowerCase03.3.ast
@@ -3,7 +3,7 @@
 SELECT ELEMENT [
 FunctionCall test.lowercase@1[
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=name
   ]
 ]
@@ -12,11 +12,11 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase04/toLowerCase04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase04/toLowerCase04.3.ast
index 3876d22..a055e43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase04/toLowerCase04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/toLowerCase04/toLowerCase04.3.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     FunctionCall null.lowercase@1[
@@ -45,5 +45,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/01/01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/01/01.3.ast
index fde6704..0d197c6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/01/01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/01/01.3.ast
@@ -2,7 +2,7 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall test.subset-collection@3[
     OrderedListConstructor [
@@ -12,5 +12,5 @@
     LiteralExpr [LONG] [1]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/02/02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/02/02.3.ast
index ec75921..12038e4d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/02/02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/02/02.3.ast
@@ -2,7 +2,7 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall test.subset-collection@3[
     OrderedListConstructor [
@@ -15,5 +15,5 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/03/03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/03/03.3.ast
index 81f5370..b78033c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/03/03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/03/03.3.ast
@@ -2,7 +2,7 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall test.subset-collection@3[
     OrderedListConstructor [
@@ -15,5 +15,5 @@
     LiteralExpr [LONG] [0]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/05/05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/05/05.3.ast
index b3f256c..ee12851 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/05/05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/05/05.3.ast
@@ -2,7 +2,7 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall test.subset-collection@3[
     OrderedListConstructor [
@@ -15,5 +15,5 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/06/06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/06/06.3.ast
index 9854a53..81c185b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/06/06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/06/06.3.ast
@@ -2,7 +2,7 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall test.subset-collection@3[
     OrderedListConstructor [
@@ -15,5 +15,5 @@
     LiteralExpr [LONG] [2]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/07/07.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/07/07.3.ast
index b390374..3eca14b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/07/07.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/subset-collection/07/07.3.ast
@@ -2,7 +2,7 @@
 Set import-private-functions=true
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall test.subset-collection@3[
     OrderedListConstructor [
@@ -15,5 +15,5 @@
     LiteralExpr [LONG] [10]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast
index 185b162..2ea0e43 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
       Field=l_suppkey
     ]
     <
@@ -20,12 +20,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/delete-from-loaded-dataset/delete-from-loaded-dataset.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/delete-from-loaded-dataset/delete-from-loaded-dataset.3.ast
index 55c7a87..93180bd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/delete-from-loaded-dataset/delete-from-loaded-dataset.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/delete-from-loaded-dataset/delete-from-loaded-dataset.3.ast
@@ -1,22 +1,22 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.ast
index 81558b9..539d333 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.ast
@@ -1,18 +1,18 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Metadata.Index]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=IsPrimary
       ]
       =
@@ -21,7 +21,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=DataverseName
       ]
       =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/drop-index/drop-index.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/drop-index/drop-index.4.ast
index de91ce6..6352064 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/drop-index/drop-index.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/drop-index/drop-index.4.ast
@@ -1,19 +1,19 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [t1]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=unique1
       ]
       >
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=stringu1
       ]
       =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/empty-load-with-index/empty-load-with-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/empty-load-with-index/empty-load-with-index.3.ast
index 125e278..2ab0040 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/empty-load-with-index/empty-load-with-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/empty-load-with-index/empty-load-with-index.3.ast
@@ -1,22 +1,22 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_orderkey
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=l_linenumber
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.ast
index d3cf8a6..7839ec7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [test.employee]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/insert-and-scan-dataset/insert-and-scan-dataset.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/insert-and-scan-dataset/insert-and-scan-dataset.3.ast
index c200c21..8d78a96 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/insert-and-scan-dataset/insert-and-scan-dataset.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/insert-and-scan-dataset/insert-and-scan-dataset.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=c ]
+Variable [ Name=$c ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [myData]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
index 40474c7..cafd221 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [sum_qty]
@@ -20,13 +20,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -38,13 +38,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -57,7 +57,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -65,15 +65,15 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -86,7 +86,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -94,7 +94,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -103,15 +103,15 @@
             LiteralExpr [LONG] [1]
             +
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_tax
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -123,13 +123,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -141,13 +141,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -159,13 +159,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -174,7 +174,18 @@
     LiteralExpr [STRING] [count_order]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=l ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -183,36 +194,40 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipdate
     ]
     <=
     LiteralExpr [STRING] [1998-09-02]
   ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast
index 613b78d..a8fb7a2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-delete-rtree-secondary-index/scan-delete-rtree-secondary-index.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-persistent-to-temp/scan-insert-persistent-to-temp.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-persistent-to-temp/scan-insert-persistent-to-temp.5.ast
index 1b0eba1..68e4dd8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-persistent-to-temp/scan-insert-persistent-to-temp.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-persistent-to-temp/scan-insert-persistent-to-temp.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyMiniData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast
index 1b0eba1..68e4dd8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-rtree-secondary-index/scan-insert-rtree-secondary-index.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyMiniData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-temp-to-persistent/scan-insert-temp-to-persistent.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-temp-to-persistent/scan-insert-temp-to-persistent.5.ast
index 1b0eba1..68e4dd8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-temp-to-persistent/scan-insert-temp-to-persistent.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/scan-insert-temp-to-persistent/scan-insert-temp-to-persistent.5.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=id
     ]
   )
@@ -16,12 +16,12 @@
     LiteralExpr [STRING] [MyMiniData]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   FunctionCall test.spatial-intersect@2[
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=point
     ]
     FunctionCall test.create-polygon@1[
@@ -39,7 +39,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/accessors_interval/accessors_interval.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/accessors_interval/accessors_interval.3.ast
index f3014f0..d915dd8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/accessors_interval/accessors_interval.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/accessors_interval/accessors_interval.3.ast
@@ -95,4 +95,4 @@
       ]
     ]
   )
-]
\ No newline at end of file
+]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/duration_functions/duration_functions.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/duration_functions/duration_functions.3.ast
index 6d2d197..79baffb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/duration_functions/duration_functions.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/duration_functions/duration_functions.3.ast
@@ -50,4 +50,4 @@
       LiteralExpr [NULL]
     ]
   )
-]
\ No newline at end of file
+]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/get_overlapping_interval/get_overlapping_interval.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/get_overlapping_interval/get_overlapping_interval.3.ast
index 8fb6da7..28fcb19 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/get_overlapping_interval/get_overlapping_interval.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/get_overlapping_interval/get_overlapping_interval.3.ast
@@ -134,4 +134,4 @@
     ]
   )
 ]
-]
\ No newline at end of file
+]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/insert_from_ext_ds/insert_from_ext_ds.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/insert_from_ext_ds/insert_from_ext_ds.3.ast
index 7f10756..c8acabf 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/insert_from_ext_ds/insert_from_ext_ds.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/insert_from_ext_ds/insert_from_ext_ds.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [date]
     :
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=dateField
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [time]
     :
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=timeField
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [datetime]
     :
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=datetimeField
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [duration]
     :
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=durationField
     ]
   )
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [interval]
     :
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=intervalField
     ]
   )
@@ -46,7 +46,7 @@
     LiteralExpr [STRING] [ymduration]
     :
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=yearMonthDurationField
     ]
   )
@@ -54,7 +54,7 @@
     LiteralExpr [STRING] [dtduration]
     :
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=dayTimeDurationField
     ]
   )
@@ -64,5 +64,5 @@
     LiteralExpr [STRING] [testds]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/insert_from_ext_ds_2/insert_from_ext_ds_2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/insert_from_ext_ds_2/insert_from_ext_ds_2.3.ast
index dfa294f..d7fa604 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/insert_from_ext_ds_2/insert_from_ext_ds_2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/insert_from_ext_ds_2/insert_from_ext_ds_2.3.ast
@@ -1,17 +1,17 @@
 DataverseUse timeTest
 Query:
 SELECT ELEMENT [
-Variable [ Name=r ]
+Variable [ Name=$r ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [timeData]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=date
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_bin_gby_0/interval_bin_gby_0.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_bin_gby_0/interval_bin_gby_0.3.ast
index c511a53..2ba9eb4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_bin_gby_0/interval_bin_gby_0.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_bin_gby_0/interval_bin_gby_0.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [tbin]
     :
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=i ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=i
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,14 +31,14 @@
     LiteralExpr [STRING] [tsdata]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Groupby
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
   :=
   FunctionCall test.interval-bin@3[
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=timestamp
     ]
     FunctionCall test.datetime@1[
@@ -37,12 +48,16 @@
       LiteralExpr [STRING] [P20Y]
     ]
   ]
-  With
-  Variable [ Name=i ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$i ]
+   AS i
+  )
 
 Orderby
   FunctionCall test.get-interval-start@1[
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
   ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_bin_gby_1/interval_bin_gby_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_bin_gby_1/interval_bin_gby_1.3.ast
index 4f3fd53..cbd8716 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_bin_gby_1/interval_bin_gby_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_bin_gby_1/interval_bin_gby_1.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [tbin]
     :
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=i ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=i
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,15 +31,15 @@
     LiteralExpr [STRING] [tsdata]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
 Groupby
-  Variable [ Name=d ]
+  Variable [ Name=$d ]
   :=
   FunctionCall test.interval-bin@3[
     FunctionCall test.get-time-from-datetime@1[
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=timestamp
       ]
     ]
@@ -39,12 +50,16 @@
       LiteralExpr [STRING] [PT10M]
     ]
   ]
-  With
-  Variable [ Name=i ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$i ]
+   AS i
+  )
 
 Orderby
   FunctionCall test.get-interval-start@1[
-    Variable [ Name=d ]
+    Variable [ Name=$d ]
   ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_functions/interval_functions.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_functions/interval_functions.3.ast
index f4e11c6..c6dd653 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_functions/interval_functions.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_functions/interval_functions.3.ast
@@ -1,6 +1,6 @@
 DataverseUse test
 Query:
-LetVariable [ Name=itv1 ]
+Let Variable [ Name=$itv1 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.date@1[
@@ -10,7 +10,7 @@
       LiteralExpr [STRING] [2010-12-21]
     ]
   ]
-LetVariable [ Name=itv2 ]
+Let Variable [ Name=$itv2 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.date@1[
@@ -20,7 +20,7 @@
       LiteralExpr [STRING] [2012-10-21]
     ]
   ]
-LetVariable [ Name=itv3 ]
+Let Variable [ Name=$itv3 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.date@1[
@@ -30,31 +30,31 @@
       LiteralExpr [STRING] [2013-01-01]
     ]
   ]
-LetVariable [ Name=blnBefore1 ]
+Let Variable [ Name=$blnBefore1 ]
   :=
   FunctionCall test.interval-before@2[
-    Variable [ Name=itv1 ]
-    Variable [ Name=itv2 ]
+    Variable [ Name=$itv1 ]
+    Variable [ Name=$itv2 ]
   ]
-LetVariable [ Name=blnAfter1 ]
+Let Variable [ Name=$blnAfter1 ]
   :=
   FunctionCall test.interval-after@2[
-    Variable [ Name=itv2 ]
-    Variable [ Name=itv1 ]
+    Variable [ Name=$itv2 ]
+    Variable [ Name=$itv1 ]
   ]
-LetVariable [ Name=blnBefore2 ]
+Let Variable [ Name=$blnBefore2 ]
   :=
   FunctionCall test.interval-before@2[
-    Variable [ Name=itv1 ]
-    Variable [ Name=itv3 ]
+    Variable [ Name=$itv1 ]
+    Variable [ Name=$itv3 ]
   ]
-LetVariable [ Name=blnAfter2 ]
+Let Variable [ Name=$blnAfter2 ]
   :=
   FunctionCall test.interval-after@2[
-    Variable [ Name=itv3 ]
-    Variable [ Name=itv1 ]
+    Variable [ Name=$itv3 ]
+    Variable [ Name=$itv1 ]
   ]
-LetVariable [ Name=itv4 ]
+Let Variable [ Name=$itv4 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.datetime@1[
@@ -64,7 +64,7 @@
       LiteralExpr [STRING] [2012-07-27T02:02:02.222]
     ]
   ]
-LetVariable [ Name=itv5 ]
+Let Variable [ Name=$itv5 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.datetime@1[
@@ -74,7 +74,7 @@
       LiteralExpr [STRING] [2013-08-08T03:03:03.333]
     ]
   ]
-LetVariable [ Name=itv6 ]
+Let Variable [ Name=$itv6 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.datetime@1[
@@ -84,31 +84,31 @@
       LiteralExpr [STRING] [2013-08-07T03:03:03.333]
     ]
   ]
-LetVariable [ Name=blnMeet1 ]
+Let Variable [ Name=$blnMeet1 ]
   :=
   FunctionCall test.interval-meets@2[
-    Variable [ Name=itv4 ]
-    Variable [ Name=itv5 ]
+    Variable [ Name=$itv4 ]
+    Variable [ Name=$itv5 ]
   ]
-LetVariable [ Name=blnMetBy1 ]
+Let Variable [ Name=$blnMetBy1 ]
   :=
   FunctionCall test.interval-met-by@2[
-    Variable [ Name=itv5 ]
-    Variable [ Name=itv4 ]
+    Variable [ Name=$itv5 ]
+    Variable [ Name=$itv4 ]
   ]
-LetVariable [ Name=blnMeet2 ]
+Let Variable [ Name=$blnMeet2 ]
   :=
   FunctionCall test.interval-meets@2[
-    Variable [ Name=itv6 ]
-    Variable [ Name=itv4 ]
+    Variable [ Name=$itv6 ]
+    Variable [ Name=$itv4 ]
   ]
-LetVariable [ Name=blnMetBy2 ]
+Let Variable [ Name=$blnMetBy2 ]
   :=
   FunctionCall test.interval-met-by@2[
-    Variable [ Name=itv6 ]
-    Variable [ Name=itv4 ]
+    Variable [ Name=$itv6 ]
+    Variable [ Name=$itv4 ]
   ]
-LetVariable [ Name=itv7 ]
+Let Variable [ Name=$itv7 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.time@1[
@@ -118,7 +118,7 @@
       LiteralExpr [STRING] [20:29:20]
     ]
   ]
-LetVariable [ Name=itv8 ]
+Let Variable [ Name=$itv8 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.time@1[
@@ -128,7 +128,7 @@
       LiteralExpr [STRING] [22:19:49]
     ]
   ]
-LetVariable [ Name=itv9 ]
+Let Variable [ Name=$itv9 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.time@1[
@@ -138,43 +138,43 @@
       LiteralExpr [STRING] [17:48:19]
     ]
   ]
-LetVariable [ Name=blnOverlaps1 ]
+Let Variable [ Name=$blnOverlaps1 ]
   :=
   FunctionCall test.interval-overlaps@2[
-    Variable [ Name=itv7 ]
-    Variable [ Name=itv8 ]
+    Variable [ Name=$itv7 ]
+    Variable [ Name=$itv8 ]
   ]
-LetVariable [ Name=blnOverlapped1 ]
+Let Variable [ Name=$blnOverlapped1 ]
   :=
   FunctionCall test.interval-overlapped-by@2[
-    Variable [ Name=itv8 ]
-    Variable [ Name=itv7 ]
+    Variable [ Name=$itv8 ]
+    Variable [ Name=$itv7 ]
   ]
-LetVariable [ Name=blnOverlaps2 ]
+Let Variable [ Name=$blnOverlaps2 ]
   :=
   FunctionCall test.interval-overlaps@2[
-    Variable [ Name=itv9 ]
-    Variable [ Name=itv8 ]
+    Variable [ Name=$itv9 ]
+    Variable [ Name=$itv8 ]
   ]
-LetVariable [ Name=blnOverlapped2 ]
+Let Variable [ Name=$blnOverlapped2 ]
   :=
   FunctionCall test.interval-overlapped-by@2[
-    Variable [ Name=itv8 ]
-    Variable [ Name=itv9 ]
+    Variable [ Name=$itv8 ]
+    Variable [ Name=$itv9 ]
   ]
-LetVariable [ Name=blnOverlap1 ]
+Let Variable [ Name=$blnOverlap1 ]
   :=
   FunctionCall test.interval-overlapping@2[
-    Variable [ Name=itv9 ]
-    Variable [ Name=itv7 ]
+    Variable [ Name=$itv9 ]
+    Variable [ Name=$itv7 ]
   ]
-LetVariable [ Name=blnOverlap2 ]
+Let Variable [ Name=$blnOverlap2 ]
   :=
   FunctionCall test.interval-overlapping@2[
-    Variable [ Name=itv9 ]
-    Variable [ Name=itv8 ]
+    Variable [ Name=$itv9 ]
+    Variable [ Name=$itv8 ]
   ]
-LetVariable [ Name=itv10 ]
+Let Variable [ Name=$itv10 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.date@1[
@@ -184,31 +184,31 @@
       LiteralExpr [STRING] [2010-11-30]
     ]
   ]
-LetVariable [ Name=blnStarts1 ]
+Let Variable [ Name=$blnStarts1 ]
   :=
   FunctionCall test.interval-starts@2[
-    Variable [ Name=itv10 ]
-    Variable [ Name=itv1 ]
+    Variable [ Name=$itv10 ]
+    Variable [ Name=$itv1 ]
   ]
-LetVariable [ Name=blnStarts2 ]
+Let Variable [ Name=$blnStarts2 ]
   :=
   FunctionCall test.interval-starts@2[
-    Variable [ Name=itv10 ]
-    Variable [ Name=itv2 ]
+    Variable [ Name=$itv10 ]
+    Variable [ Name=$itv2 ]
   ]
-LetVariable [ Name=blnStartedBy1 ]
+Let Variable [ Name=$blnStartedBy1 ]
   :=
   FunctionCall test.interval-started-by@2[
-    Variable [ Name=itv1 ]
-    Variable [ Name=itv10 ]
+    Variable [ Name=$itv1 ]
+    Variable [ Name=$itv10 ]
   ]
-LetVariable [ Name=blnStartedBy2 ]
+Let Variable [ Name=$blnStartedBy2 ]
   :=
   FunctionCall test.interval-started-by@2[
-    Variable [ Name=itv10 ]
-    Variable [ Name=itv2 ]
+    Variable [ Name=$itv10 ]
+    Variable [ Name=$itv2 ]
   ]
-LetVariable [ Name=itv10 ]
+Let Variable [ Name=$itv10 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.datetime@1[
@@ -218,7 +218,7 @@
       LiteralExpr [STRING] [2013-08-07T03:03:03.333]
     ]
   ]
-LetVariable [ Name=itv11 ]
+Let Variable [ Name=$itv11 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.datetime@1[
@@ -228,7 +228,7 @@
       LiteralExpr [STRING] [2013-08-07T03:03:03.333]
     ]
   ]
-LetVariable [ Name=itv12 ]
+Let Variable [ Name=$itv12 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.datetime@1[
@@ -238,31 +238,31 @@
       LiteralExpr [STRING] [2013-08-07T03:03:03.333]
     ]
   ]
-LetVariable [ Name=blnCovers1 ]
+Let Variable [ Name=$blnCovers1 ]
   :=
   FunctionCall test.interval-covers@2[
-    Variable [ Name=itv10 ]
-    Variable [ Name=itv11 ]
+    Variable [ Name=$itv10 ]
+    Variable [ Name=$itv11 ]
   ]
-LetVariable [ Name=blnCovers2 ]
+Let Variable [ Name=$blnCovers2 ]
   :=
   FunctionCall test.interval-covers@2[
-    Variable [ Name=itv10 ]
-    Variable [ Name=itv12 ]
+    Variable [ Name=$itv10 ]
+    Variable [ Name=$itv12 ]
   ]
-LetVariable [ Name=blnCoveredBy1 ]
+Let Variable [ Name=$blnCoveredBy1 ]
   :=
   FunctionCall test.interval-covered-by@2[
-    Variable [ Name=itv11 ]
-    Variable [ Name=itv10 ]
+    Variable [ Name=$itv11 ]
+    Variable [ Name=$itv10 ]
   ]
-LetVariable [ Name=blnCoveredBy2 ]
+Let Variable [ Name=$blnCoveredBy2 ]
   :=
   FunctionCall test.interval-covered-by@2[
-    Variable [ Name=itv12 ]
-    Variable [ Name=itv10 ]
+    Variable [ Name=$itv12 ]
+    Variable [ Name=$itv10 ]
   ]
-LetVariable [ Name=itv11 ]
+Let Variable [ Name=$itv11 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.time@1[
@@ -272,43 +272,43 @@
       LiteralExpr [STRING] [20:29:20.000]
     ]
   ]
-LetVariable [ Name=blnEnds1 ]
+Let Variable [ Name=$blnEnds1 ]
   :=
   FunctionCall test.interval-ends@2[
-    Variable [ Name=itv11 ]
-    Variable [ Name=itv7 ]
+    Variable [ Name=$itv11 ]
+    Variable [ Name=$itv7 ]
   ]
-LetVariable [ Name=blnEnds2 ]
+Let Variable [ Name=$blnEnds2 ]
   :=
   FunctionCall test.interval-ends@2[
-    Variable [ Name=itv11 ]
-    Variable [ Name=itv8 ]
+    Variable [ Name=$itv11 ]
+    Variable [ Name=$itv8 ]
   ]
-LetVariable [ Name=blnEndedBy1 ]
+Let Variable [ Name=$blnEndedBy1 ]
   :=
   FunctionCall test.interval-ended-by@2[
-    Variable [ Name=itv7 ]
-    Variable [ Name=itv11 ]
+    Variable [ Name=$itv7 ]
+    Variable [ Name=$itv11 ]
   ]
-LetVariable [ Name=blnEndedBy2 ]
+Let Variable [ Name=$blnEndedBy2 ]
   :=
   FunctionCall test.interval-ended-by@2[
-    Variable [ Name=itv8 ]
-    Variable [ Name=itv11 ]
+    Variable [ Name=$itv8 ]
+    Variable [ Name=$itv11 ]
   ]
-LetVariable [ Name=null1 ]
+Let Variable [ Name=$null1 ]
   :=
   FunctionCall test.interval-before@2[
     LiteralExpr [NULL]
-    Variable [ Name=itv2 ]
+    Variable [ Name=$itv2 ]
   ]
-LetVariable [ Name=null2 ]
+Let Variable [ Name=$null2 ]
   :=
   FunctionCall test.interval-covered-by@2[
-    Variable [ Name=itv11 ]
+    Variable [ Name=$itv11 ]
     LiteralExpr [NULL]
   ]
-LetVariable [ Name=null3 ]
+Let Variable [ Name=$null3 ]
   :=
   FunctionCall test.interval-overlapping@2[
     LiteralExpr [NULL]
@@ -319,147 +319,147 @@
   (
     LiteralExpr [STRING] [before1]
     :
-    Variable [ Name=blnBefore1 ]
+    Variable [ Name=$blnBefore1 ]
   )
   (
     LiteralExpr [STRING] [before2]
     :
-    Variable [ Name=blnBefore2 ]
+    Variable [ Name=$blnBefore2 ]
   )
   (
     LiteralExpr [STRING] [after1]
     :
-    Variable [ Name=blnAfter1 ]
+    Variable [ Name=$blnAfter1 ]
   )
   (
     LiteralExpr [STRING] [after2]
     :
-    Variable [ Name=blnAfter2 ]
+    Variable [ Name=$blnAfter2 ]
   )
   (
     LiteralExpr [STRING] [meet1]
     :
-    Variable [ Name=blnMeet1 ]
+    Variable [ Name=$blnMeet1 ]
   )
   (
     LiteralExpr [STRING] [meet2]
     :
-    Variable [ Name=blnMeet2 ]
+    Variable [ Name=$blnMeet2 ]
   )
   (
     LiteralExpr [STRING] [metby1]
     :
-    Variable [ Name=blnMetBy1 ]
+    Variable [ Name=$blnMetBy1 ]
   )
   (
     LiteralExpr [STRING] [metby2]
     :
-    Variable [ Name=blnMetBy2 ]
+    Variable [ Name=$blnMetBy2 ]
   )
   (
     LiteralExpr [STRING] [overlaps1]
     :
-    Variable [ Name=blnOverlaps1 ]
+    Variable [ Name=$blnOverlaps1 ]
   )
   (
     LiteralExpr [STRING] [overlaps2]
     :
-    Variable [ Name=blnOverlaps2 ]
+    Variable [ Name=$blnOverlaps2 ]
   )
   (
     LiteralExpr [STRING] [overlapped1]
     :
-    Variable [ Name=blnOverlapped1 ]
+    Variable [ Name=$blnOverlapped1 ]
   )
   (
     LiteralExpr [STRING] [overlapped2]
     :
-    Variable [ Name=blnOverlapped2 ]
+    Variable [ Name=$blnOverlapped2 ]
   )
   (
     LiteralExpr [STRING] [overlap1]
     :
-    Variable [ Name=blnOverlap1 ]
+    Variable [ Name=$blnOverlap1 ]
   )
   (
     LiteralExpr [STRING] [overlap2]
     :
-    Variable [ Name=blnOverlap2 ]
+    Variable [ Name=$blnOverlap2 ]
   )
   (
     LiteralExpr [STRING] [starts1]
     :
-    Variable [ Name=blnStarts1 ]
+    Variable [ Name=$blnStarts1 ]
   )
   (
     LiteralExpr [STRING] [starts2]
     :
-    Variable [ Name=blnStarts2 ]
+    Variable [ Name=$blnStarts2 ]
   )
   (
     LiteralExpr [STRING] [startedby1]
     :
-    Variable [ Name=blnStartedBy1 ]
+    Variable [ Name=$blnStartedBy1 ]
   )
   (
     LiteralExpr [STRING] [startedby2]
     :
-    Variable [ Name=blnStartedBy2 ]
+    Variable [ Name=$blnStartedBy2 ]
   )
   (
     LiteralExpr [STRING] [covers1]
     :
-    Variable [ Name=blnCovers1 ]
+    Variable [ Name=$blnCovers1 ]
   )
   (
     LiteralExpr [STRING] [covers2]
     :
-    Variable [ Name=blnCovers2 ]
+    Variable [ Name=$blnCovers2 ]
   )
   (
     LiteralExpr [STRING] [coveredby1]
     :
-    Variable [ Name=blnCoveredBy1 ]
+    Variable [ Name=$blnCoveredBy1 ]
   )
   (
     LiteralExpr [STRING] [coveredby2]
     :
-    Variable [ Name=blnCoveredBy2 ]
+    Variable [ Name=$blnCoveredBy2 ]
   )
   (
     LiteralExpr [STRING] [ends1]
     :
-    Variable [ Name=blnEnds1 ]
+    Variable [ Name=$blnEnds1 ]
   )
   (
     LiteralExpr [STRING] [ends2]
     :
-    Variable [ Name=blnEnds2 ]
+    Variable [ Name=$blnEnds2 ]
   )
   (
     LiteralExpr [STRING] [endedby1]
     :
-    Variable [ Name=blnEndedBy1 ]
+    Variable [ Name=$blnEndedBy1 ]
   )
   (
     LiteralExpr [STRING] [endedby2]
     :
-    Variable [ Name=blnEndedBy2 ]
+    Variable [ Name=$blnEndedBy2 ]
   )
   (
     LiteralExpr [STRING] [null1]
     :
-    Variable [ Name=null1 ]
+    Variable [ Name=$null1 ]
   )
   (
     LiteralExpr [STRING] [null2]
     :
-    Variable [ Name=null2 ]
+    Variable [ Name=$null2 ]
   )
   (
     LiteralExpr [STRING] [null3]
     :
-    Variable [ Name=null3 ]
+    Variable [ Name=$null3 ]
   )
 ]
-]
\ No newline at end of file
+]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast
index 297d932..a6628c6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast
@@ -6,24 +6,24 @@
     LiteralExpr [STRING] [tbin]
     :
     FieldAccessor [
-      Variable [ Name=gen0 ]
+      Variable [ Name=$gen0 ]
       Field=bin
     ]
   )
   (
     LiteralExpr [STRING] [interval]
     :
-    Variable [ Name=itv ]
+    Variable [ Name=$itv ]
   )
   (
     LiteralExpr [STRING] [overlap]
     :
     FunctionCall test.get-overlapping-interval@2[
       FieldAccessor [
-        Variable [ Name=gen0 ]
+        Variable [ Name=$gen0 ]
         Field=bin
       ]
-      Variable [ Name=itv ]
+      Variable [ Name=$itv ]
     ]
   )
 ]
@@ -34,44 +34,44 @@
       (
         LiteralExpr [STRING] [bin]
         :
-        Variable [ Name=bin ]
+        Variable [ Name=$bin ]
       )
       (
         LiteralExpr [STRING] [i]
         :
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       )
     ]
     ]
     FROM [      (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [tsdata]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Orderby
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=time
           ]
           ASC
 
       )
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
 ,
       FunctionCall test.overlap-bins@3[
         FunctionCall test.interval-start-from-time@2[
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=time
           ]
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=duration
           ]
         ]
@@ -83,49 +83,54 @@
         ]
       ]
       AS
-      Variable [ Name=j ]
+      Variable [ Name=$j ]
     ]
     Groupby
-      Variable [ Name=bin ]
+      Variable [ Name=$bin ]
       :=
-      Variable [ Name=j ]
-      With
-      Variable [ Name=i ]
-      Variable [ Name=j ]
+      Variable [ Name=$j ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$j ]
+       AS j
+      Variable [ Name=$i ]
+       AS i
+      )
 
     Orderby
       FunctionCall test.get-interval-start@1[
-        Variable [ Name=bin ]
+        Variable [ Name=$bin ]
       ]
       ASC
 
   )
   AS
-  Variable [ Name=gen0 ]
+  Variable [ Name=$gen0 ]
 ,
   FieldAccessor [
-    Variable [ Name=gen0 ]
+    Variable [ Name=$gen0 ]
     Field=i
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
-LetVariable [ Name=itv ]
+Let Variable [ Name=$itv ]
   :=
   FunctionCall test.interval-start-from-time@2[
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=time
     ]
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=duration
     ]
   ]
 Orderby
   FunctionCall test.get-interval-start@1[
     FieldAccessor [
-      Variable [ Name=gen0 ]
+      Variable [ Name=$gen0 ]
       Field=bin
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast
index d9ab42e..6bb0ab6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [timebin]
     :
-    Variable [ Name=bin ]
+    Variable [ Name=$bin ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=i2 ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=i2
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
   (
@@ -23,18 +34,18 @@
         FunctionCall test.ms-from-day-time-duration@1[
           FunctionCall test.duration-from-interval@1[
             FunctionCall test.get-overlapping-interval@2[
-              Variable [ Name=bin ]
+              Variable [ Name=$bin ]
               FieldAccessor [
-                Variable [ Name=i3 ]
+                Variable [ Name=$i3 ]
                 Field=interval
               ]
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=i2 ]
+        FROM [          Variable [ Name=$i2 ]
           AS
-          Variable [ Name=i3 ]
+          Variable [ Name=$i3 ]
         ]
       )
     ]
@@ -49,11 +60,11 @@
         :
         FunctionCall test.interval-start-from-time@2[
           FieldAccessor [
-            Variable [ Name=i1 ]
+            Variable [ Name=$i1 ]
             Field=time
           ]
           FieldAccessor [
-            Variable [ Name=i1 ]
+            Variable [ Name=$i1 ]
             Field=duration
           ]
         ]
@@ -64,22 +75,22 @@
         LiteralExpr [STRING] [tsdata]
       ]
       AS
-      Variable [ Name=i1 ]
+      Variable [ Name=$i1 ]
     ]
     Orderby
       FieldAccessor [
-        Variable [ Name=i1 ]
+        Variable [ Name=$i1 ]
         Field=time
       ]
       ASC
 
   )
   AS
-  Variable [ Name=i2 ]
+  Variable [ Name=$i2 ]
 ,
   FunctionCall test.overlap-bins@3[
     FieldAccessor [
-      Variable [ Name=i2 ]
+      Variable [ Name=$i2 ]
       Field=interval
     ]
     FunctionCall test.time@1[
@@ -90,19 +101,24 @@
     ]
   ]
   AS
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
 ]
 Groupby
-  Variable [ Name=bin ]
+  Variable [ Name=$bin ]
   :=
-  Variable [ Name=j ]
-  With
-  Variable [ Name=i2 ]
-  Variable [ Name=j ]
+  Variable [ Name=$j ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$j ]
+   AS j
+  Variable [ Name=$i2 ]
+   AS i2
+  )
 
 Orderby
   FunctionCall test.get-interval-start@1[
-    Variable [ Name=bin ]
+    Variable [ Name=$bin ]
   ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.ast
index 645c82c..f03e64f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [timebin]
     :
-    Variable [ Name=bin ]
+    Variable [ Name=$bin ]
   )
   (
     LiteralExpr [STRING] [subgroups]
@@ -16,13 +16,24 @@
         (
           LiteralExpr [STRING] [subgid]
           :
-          Variable [ Name=subgid ]
+          Variable [ Name=$subgid ]
         )
         (
           LiteralExpr [STRING] [item_count]
           :
           FunctionCall multitask.count@1[
-            Variable [ Name=i ]
+            (
+              SELECT ELEMENT [
+              FieldAccessor [
+                Variable [ Name=#2 ]
+                Field=i
+              ]
+              ]
+              FROM [                Variable [ Name=#1 ]
+                AS
+                Variable [ Name=#2 ]
+              ]
+            )
           ]
         )
       ]
@@ -31,40 +42,56 @@
           LiteralExpr [STRING] [logs]
         ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
       Where
         FunctionCall multitask.interval-covers@2[
-          Variable [ Name=bin ]
+          Variable [ Name=$bin ]
           FunctionCall multitask.interval-start-from-time@2[
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=time
             ]
             FunctionCall multitask.duration-from-ms@1[
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=duration
               ]
             ]
           ]
         ]
       Groupby
-        Variable [ Name=subgid ]
+        Variable [ Name=$subgid ]
         :=
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=app
         ]
-        With
-        Variable [ Name=i ]
-        Variable [ Name=bin ]
+        GROUP AS
+        Variable [ Name=#1 ]
+        (
+        Variable [ Name=$i ]
+         AS i
+        Variable [ Name=$bin ]
+         AS bin
+        )
 
       Orderby
-        Variable [ Name=subgid ]
+        Variable [ Name=$subgid ]
         ASC
         FunctionCall multitask.count@1[
-          Variable [ Name=i ]
+          (
+            SELECT ELEMENT [
+            FieldAccessor [
+              Variable [ Name=#3 ]
+              Field=i
+            ]
+            ]
+            FROM [              Variable [ Name=#1 ]
+              AS
+              Variable [ Name=#3 ]
+            ]
+          )
         ]
         ASC
 
@@ -78,7 +105,7 @@
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=time
           ]
           ]
@@ -86,7 +113,7 @@
               LiteralExpr [STRING] [logs]
             ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -95,14 +122,14 @@
           SELECT ELEMENT [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=time
             ]
             +
             FunctionCall multitask.duration-from-ms@1[
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=i ]
+                  Variable [ Name=$i ]
                   Field=duration
                 ]
                 *
@@ -115,7 +142,7 @@
               LiteralExpr [STRING] [logs]
             ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -128,11 +155,11 @@
     ]
   ]
   AS
-  Variable [ Name=bin ]
+  Variable [ Name=$bin ]
 ]
 Orderby
   FunctionCall multitask.get-interval-start@1[
-    Variable [ Name=bin ]
+    Variable [ Name=$bin ]
   ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1263.23.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1263.23.ast
index 59998f2..26fbca7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1263.23.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1263.23.ast
@@ -1,41 +1,71 @@
 DataverseUse TinySocial
 Query:
 SELECT [
-Variable [ Name=h ]
+Variable [ Name=$h ]
 hour
 FunctionCall TinySocial.count@1[
-  Variable [ Name=t ]
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      Variable [ Name=#2 ]
+      Field=t
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS
+      Variable [ Name=#2 ]
+    ]
+  )
 ]
 count
 (
   SELECT [
-  Variable [ Name=min ]
+  Variable [ Name=$min ]
   minute
   FunctionCall TinySocial.count@1[
-    Variable [ Name=k ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#4 ]
+        Field=k
+      ]
+      ]
+      FROM [        Variable [ Name=#3 ]
+        AS
+        Variable [ Name=#4 ]
+      ]
+    )
   ]
   sum
   ]
-  FROM [    Variable [ Name=t ]
+  FROM [    Variable [ Name=$t ]
     AS
-    Variable [ Name=k ]
+    Variable [ Name=$k ]
   ]
   Groupby
-    Variable [ Name=min ]
+    Variable [ Name=$min ]
     :=
     FunctionCall TinySocial.get-minute@1[
       FieldAccessor [
-        Variable [ Name=k ]
+        Variable [ Name=$k ]
         Field=send-time
       ]
     ]
-    With
-    Variable [ Name=k ]
-    Variable [ Name=t ]
-    Variable [ Name=h ]
+    GROUP AS
+    Variable [ Name=#3 ]
+    (
+    Variable [ Name=$k ]
+     AS k
+    Variable [ Name=$t ]
+     AS t
+    Variable [ Name=$h ]
+     AS h
+    Variable [ Name=#1 ]
+     AS #1
+    )
 
   Orderby
-    Variable [ Name=min ]
+    Variable [ Name=$min ]
     ASC
 
 )
@@ -45,17 +75,21 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=h ]
+  Variable [ Name=$h ]
   :=
   FunctionCall TinySocial.get-hour@1[
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=send-time
     ]
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1329.24.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1329.24.ast
index ee00dd5..a2c59b9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1329.24.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1329.24.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT [
 FieldAccessor [
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
   Field=name
 ]
 uname
 FieldAccessor [
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
   Field=alias
 ]
 alias
 FunctionCall TinySocial.substring@2[
   FieldAccessor [
-    Variable [ Name=message ]
+    Variable [ Name=$message ]
     Field=message
   ]
   LiteralExpr [LONG] [30]
@@ -24,31 +24,31 @@
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=message ]
+  Variable [ Name=$message ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=author-id
       ]
       =
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=in-response-to
       ]
       >=
@@ -57,7 +57,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=in-response-to
       ]
       <
@@ -66,18 +66,18 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=alias
   ]
   ASC
   FunctionCall TinySocial.substring@2[
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
     LiteralExpr [LONG] [30]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.ast
index cf21764..05a04de 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.ast
@@ -6,7 +6,7 @@
     SELECT ELEMENT [
     FunctionCall TinySocial.string-length@1[
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=message
       ]
     ]
@@ -15,13 +15,13 @@
         LiteralExpr [STRING] [FacebookMessages]
       ]
       AS
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=message ]
+            Variable [ Name=$message ]
             Field=in-response-to
           ]
           >=
@@ -30,7 +30,7 @@
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=message ]
+            Variable [ Name=$message ]
             Field=in-response-to
           ]
           <
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.10.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.10.ast
index 186b777..4897c56 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.10.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.10.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=message-text
     ]
   )
@@ -20,7 +20,7 @@
           LiteralExpr [STRING] [msgtxt]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
         )
@@ -30,17 +30,17 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall TinySocial.spatial-distance@2[
             FieldAccessor [
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
               Field=sender-location
             ]
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=sender-location
             ]
           ]
@@ -49,7 +49,7 @@
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=message-text
         ]
         ASC
@@ -62,11 +62,11 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=message-text
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.11.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.11.ast
index ece5063..ba39c82 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.11.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.11.ast
@@ -8,7 +8,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=id
     ]
   )
@@ -16,7 +16,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=name
     ]
   )
@@ -30,7 +30,7 @@
           LiteralExpr [STRING] [twitter-screenname]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=screen-name
           ]
         )
@@ -38,7 +38,7 @@
           LiteralExpr [STRING] [twitter-name]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=name
           ]
         )
@@ -48,23 +48,23 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
       ]
-      LetVariable [ Name=tu ]
+      Let Variable [ Name=$tu ]
         :=
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=user
         ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=name
           ]
           ~=
           FieldAccessor [
-            Variable [ Name=fbu ]
+            Variable [ Name=$fbu ]
             Field=name
           ]
         ]
@@ -76,11 +76,11 @@
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=fbu ]
+  Variable [ Name=$fbu ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.12.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.12.ast
index 2b942b0..8f1cae6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.12.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.12.ast
@@ -1,27 +1,27 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=fbu ]
+Variable [ Name=$fbu ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=fbu ]
+  Variable [ Name=$fbu ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=e ]
+    [Variable [ Name=$e ]
     In
       FieldAccessor [
-        Variable [ Name=fbu ]
+        Variable [ Name=$fbu ]
         Field=employment
       ]
     ]
     Satifies [
       FunctionCall TinySocial.is-null@1[
         FieldAccessor [
-          Variable [ Name=e ]
+          Variable [ Name=$e ]
           Field=end-date
         ]
       ]
@@ -29,7 +29,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.13.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.13.ast
index c78d170..f08f7f8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.13.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.13.ast
@@ -1,20 +1,20 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=fbu ]
+Variable [ Name=$fbu ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=fbu ]
+  Variable [ Name=$fbu ]
 ]
 Where
   QuantifiedExpression EVERY [
-    [Variable [ Name=e ]
+    [Variable [ Name=$e ]
     In
       FieldAccessor [
-        Variable [ Name=fbu ]
+        Variable [ Name=$fbu ]
         Field=employment
       ]
     ]
@@ -22,7 +22,7 @@
       FunctionCall TinySocial.not@1[
         FunctionCall TinySocial.is-null@1[
           FieldAccessor [
-            Variable [ Name=e ]
+            Variable [ Name=$e ]
             Field=end-date
           ]
         ]
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.14.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.14.ast
index 443473e..3fbe06c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.14.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.14.ast
@@ -4,13 +4,13 @@
 FunctionCall TinySocial.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [FacebookUsers]
       ]
       AS
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast
index d79d874..0f0d61c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=uid ]
+    Variable [ Name=$uid ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall TinySocial.count@1[
-      Variable [ Name=t ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=t
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,22 +31,26 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   :=
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=user
     ]
     Field=screen-name
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
 Orderby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast
index d79d874..0f0d61c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=uid ]
+    Variable [ Name=$uid ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall TinySocial.count@1[
-      Variable [ Name=t ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=t
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,22 +31,26 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   :=
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=user
     ]
     Field=screen-name
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
 Orderby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast
index 3f22cd6..95168d3 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=uid ]
+    Variable [ Name=$uid ]
   )
   (
     LiteralExpr [STRING] [count]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
 ]
 ]
@@ -18,30 +18,45 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   :=
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=user
     ]
     Field=screen-name
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   FunctionCall TinySocial.count@1[
-    Variable [ Name=t ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=t
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   ASC
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.18.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.18.ast
index 04c2dfa..6882190 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.18.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.18.ast
@@ -7,7 +7,7 @@
   (
     LiteralExpr [STRING] [tweet]
     :
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
   )
   (
     LiteralExpr [STRING] [similar-tweets]
@@ -15,7 +15,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=referred-topics
       ]
       ]
@@ -23,37 +23,37 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=referred-topics
             ]
             ~=
             FieldAccessor [
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
               Field=referred-topics
             ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -66,11 +66,11 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.20.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.20.ast
index aab796b..ee10149 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.20.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.20.ast
@@ -1,17 +1,17 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=t ]
+Variable [ Name=$t ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.22.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.22.ast
index f106f19..84f59cd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.22.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.22.ast
@@ -4,18 +4,18 @@
 FunctionCall TinySocial.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [TweetMessages]
       ]
       AS
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=tweetid
         ]
         =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.4.ast
index 760a841..d198d59 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.4.ast
@@ -1,18 +1,18 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.5.ast
index 2aa7368..1b17ecc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.5.ast
@@ -1,19 +1,19 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       >=
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       <=
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.6.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.6.ast
index ebb834b..61b959b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.6.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.6.ast
@@ -1,19 +1,19 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=user-since
       ]
       >=
@@ -24,7 +24,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=user-since
       ]
       <=
@@ -35,7 +35,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.7.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.7.ast
index fc54b9d..40c8c3d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.7.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.7.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
   )
@@ -24,34 +24,34 @@
     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 [
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=author-id
     ]
     =
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=message ]
+    Variable [ Name=$message ]
     Field=message-id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.8.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.8.ast
index fc54b9d..40c8c3d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.8.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.8.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
   )
@@ -24,34 +24,34 @@
     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 [
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=author-id
     ]
     =
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=message ]
+    Variable [ Name=$message ]
     Field=message-id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.9.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.9.ast
index 4f5ba43..d592be5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.9.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.9.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -16,7 +16,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=message
       ]
       ]
@@ -24,23 +24,23 @@
           LiteralExpr [STRING] [FacebookMessages]
         ]
         AS
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=message ]
+            Variable [ Name=$message ]
             Field=author-id
           ]
           =
           FieldAccessor [
-            Variable [ Name=user ]
+            Variable [ Name=$user ]
             Field=id
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=message ]
+          Variable [ Name=$message ]
           Field=message-id
         ]
         ASC
@@ -53,11 +53,11 @@
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/query-ASTERIXDB-1263.23.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/query-ASTERIXDB-1263.23.ast
index 59998f2..26fbca7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/query-ASTERIXDB-1263.23.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/query-ASTERIXDB-1263.23.ast
@@ -1,41 +1,71 @@
 DataverseUse TinySocial
 Query:
 SELECT [
-Variable [ Name=h ]
+Variable [ Name=$h ]
 hour
 FunctionCall TinySocial.count@1[
-  Variable [ Name=t ]
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      Variable [ Name=#2 ]
+      Field=t
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS
+      Variable [ Name=#2 ]
+    ]
+  )
 ]
 count
 (
   SELECT [
-  Variable [ Name=min ]
+  Variable [ Name=$min ]
   minute
   FunctionCall TinySocial.count@1[
-    Variable [ Name=k ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#4 ]
+        Field=k
+      ]
+      ]
+      FROM [        Variable [ Name=#3 ]
+        AS
+        Variable [ Name=#4 ]
+      ]
+    )
   ]
   sum
   ]
-  FROM [    Variable [ Name=t ]
+  FROM [    Variable [ Name=$t ]
     AS
-    Variable [ Name=k ]
+    Variable [ Name=$k ]
   ]
   Groupby
-    Variable [ Name=min ]
+    Variable [ Name=$min ]
     :=
     FunctionCall TinySocial.get-minute@1[
       FieldAccessor [
-        Variable [ Name=k ]
+        Variable [ Name=$k ]
         Field=send-time
       ]
     ]
-    With
-    Variable [ Name=k ]
-    Variable [ Name=t ]
-    Variable [ Name=h ]
+    GROUP AS
+    Variable [ Name=#3 ]
+    (
+    Variable [ Name=$k ]
+     AS k
+    Variable [ Name=$t ]
+     AS t
+    Variable [ Name=$h ]
+     AS h
+    Variable [ Name=#1 ]
+     AS #1
+    )
 
   Orderby
-    Variable [ Name=min ]
+    Variable [ Name=$min ]
     ASC
 
 )
@@ -45,17 +75,21 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=h ]
+  Variable [ Name=$h ]
   :=
   FunctionCall TinySocial.get-hour@1[
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=send-time
     ]
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.10.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.10.ast
index 186b777..4897c56 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.10.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.10.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=message-text
     ]
   )
@@ -20,7 +20,7 @@
           LiteralExpr [STRING] [msgtxt]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
         )
@@ -30,17 +30,17 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           FunctionCall TinySocial.spatial-distance@2[
             FieldAccessor [
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
               Field=sender-location
             ]
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=sender-location
             ]
           ]
@@ -49,7 +49,7 @@
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=message-text
         ]
         ASC
@@ -62,11 +62,11 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=message-text
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.11.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.11.ast
index ece5063..ba39c82 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.11.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.11.ast
@@ -8,7 +8,7 @@
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=id
     ]
   )
@@ -16,7 +16,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=name
     ]
   )
@@ -30,7 +30,7 @@
           LiteralExpr [STRING] [twitter-screenname]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=screen-name
           ]
         )
@@ -38,7 +38,7 @@
           LiteralExpr [STRING] [twitter-name]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=name
           ]
         )
@@ -48,23 +48,23 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
       ]
-      LetVariable [ Name=tu ]
+      Let Variable [ Name=$tu ]
         :=
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=user
         ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=name
           ]
           ~=
           FieldAccessor [
-            Variable [ Name=fbu ]
+            Variable [ Name=$fbu ]
             Field=name
           ]
         ]
@@ -76,11 +76,11 @@
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=fbu ]
+  Variable [ Name=$fbu ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.12.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.12.ast
index 2b942b0..8f1cae6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.12.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.12.ast
@@ -1,27 +1,27 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=fbu ]
+Variable [ Name=$fbu ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=fbu ]
+  Variable [ Name=$fbu ]
 ]
 Where
   QuantifiedExpression SOME [
-    [Variable [ Name=e ]
+    [Variable [ Name=$e ]
     In
       FieldAccessor [
-        Variable [ Name=fbu ]
+        Variable [ Name=$fbu ]
         Field=employment
       ]
     ]
     Satifies [
       FunctionCall TinySocial.is-null@1[
         FieldAccessor [
-          Variable [ Name=e ]
+          Variable [ Name=$e ]
           Field=end-date
         ]
       ]
@@ -29,7 +29,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.13.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.13.ast
index c78d170..f08f7f8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.13.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.13.ast
@@ -1,20 +1,20 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=fbu ]
+Variable [ Name=$fbu ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=fbu ]
+  Variable [ Name=$fbu ]
 ]
 Where
   QuantifiedExpression EVERY [
-    [Variable [ Name=e ]
+    [Variable [ Name=$e ]
     In
       FieldAccessor [
-        Variable [ Name=fbu ]
+        Variable [ Name=$fbu ]
         Field=employment
       ]
     ]
@@ -22,7 +22,7 @@
       FunctionCall TinySocial.not@1[
         FunctionCall TinySocial.is-null@1[
           FieldAccessor [
-            Variable [ Name=e ]
+            Variable [ Name=$e ]
             Field=end-date
           ]
         ]
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.14.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.14.ast
index 443473e..3fbe06c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.14.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.14.ast
@@ -4,13 +4,13 @@
 FunctionCall TinySocial.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [FacebookUsers]
       ]
       AS
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
     ]
   )
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.15.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.15.ast
index d79d874..0f0d61c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.15.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.15.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=uid ]
+    Variable [ Name=$uid ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall TinySocial.count@1[
-      Variable [ Name=t ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=t
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,22 +31,26 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   :=
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=user
     ]
     Field=screen-name
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
 Orderby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.16.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.16.ast
index d79d874..0f0d61c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.16.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.16.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=uid ]
+    Variable [ Name=$uid ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall TinySocial.count@1[
-      Variable [ Name=t ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=t
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,22 +31,26 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   :=
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=user
     ]
     Field=screen-name
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
 Orderby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast
index 3f22cd6..95168d3 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=uid ]
+    Variable [ Name=$uid ]
   )
   (
     LiteralExpr [STRING] [count]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
 ]
 ]
@@ -18,30 +18,45 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   :=
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=user
     ]
     Field=screen-name
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   FunctionCall TinySocial.count@1[
-    Variable [ Name=t ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=t
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
   ASC
-  Variable [ Name=uid ]
+  Variable [ Name=$uid ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.18.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.18.ast
index 04c2dfa..6882190 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.18.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.18.ast
@@ -7,7 +7,7 @@
   (
     LiteralExpr [STRING] [tweet]
     :
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
   )
   (
     LiteralExpr [STRING] [similar-tweets]
@@ -15,7 +15,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=referred-topics
       ]
       ]
@@ -23,37 +23,37 @@
           LiteralExpr [STRING] [TweetMessages]
         ]
         AS
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=referred-topics
             ]
             ~=
             FieldAccessor [
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
               Field=referred-topics
             ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=t2 ]
+              Variable [ Name=$t2 ]
               Field=tweetid
             ]
             !=
             FieldAccessor [
-              Variable [ Name=t ]
+              Variable [ Name=$t ]
               Field=tweetid
             ]
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=tweetid
         ]
         ASC
@@ -66,11 +66,11 @@
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.20.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.20.ast
index aab796b..ee10149 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.20.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.20.ast
@@ -1,17 +1,17 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=t ]
+Variable [ Name=$t ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=tweetid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.22.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.22.ast
index f106f19..84f59cd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.22.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.22.ast
@@ -4,18 +4,18 @@
 FunctionCall TinySocial.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [TweetMessages]
       ]
       AS
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=tweetid
         ]
         =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.24.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.24.ast
index ee00dd5..a2c59b9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.24.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.24.ast
@@ -2,18 +2,18 @@
 Query:
 SELECT [
 FieldAccessor [
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
   Field=name
 ]
 uname
 FieldAccessor [
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
   Field=alias
 ]
 alias
 FunctionCall TinySocial.substring@2[
   FieldAccessor [
-    Variable [ Name=message ]
+    Variable [ Name=$message ]
     Field=message
   ]
   LiteralExpr [LONG] [30]
@@ -24,31 +24,31 @@
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=message ]
+  Variable [ Name=$message ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=author-id
       ]
       =
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=in-response-to
       ]
       >=
@@ -57,7 +57,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=in-response-to
       ]
       <
@@ -66,18 +66,18 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=alias
   ]
   ASC
   FunctionCall TinySocial.substring@2[
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
     LiteralExpr [LONG] [30]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.25.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.25.ast
index cf21764..05a04de 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.25.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.25.ast
@@ -6,7 +6,7 @@
     SELECT ELEMENT [
     FunctionCall TinySocial.string-length@1[
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=message
       ]
     ]
@@ -15,13 +15,13 @@
         LiteralExpr [STRING] [FacebookMessages]
       ]
       AS
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=message ]
+            Variable [ Name=$message ]
             Field=in-response-to
           ]
           >=
@@ -30,7 +30,7 @@
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=message ]
+            Variable [ Name=$message ]
             Field=in-response-to
           ]
           <
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.4.ast
index 760a841..d198d59 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.4.ast
@@ -1,18 +1,18 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.5.ast
index 2aa7368..1b17ecc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.5.ast
@@ -1,19 +1,19 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       >=
@@ -22,7 +22,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       <=
@@ -31,7 +31,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.6.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.6.ast
index ebb834b..61b959b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.6.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.6.ast
@@ -1,19 +1,19 @@
 DataverseUse TinySocial
 Query:
 SELECT ELEMENT [
-Variable [ Name=user ]
+Variable [ Name=$user ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=user-since
       ]
       >=
@@ -24,7 +24,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=user-since
       ]
       <=
@@ -35,7 +35,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.7.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.7.ast
index fc54b9d..40c8c3d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.7.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.7.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
   )
@@ -24,34 +24,34 @@
     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 [
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=author-id
     ]
     =
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=message ]
+    Variable [ Name=$message ]
     Field=message-id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.8.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.8.ast
index fc54b9d..40c8c3d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.8.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.8.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
   )
@@ -24,34 +24,34 @@
     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 [
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=author-id
     ]
     =
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=message ]
+    Variable [ Name=$message ]
     Field=message-id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.9.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.9.ast
index 4f5ba43..d592be5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.9.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.9.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -16,7 +16,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=message
       ]
       ]
@@ -24,23 +24,23 @@
           LiteralExpr [STRING] [FacebookMessages]
         ]
         AS
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=message ]
+            Variable [ Name=$message ]
             Field=author-id
           ]
           =
           FieldAccessor [
-            Variable [ Name=user ]
+            Variable [ Name=$user ]
             Field=id
           ]
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=message ]
+          Variable [ Name=$message ]
           Field=message-id
         ]
         ASC
@@ -53,11 +53,11 @@
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-gram-tokens_01/counthashed-gram-tokens_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-gram-tokens_01/counthashed-gram-tokens_01.3.ast
index f3bb967..e8e98ba 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-gram-tokens_01/counthashed-gram-tokens_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-gram-tokens_01/counthashed-gram-tokens_01.3.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [Jürgen S. Generic's Car]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.counthashed-gram-tokens@3[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-gram-tokens_02/counthashed-gram-tokens_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-gram-tokens_02/counthashed-gram-tokens_02.3.ast
index 069f959..3ea7057 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-gram-tokens_02/counthashed-gram-tokens_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-gram-tokens_02/counthashed-gram-tokens_02.3.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [Jürgen S. Generic's Car]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.counthashed-gram-tokens@3[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
     LiteralExpr [LONG] [3]
     LiteralExpr [TRUE]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-word-tokens_01/counthashed-word-tokens_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-word-tokens_01/counthashed-word-tokens_01.3.ast
index bca36f6..38c2cb2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-word-tokens_01/counthashed-word-tokens_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/counthashed-word-tokens_01/counthashed-word-tokens_01.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [Hello World, I would like to inform you of the importance of Foo Bar. Yes, Foo Bar. Jürgen.]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.counthashed-word-tokens@1[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/gram-tokens_01/gram-tokens_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/gram-tokens_01/gram-tokens_01.3.ast
index 28db2a4..1f6fff0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/gram-tokens_01/gram-tokens_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/gram-tokens_01/gram-tokens_01.3.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [Jürgen S. Generic's Car]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.gram-tokens@3[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/gram-tokens_02/gram-tokens_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/gram-tokens_02/gram-tokens_02.3.ast
index 09febc7..3e3cf03 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/gram-tokens_02/gram-tokens_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/gram-tokens_02/gram-tokens_02.3.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [Jürgen S. Generic's Car]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.gram-tokens@3[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
     LiteralExpr [LONG] [3]
     LiteralExpr [TRUE]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-gram-tokens_01/hashed-gram-tokens_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-gram-tokens_01/hashed-gram-tokens_01.3.ast
index ff45c5b..adf1b62 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-gram-tokens_01/hashed-gram-tokens_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-gram-tokens_01/hashed-gram-tokens_01.3.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [Jürgen S. Generic's Car]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.hashed-gram-tokens@3[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
     LiteralExpr [LONG] [3]
     LiteralExpr [FALSE]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-gram-tokens_02/hashed-gram-tokens_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-gram-tokens_02/hashed-gram-tokens_02.3.ast
index 89a551b..f31621f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-gram-tokens_02/hashed-gram-tokens_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-gram-tokens_02/hashed-gram-tokens_02.3.ast
@@ -1,20 +1,20 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [Jürgen S. Generic's Car]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.hashed-gram-tokens@3[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
     LiteralExpr [LONG] [3]
     LiteralExpr [TRUE]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-word-tokens_01/hashed-word-tokens_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-word-tokens_01/hashed-word-tokens_01.3.ast
index d304f15..0308da3 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-word-tokens_01/hashed-word-tokens_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/hashed-word-tokens_01/hashed-word-tokens_01.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Set import-private-functions=true
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [Hello World, I would like to inform you of the importance of Foo Bar. Yes, Foo Bar. Jürgen.]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.hashed-word-tokens@1[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/word-tokens_01/word-tokens_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/word-tokens_01/word-tokens_01.3.ast
index 778567b..98d2f14 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/word-tokens_01/word-tokens_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/word-tokens_01/word-tokens_01.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [Hello World, I would like to inform you of the importance of Foo Bar. Yes, Foo Bar. Jürgen.]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.word-tokens@1[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/word-tokens_02/word-tokens_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/word-tokens_02/word-tokens_02.3.ast
index f9ee71a..a81280f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/word-tokens_02/word-tokens_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tokenizers/word-tokens_02/word-tokens_02.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
-LetVariable [ Name=txt ]
+Let Variable [ Name=$txt ]
   :=
   LiteralExpr [STRING] [ΩΣ]
-LetVariable [ Name=tokens ]
+Let Variable [ Name=$tokens ]
   :=
   FunctionCall test.word-tokens@1[
-    Variable [ Name=txt ]
+    Variable [ Name=$txt ]
   ]
 SELECT ELEMENT [
-Variable [ Name=token ]
+Variable [ Name=$token ]
 ]
-FROM [  Variable [ Name=tokens ]
+FROM [  Variable [ Name=$tokens ]
   AS
-  Variable [ Name=token ]
+  Variable [ Name=$token ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
index 40474c7..cafd221 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [sum_qty]
@@ -20,13 +20,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -38,13 +38,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -57,7 +57,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -65,15 +65,15 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -86,7 +86,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -94,7 +94,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -103,15 +103,15 @@
             LiteralExpr [LONG] [1]
             +
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_tax
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -123,13 +123,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -141,13 +141,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -159,13 +159,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -174,7 +174,18 @@
     LiteralExpr [STRING] [count_order]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=l ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -183,36 +194,40 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipdate
     ]
     <=
     LiteralExpr [STRING] [1998-09-02]
   ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
index 52df01f..bcdbaa0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
@@ -7,7 +7,7 @@
         LiteralExpr [STRING] [s_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_acctbal
         ]
       )
@@ -15,7 +15,7 @@
         LiteralExpr [STRING] [s_name]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_name
         ]
       )
@@ -23,7 +23,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=n_name
         ]
       )
@@ -31,7 +31,7 @@
         LiteralExpr [STRING] [p_partkey]
         :
         FieldAccessor [
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
           Field=p_partkey
         ]
       )
@@ -39,7 +39,7 @@
         LiteralExpr [STRING] [ps_supplycost]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=ps_supplycost
         ]
       )
@@ -47,7 +47,7 @@
         LiteralExpr [STRING] [p_mfgr]
         :
         FieldAccessor [
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
           Field=p_mfgr
         ]
       )
@@ -55,7 +55,7 @@
         LiteralExpr [STRING] [s_address]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_address
         ]
       )
@@ -63,7 +63,7 @@
         LiteralExpr [STRING] [s_phone]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_phone
         ]
       )
@@ -71,15 +71,15 @@
         LiteralExpr [STRING] [s_comment]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_comment
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=Part ]
+    FROM [      Variable [ Name=$Part ]
       AS
-      Variable [ Name=p ]
+      Variable [ Name=$p ]
 ,
       (
         SELECT ELEMENT [
@@ -88,7 +88,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=n_name
             ]
           )
@@ -96,7 +96,7 @@
             LiteralExpr [STRING] [p_partkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_partkey
             ]
           )
@@ -104,7 +104,7 @@
             LiteralExpr [STRING] [ps_supplycost]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_supplycost
             ]
           )
@@ -112,7 +112,7 @@
             LiteralExpr [STRING] [s_name]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_name
             ]
           )
@@ -120,7 +120,7 @@
             LiteralExpr [STRING] [s_acctbal]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_acctbal
             ]
           )
@@ -128,7 +128,7 @@
             LiteralExpr [STRING] [s_address]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_address
             ]
           )
@@ -136,7 +136,7 @@
             LiteralExpr [STRING] [s_phone]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_phone
             ]
           )
@@ -144,15 +144,15 @@
             LiteralExpr [STRING] [s_comment]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_comment
             ]
           )
         ]
         ]
-        FROM [          Variable [ Name=Partsupp ]
+        FROM [          Variable [ Name=$Partsupp ]
           AS
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
 ,
           (
             SELECT ELEMENT [
@@ -161,7 +161,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -169,7 +169,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=rn ]
+                  Variable [ Name=$rn ]
                   Field=n_name
                 ]
               )
@@ -177,7 +177,7 @@
                 LiteralExpr [STRING] [s_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_name
                 ]
               )
@@ -185,7 +185,7 @@
                 LiteralExpr [STRING] [s_acctbal]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_acctbal
                 ]
               )
@@ -193,7 +193,7 @@
                 LiteralExpr [STRING] [s_address]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_address
                 ]
               )
@@ -201,7 +201,7 @@
                 LiteralExpr [STRING] [s_phone]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_phone
                 ]
               )
@@ -209,15 +209,15 @@
                 LiteralExpr [STRING] [s_comment]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_comment
                 ]
               )
             ]
             ]
-            FROM [              Variable [ Name=Supplier ]
+            FROM [              Variable [ Name=$Supplier ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
 ,
               (
                 SELECT ELEMENT [
@@ -226,7 +226,7 @@
                     LiteralExpr [STRING] [n_nationkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_nationkey
                     ]
                   )
@@ -234,37 +234,37 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_name
                     ]
                   )
                 ]
                 ]
-                FROM [                  Variable [ Name=Region ]
+                FROM [                  Variable [ Name=$Region ]
                   AS
-                  Variable [ Name=r ]
+                  Variable [ Name=$r ]
 ,
-                  Variable [ Name=Nation ]
+                  Variable [ Name=$Nation ]
                   AS
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
                 ]
                 Where
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=n ]
+                        Variable [ Name=$n ]
                         Field=n_regionkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_regionkey
                       ]
                     ]
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_name
                       ]
                       =
@@ -273,57 +273,57 @@
                   ]
               )
               AS
-              Variable [ Name=rn ]
+              Variable [ Name=$rn ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=rn ]
+                  Variable [ Name=$rn ]
                   Field=n_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=srn ]
+          Variable [ Name=$srn ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=pssrn ]
+      Variable [ Name=$pssrn ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=pssrn ]
+            Variable [ Name=$pssrn ]
             Field=p_partkey
           ]
         ]
         and
         FunctionCall tpch.like@2[
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_type
           ]
           LiteralExpr [STRING] [%BRASS]
@@ -339,7 +339,7 @@
       (
         LiteralExpr [STRING] [p_partkey]
         :
-        Variable [ Name=p_partkey ]
+        Variable [ Name=$p_partkey ]
       )
       (
         LiteralExpr [STRING] [ps_min_supplycost]
@@ -348,22 +348,22 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=ps_supplycost
             ]
             ]
-            FROM [              Variable [ Name=pssrn ]
+            FROM [              Variable [ Name=$pssrn ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=Part ]
+    FROM [      Variable [ Name=$Part ]
       AS
-      Variable [ Name=p ]
+      Variable [ Name=$p ]
 ,
       (
         SELECT ELEMENT [
@@ -372,7 +372,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=n_name
             ]
           )
@@ -380,7 +380,7 @@
             LiteralExpr [STRING] [p_partkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_partkey
             ]
           )
@@ -388,7 +388,7 @@
             LiteralExpr [STRING] [ps_supplycost]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_supplycost
             ]
           )
@@ -396,7 +396,7 @@
             LiteralExpr [STRING] [s_name]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_name
             ]
           )
@@ -404,7 +404,7 @@
             LiteralExpr [STRING] [s_acctbal]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_acctbal
             ]
           )
@@ -412,7 +412,7 @@
             LiteralExpr [STRING] [s_address]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_address
             ]
           )
@@ -420,7 +420,7 @@
             LiteralExpr [STRING] [s_phone]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_phone
             ]
           )
@@ -428,15 +428,15 @@
             LiteralExpr [STRING] [s_comment]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_comment
             ]
           )
         ]
         ]
-        FROM [          Variable [ Name=Partsupp ]
+        FROM [          Variable [ Name=$Partsupp ]
           AS
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
 ,
           (
             SELECT ELEMENT [
@@ -445,7 +445,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -453,7 +453,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=rn ]
+                  Variable [ Name=$rn ]
                   Field=n_name
                 ]
               )
@@ -461,7 +461,7 @@
                 LiteralExpr [STRING] [s_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_name
                 ]
               )
@@ -469,7 +469,7 @@
                 LiteralExpr [STRING] [s_acctbal]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_acctbal
                 ]
               )
@@ -477,7 +477,7 @@
                 LiteralExpr [STRING] [s_address]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_address
                 ]
               )
@@ -485,7 +485,7 @@
                 LiteralExpr [STRING] [s_phone]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_phone
                 ]
               )
@@ -493,15 +493,15 @@
                 LiteralExpr [STRING] [s_comment]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_comment
                 ]
               )
             ]
             ]
-            FROM [              Variable [ Name=Supplier ]
+            FROM [              Variable [ Name=$Supplier ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
 ,
               (
                 SELECT ELEMENT [
@@ -510,7 +510,7 @@
                     LiteralExpr [STRING] [n_nationkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_nationkey
                     ]
                   )
@@ -518,37 +518,37 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_name
                     ]
                   )
                 ]
                 ]
-                FROM [                  Variable [ Name=Region ]
+                FROM [                  Variable [ Name=$Region ]
                   AS
-                  Variable [ Name=r ]
+                  Variable [ Name=$r ]
 ,
-                  Variable [ Name=Nation ]
+                  Variable [ Name=$Nation ]
                   AS
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
                 ]
                 Where
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=n ]
+                        Variable [ Name=$n ]
                         Field=n_regionkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_regionkey
                       ]
                     ]
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_name
                       ]
                       =
@@ -557,67 +557,67 @@
                   ]
               )
               AS
-              Variable [ Name=rn ]
+              Variable [ Name=$rn ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=rn ]
+                  Variable [ Name=$rn ]
                   Field=n_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=srn ]
+          Variable [ Name=$srn ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=pssrn ]
+      Variable [ Name=$pssrn ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=pssrn ]
+            Variable [ Name=$pssrn ]
             Field=p_partkey
           ]
         ]
         and
         FunctionCall tpch.like@2[
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_type
           ]
           LiteralExpr [STRING] [%BRASS]
         ]
       ]
     Groupby
-      Variable [ Name=p_partkey ]
+      Variable [ Name=$p_partkey ]
       :=
       FieldAccessor [
-        Variable [ Name=pssrn ]
+        Variable [ Name=$pssrn ]
         Field=p_partkey
       ]
 
@@ -631,7 +631,7 @@
     LiteralExpr [STRING] [s_acctbal]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_acctbal
     ]
   )
@@ -639,7 +639,7 @@
     LiteralExpr [STRING] [s_name]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_name
     ]
   )
@@ -647,7 +647,7 @@
     LiteralExpr [STRING] [n_name]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=n_name
     ]
   )
@@ -655,7 +655,7 @@
     LiteralExpr [STRING] [p_partkey]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=p_partkey
     ]
   )
@@ -663,7 +663,7 @@
     LiteralExpr [STRING] [p_mfgr]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=p_mfgr
     ]
   )
@@ -671,7 +671,7 @@
     LiteralExpr [STRING] [s_address]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_address
     ]
   )
@@ -679,7 +679,7 @@
     LiteralExpr [STRING] [s_phone]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_phone
     ]
   )
@@ -687,7 +687,7 @@
     LiteralExpr [STRING] [s_comment]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_comment
     ]
   )
@@ -696,57 +696,57 @@
 FROM [  FunctionCall tpch.tmp2@0[
   ]
   AS
-  Variable [ Name=t2 ]
+  Variable [ Name=$t2 ]
 ,
   FunctionCall tpch.tmp1@0[
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=p_partkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=p_partkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=ps_supplycost
       ]
       =
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=ps_min_supplycost
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=s_acctbal
   ]
   DESC
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=n_name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=s_name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=p_partkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
index 8193892..5bb4ef8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
@@ -5,22 +5,22 @@
   (
     LiteralExpr [STRING] [l_orderkey]
     :
-    Variable [ Name=l_orderkey ]
+    Variable [ Name=$l_orderkey ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
   (
     LiteralExpr [STRING] [o_orderdate]
     :
-    Variable [ Name=o_orderdate ]
+    Variable [ Name=$o_orderdate ]
   )
   (
     LiteralExpr [STRING] [o_shippriority]
     :
-    Variable [ Name=o_shippriority ]
+    Variable [ Name=$o_shippriority ]
   )
 ]
 ]
@@ -28,26 +28,26 @@
     LiteralExpr [STRING] [Customer]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_mktsegment
         ]
         =
@@ -56,12 +56,12 @@
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_custkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_custkey
         ]
       ]
@@ -70,19 +70,19 @@
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_orderkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderkey
         ]
       ]
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderdate
         ]
         <
@@ -91,7 +91,7 @@
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_shipdate
         ]
         >
@@ -100,37 +100,43 @@
     ]
   ]
 Groupby
-  Variable [ Name=l_orderkey ]
+  Variable [ Name=$l_orderkey ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_orderkey
   ]
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderdate
   ]
-  Variable [ Name=o_shippriority ]
+  Variable [ Name=$o_shippriority ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_shippriority
   ]
-  With
-  Variable [ Name=c ]
-  Variable [ Name=l ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  Variable [ Name=$o ]
+   AS o
+  Variable [ Name=$c ]
+   AS c
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -138,22 +144,22 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=l ]
+      FROM [        Variable [ Name=$l ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   ASC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.ast
index 4dc7445..bf4a408 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.ast
@@ -7,25 +7,25 @@
         LiteralExpr [STRING] [o_orderkey]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_orderkey
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=LineItem ]
+    FROM [      Variable [ Name=$LineItem ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_commitdate
         ]
         <
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_receiptdate
         ]
       ]
@@ -38,13 +38,24 @@
   (
     LiteralExpr [STRING] [order_priority]
     :
-    Variable [ Name=o_orderpriority ]
+    Variable [ Name=$o_orderpriority ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=o ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=o
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -53,30 +64,30 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   FunctionCall tpch.tmp@0[
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=o_orderkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderdate
       ]
       >=
@@ -85,7 +96,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderdate
       ]
       <
@@ -93,17 +104,22 @@
     ]
   ]
 Groupby
-  Variable [ Name=o_orderpriority ]
+  Variable [ Name=$o_orderpriority ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderpriority
   ]
-  With
-  Variable [ Name=t ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  Variable [ Name=$o ]
+   AS o
+  )
 
 Orderby
-  Variable [ Name=o_orderpriority ]
+  Variable [ Name=$o_orderpriority ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
index 2b505fb..92d992a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [n_name]
     :
-    Variable [ Name=n_name ]
+    Variable [ Name=$n_name ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
 ]
 ]
@@ -18,7 +18,7 @@
     LiteralExpr [STRING] [Customer]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   (
     SELECT ELEMENT [
@@ -27,7 +27,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=n_name
         ]
       )
@@ -35,7 +35,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_extendedprice
         ]
       )
@@ -43,7 +43,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_discount
         ]
       )
@@ -51,7 +51,7 @@
         LiteralExpr [STRING] [s_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=s_nationkey
         ]
       )
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [o_custkey]
         :
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_custkey
         ]
       )
@@ -69,7 +69,7 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
 ,
       (
         SELECT ELEMENT [
@@ -78,7 +78,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=n_name
             ]
           )
@@ -86,7 +86,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_extendedprice
             ]
           )
@@ -94,7 +94,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_discount
             ]
           )
@@ -102,7 +102,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_orderkey
             ]
           )
@@ -110,7 +110,7 @@
             LiteralExpr [STRING] [s_nationkey]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=s_nationkey
             ]
           )
@@ -120,7 +120,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
 ,
           (
             SELECT ELEMENT [
@@ -129,7 +129,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=n1 ]
+                  Variable [ Name=$n1 ]
                   Field=n_name
                 ]
               )
@@ -137,7 +137,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -145,7 +145,7 @@
                 LiteralExpr [STRING] [s_nationkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
               )
@@ -155,7 +155,7 @@
                 LiteralExpr [STRING] [Supplier]
               ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
 ,
               (
                 SELECT ELEMENT [
@@ -164,7 +164,7 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_name
                     ]
                   )
@@ -172,7 +172,7 @@
                     LiteralExpr [STRING] [n_nationkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_nationkey
                     ]
                   )
@@ -182,79 +182,79 @@
                     LiteralExpr [STRING] [Nation]
                   ]
                   AS
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
 ,
                   FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [Region]
                   ]
                   AS
-                  Variable [ Name=r ]
+                  Variable [ Name=$r ]
                 ]
                 Where
                   OperatorExpr [
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_regionkey
                     ]
                     =
                     FieldAccessor [
-                      Variable [ Name=r ]
+                      Variable [ Name=$r ]
                       Field=r_regionkey
                     ]
                   ]
               )
               AS
-              Variable [ Name=n1 ]
+              Variable [ Name=$n1 ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=n1 ]
+                  Variable [ Name=$n1 ]
                   Field=n_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=s1 ]
+          Variable [ Name=$s1 ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=s_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=l1 ]
+      Variable [ Name=$l1 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l1 ]
+            Variable [ Name=$l1 ]
             Field=l_orderkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderdate
           ]
           >=
@@ -263,7 +263,7 @@
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderdate
           ]
           <
@@ -272,53 +272,58 @@
       ]
   )
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_nationkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=s_nationkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_custkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=o_custkey
       ]
     ]
   ]
 Groupby
-  Variable [ Name=n_name ]
+  Variable [ Name=$n_name ]
   :=
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=n_name
   ]
-  With
-  Variable [ Name=o1 ]
-  Variable [ Name=c ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$o1 ]
+   AS o1
+  Variable [ Name=$c ]
+   AS c
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -326,19 +331,19 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=o1 ]
+      FROM [        Variable [ Name=$o1 ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast
index f802e5e..592238f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast
@@ -9,12 +9,12 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_extendedprice
           ]
           *
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_discount
           ]
         ]
@@ -23,13 +23,13 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipdate
               ]
               >=
@@ -38,7 +38,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipdate
               ]
               <
@@ -47,7 +47,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_discount
               ]
               >=
@@ -56,7 +56,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_discount
               ]
               <=
@@ -65,7 +65,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               <
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.ast
index deed492..ac8fbda 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.ast
@@ -7,7 +7,7 @@
         LiteralExpr [STRING] [supp_nation]
         :
         FieldAccessor [
-          Variable [ Name=n1 ]
+          Variable [ Name=$n1 ]
           Field=n_name
         ]
       )
@@ -15,7 +15,7 @@
         LiteralExpr [STRING] [cust_nation]
         :
         FieldAccessor [
-          Variable [ Name=n2 ]
+          Variable [ Name=$n2 ]
           Field=n_name
         ]
       )
@@ -23,7 +23,7 @@
         LiteralExpr [STRING] [s_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=n1 ]
+          Variable [ Name=$n1 ]
           Field=n_nationkey
         ]
       )
@@ -31,25 +31,25 @@
         LiteralExpr [STRING] [c_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=n2 ]
+          Variable [ Name=$n2 ]
           Field=n_nationkey
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=Nation ]
+    FROM [      Variable [ Name=$Nation ]
       AS
-      Variable [ Name=n1 ]
+      Variable [ Name=$n1 ]
 ,
-      Variable [ Name=Nation ]
+      Variable [ Name=$Nation ]
       AS
-      Variable [ Name=n2 ]
+      Variable [ Name=$n2 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=n2 ]
+            Variable [ Name=$n2 ]
             Field=n_name
           ]
           =
@@ -58,7 +58,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=n1 ]
+            Variable [ Name=$n1 ]
             Field=n_name
           ]
           =
@@ -74,22 +74,22 @@
   (
     LiteralExpr [STRING] [supp_nation]
     :
-    Variable [ Name=supp_nation ]
+    Variable [ Name=$supp_nation ]
   )
   (
     LiteralExpr [STRING] [cust_nation]
     :
-    Variable [ Name=cust_nation ]
+    Variable [ Name=$cust_nation ]
   )
   (
     LiteralExpr [STRING] [l_year]
     :
-    Variable [ Name=l_year ]
+    Variable [ Name=$l_year ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
 ]
 ]
@@ -100,7 +100,7 @@
         LiteralExpr [STRING] [l_shipdate]
         :
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=l_shipdate
         ]
       )
@@ -108,7 +108,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=l_extendedprice
         ]
       )
@@ -116,7 +116,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=l_discount
         ]
       )
@@ -124,7 +124,7 @@
         LiteralExpr [STRING] [c_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=c_nationkey
         ]
       )
@@ -132,7 +132,7 @@
         LiteralExpr [STRING] [s_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_nationkey
         ]
       )
@@ -145,7 +145,7 @@
             LiteralExpr [STRING] [l_shipdate]
             :
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=l_shipdate
             ]
           )
@@ -153,7 +153,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=l_extendedprice
             ]
           )
@@ -161,7 +161,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=l_discount
             ]
           )
@@ -169,7 +169,7 @@
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=l_suppkey
             ]
           )
@@ -177,7 +177,7 @@
             LiteralExpr [STRING] [c_nationkey]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_nationkey
             ]
           )
@@ -190,7 +190,7 @@
                 LiteralExpr [STRING] [l_shipdate]
                 :
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_shipdate
                 ]
               )
@@ -198,7 +198,7 @@
                 LiteralExpr [STRING] [l_extendedprice]
                 :
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_extendedprice
                 ]
               )
@@ -206,7 +206,7 @@
                 LiteralExpr [STRING] [l_discount]
                 :
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_discount
                 ]
               )
@@ -214,7 +214,7 @@
                 LiteralExpr [STRING] [l_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_suppkey
                 ]
               )
@@ -222,7 +222,7 @@
                 LiteralExpr [STRING] [o_custkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_custkey
                 ]
               )
@@ -232,31 +232,31 @@
                 LiteralExpr [STRING] [LineItem]
               ]
               AS
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
 ,
               FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Orders]
               ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
             ]
             Where
               OperatorExpr [
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=o ]
+                    Variable [ Name=$o ]
                     Field=o_orderkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l ]
+                    Variable [ Name=$l ]
                     Field=l_orderkey
                   ]
                 ]
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=l ]
+                    Variable [ Name=$l ]
                     Field=l_shipdate
                   ]
                   >=
@@ -265,7 +265,7 @@
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=l ]
+                    Variable [ Name=$l ]
                     Field=l_shipdate
                   ]
                   <=
@@ -274,62 +274,62 @@
               ]
           )
           AS
-          Variable [ Name=lo ]
+          Variable [ Name=$lo ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Customer]
           ]
           AS
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_custkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=o_custkey
             ]
           ]
       )
       AS
-      Variable [ Name=loc ]
+      Variable [ Name=$loc ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Supplier]
       ]
       AS
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_suppkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=l_suppkey
         ]
       ]
   )
   AS
-  Variable [ Name=locs ]
+  Variable [ Name=$locs ]
 ,
   FunctionCall tpch.q7_volume_shipping_tmp@0[
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
-LetVariable [ Name=l_year0 ]
+Let Variable [ Name=$l_year0 ]
   :=
   FunctionCall tpch.get-year@1[
     FieldAccessor [
-      Variable [ Name=locs ]
+      Variable [ Name=$locs ]
       Field=l_shipdate
     ]
   ]
@@ -337,57 +337,63 @@
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=locs ]
+        Variable [ Name=$locs ]
         Field=c_nationkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=c_nationkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=locs ]
+        Variable [ Name=$locs ]
         Field=s_nationkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=s_nationkey
       ]
     ]
   ]
 Groupby
-  Variable [ Name=supp_nation ]
+  Variable [ Name=$supp_nation ]
   :=
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=supp_nation
   ]
-  Variable [ Name=cust_nation ]
+  Variable [ Name=$cust_nation ]
   :=
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=cust_nation
   ]
-  Variable [ Name=l_year ]
+  Variable [ Name=$l_year ]
   :=
-  Variable [ Name=l_year0 ]
-  With
-  Variable [ Name=l_year0 ]
-  Variable [ Name=locs ]
-  Variable [ Name=t ]
+  Variable [ Name=$l_year0 ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l_year0 ]
+   AS l_year0
+  Variable [ Name=$t ]
+   AS t
+  Variable [ Name=$locs ]
+   AS locs
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -395,23 +401,23 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=locs ]
+      FROM [        Variable [ Name=$locs ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=supp_nation ]
+  Variable [ Name=$supp_nation ]
   ASC
-  Variable [ Name=cust_nation ]
+  Variable [ Name=$cust_nation ]
   ASC
-  Variable [ Name=l_year ]
+  Variable [ Name=$l_year ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.ast
index f6dbd18..eca3549 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [year]
     :
-    Variable [ Name=year ]
+    Variable [ Name=$year ]
   )
   (
     LiteralExpr [STRING] [mkt_share]
@@ -17,7 +17,7 @@
           FunctionCall tpch.switch-case@5[
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=s_name
               ]
               =
@@ -25,16 +25,16 @@
             ]
             LiteralExpr [TRUE]
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=revenue
             ]
             LiteralExpr [FALSE]
             LiteralExpr [DOUBLE] [0.0]
           ]
           ]
-          FROM [            Variable [ Name=t ]
+          FROM [            Variable [ Name=$t ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -43,13 +43,13 @@
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=revenue
           ]
           ]
-          FROM [            Variable [ Name=t ]
+          FROM [            Variable [ Name=$t ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -63,14 +63,14 @@
       (
         LiteralExpr [STRING] [year]
         :
-        Variable [ Name=o_year ]
+        Variable [ Name=$o_year ]
       )
       (
         LiteralExpr [STRING] [revenue]
         :
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=slnrcop ]
+            Variable [ Name=$slnrcop ]
             Field=l_extendedprice
           ]
           *
@@ -78,7 +78,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=slnrcop ]
+              Variable [ Name=$slnrcop ]
               Field=l_discount
             ]
           ]
@@ -88,7 +88,7 @@
         LiteralExpr [STRING] [s_name]
         :
         FieldAccessor [
-          Variable [ Name=n2 ]
+          Variable [ Name=$n2 ]
           Field=n_name
         ]
       )
@@ -101,7 +101,7 @@
             LiteralExpr [STRING] [o_orderdate]
             :
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=o_orderdate
             ]
           )
@@ -109,7 +109,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=l_discount
             ]
           )
@@ -117,7 +117,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=l_extendedprice
             ]
           )
@@ -125,7 +125,7 @@
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=l_suppkey
             ]
           )
@@ -133,7 +133,7 @@
             LiteralExpr [STRING] [s_nationkey]
             :
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_nationkey
             ]
           )
@@ -143,7 +143,7 @@
             LiteralExpr [STRING] [Supplier]
           ]
           AS
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
 ,
           (
             SELECT ELEMENT [
@@ -152,7 +152,7 @@
                 LiteralExpr [STRING] [o_orderdate]
                 :
                 FieldAccessor [
-                  Variable [ Name=lnrco ]
+                  Variable [ Name=$lnrco ]
                   Field=o_orderdate
                 ]
               )
@@ -160,7 +160,7 @@
                 LiteralExpr [STRING] [l_discount]
                 :
                 FieldAccessor [
-                  Variable [ Name=lnrco ]
+                  Variable [ Name=$lnrco ]
                   Field=l_discount
                 ]
               )
@@ -168,7 +168,7 @@
                 LiteralExpr [STRING] [l_extendedprice]
                 :
                 FieldAccessor [
-                  Variable [ Name=lnrco ]
+                  Variable [ Name=$lnrco ]
                   Field=l_extendedprice
                 ]
               )
@@ -176,7 +176,7 @@
                 LiteralExpr [STRING] [l_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=lnrco ]
+                  Variable [ Name=$lnrco ]
                   Field=l_suppkey
                 ]
               )
@@ -189,7 +189,7 @@
                     LiteralExpr [STRING] [o_orderdate]
                     :
                     FieldAccessor [
-                      Variable [ Name=nrco ]
+                      Variable [ Name=$nrco ]
                       Field=o_orderdate
                     ]
                   )
@@ -197,7 +197,7 @@
                     LiteralExpr [STRING] [l_partkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_partkey
                     ]
                   )
@@ -205,7 +205,7 @@
                     LiteralExpr [STRING] [l_discount]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_discount
                     ]
                   )
@@ -213,7 +213,7 @@
                     LiteralExpr [STRING] [l_extendedprice]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_extendedprice
                     ]
                   )
@@ -221,7 +221,7 @@
                     LiteralExpr [STRING] [l_suppkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_suppkey
                     ]
                   )
@@ -231,7 +231,7 @@
                     LiteralExpr [STRING] [LineItem]
                   ]
                   AS
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
 ,
                   (
                     SELECT ELEMENT [
@@ -240,7 +240,7 @@
                         LiteralExpr [STRING] [o_orderdate]
                         :
                         FieldAccessor [
-                          Variable [ Name=o ]
+                          Variable [ Name=$o ]
                           Field=o_orderdate
                         ]
                       )
@@ -248,7 +248,7 @@
                         LiteralExpr [STRING] [o_orderkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=o ]
+                          Variable [ Name=$o ]
                           Field=o_orderkey
                         ]
                       )
@@ -258,7 +258,7 @@
                         LiteralExpr [STRING] [Orders]
                       ]
                       AS
-                      Variable [ Name=o ]
+                      Variable [ Name=$o ]
 ,
                       (
                         SELECT ELEMENT [
@@ -267,7 +267,7 @@
                             LiteralExpr [STRING] [c_custkey]
                             :
                             FieldAccessor [
-                              Variable [ Name=c ]
+                              Variable [ Name=$c ]
                               Field=c_custkey
                             ]
                           )
@@ -277,7 +277,7 @@
                             LiteralExpr [STRING] [Customer]
                           ]
                           AS
-                          Variable [ Name=c ]
+                          Variable [ Name=$c ]
 ,
                           (
                             SELECT ELEMENT [
@@ -286,7 +286,7 @@
                                 LiteralExpr [STRING] [n_nationkey]
                                 :
                                 FieldAccessor [
-                                  Variable [ Name=n1 ]
+                                  Variable [ Name=$n1 ]
                                   Field=n_nationkey
                                 ]
                               )
@@ -296,31 +296,31 @@
                                 LiteralExpr [STRING] [Nation]
                               ]
                               AS
-                              Variable [ Name=n1 ]
+                              Variable [ Name=$n1 ]
 ,
                               FunctionCall Metadata.dataset@1[
                                 LiteralExpr [STRING] [Region]
                               ]
                               AS
-                              Variable [ Name=r1 ]
+                              Variable [ Name=$r1 ]
                             ]
                             Where
                               OperatorExpr [
                                 OperatorExpr [
                                   FieldAccessor [
-                                    Variable [ Name=n1 ]
+                                    Variable [ Name=$n1 ]
                                     Field=n_regionkey
                                   ]
                                   =
                                   FieldAccessor [
-                                    Variable [ Name=r1 ]
+                                    Variable [ Name=$r1 ]
                                     Field=r_regionkey
                                   ]
                                 ]
                                 and
                                 OperatorExpr [
                                   FieldAccessor [
-                                    Variable [ Name=r1 ]
+                                    Variable [ Name=$r1 ]
                                     Field=r_name
                                   ]
                                   =
@@ -329,57 +329,57 @@
                               ]
                           )
                           AS
-                          Variable [ Name=nr ]
+                          Variable [ Name=$nr ]
                         ]
                         Where
                           OperatorExpr [
                             FieldAccessor [
-                              Variable [ Name=c ]
+                              Variable [ Name=$c ]
                               Field=c_nationkey
                             ]
                             =
                             FieldAccessor [
-                              Variable [ Name=nr ]
+                              Variable [ Name=$nr ]
                               Field=n_nationkey
                             ]
                           ]
                       )
                       AS
-                      Variable [ Name=nrc ]
+                      Variable [ Name=$nrc ]
                     ]
                     Where
                       OperatorExpr [
                         FieldAccessor [
-                          Variable [ Name=nrc ]
+                          Variable [ Name=$nrc ]
                           Field=c_custkey
                         ]
                         =
                         FieldAccessor [
-                          Variable [ Name=o ]
+                          Variable [ Name=$o ]
                           Field=o_custkey
                         ]
                       ]
                   )
                   AS
-                  Variable [ Name=nrco ]
+                  Variable [ Name=$nrco ]
                 ]
                 Where
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=l ]
+                        Variable [ Name=$l ]
                         Field=l_orderkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=nrco ]
+                        Variable [ Name=$nrco ]
                         Field=o_orderkey
                       ]
                     ]
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=nrco ]
+                        Variable [ Name=$nrco ]
                         Field=o_orderdate
                       ]
                       >=
@@ -388,7 +388,7 @@
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=nrco ]
+                        Variable [ Name=$nrco ]
                         Field=o_orderdate
                       ]
                       <
@@ -397,31 +397,31 @@
                   ]
               )
               AS
-              Variable [ Name=lnrco ]
+              Variable [ Name=$lnrco ]
 ,
               FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Part]
               ]
               AS
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
             ]
             Where
               OperatorExpr [
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=p ]
+                    Variable [ Name=$p ]
                     Field=p_partkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=lnrco ]
+                    Variable [ Name=$lnrco ]
                     Field=l_partkey
                   ]
                 ]
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=p ]
+                    Variable [ Name=$p ]
                     Field=p_type
                   ]
                   =
@@ -430,65 +430,69 @@
               ]
           )
           AS
-          Variable [ Name=lnrcop ]
+          Variable [ Name=$lnrcop ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=l_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=slnrcop ]
+      Variable [ Name=$slnrcop ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Nation]
       ]
       AS
-      Variable [ Name=n2 ]
+      Variable [ Name=$n2 ]
     ]
-    LetVariable [ Name=o_year ]
+    Let Variable [ Name=$o_year ]
       :=
       FunctionCall tpch.get-year@1[
         FieldAccessor [
-          Variable [ Name=slnrcop ]
+          Variable [ Name=$slnrcop ]
           Field=o_orderdate
         ]
       ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=slnrcop ]
+          Variable [ Name=$slnrcop ]
           Field=s_nationkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=n2 ]
+          Variable [ Name=$n2 ]
           Field=n_nationkey
         ]
       ]
   )
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=year ]
+  Variable [ Name=$year ]
   :=
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=year
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
 Orderby
-  Variable [ Name=year ]
+  Variable [ Name=$year ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
index 8052433..e455c20 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [nation]
     :
-    Variable [ Name=nation ]
+    Variable [ Name=$nation ]
   )
   (
     LiteralExpr [STRING] [o_year]
     :
-    Variable [ Name=o_year ]
+    Variable [ Name=$o_year ]
   )
   (
     LiteralExpr [STRING] [sum_profit]
@@ -19,13 +19,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=pr ]
+          Variable [ Name=$pr ]
           Field=amount
         ]
         ]
-        FROM [          Variable [ Name=profit ]
+        FROM [          Variable [ Name=$profit ]
           AS
-          Variable [ Name=pr ]
+          Variable [ Name=$pr ]
         ]
       )
     ]
@@ -39,19 +39,19 @@
         LiteralExpr [STRING] [nation]
         :
         FieldAccessor [
-          Variable [ Name=l3 ]
+          Variable [ Name=$l3 ]
           Field=n_name
         ]
       )
       (
         LiteralExpr [STRING] [o_year]
         :
-        Variable [ Name=o_year ]
+        Variable [ Name=$o_year ]
       )
       (
         LiteralExpr [STRING] [amount]
         :
-        Variable [ Name=amount ]
+        Variable [ Name=$amount ]
       )
     ]
     ]
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
 ,
       (
         SELECT ELEMENT [
@@ -68,7 +68,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_extendedprice
             ]
           )
@@ -76,7 +76,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_discount
             ]
           )
@@ -84,7 +84,7 @@
             LiteralExpr [STRING] [l_quantity]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_quantity
             ]
           )
@@ -92,7 +92,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_orderkey
             ]
           )
@@ -100,7 +100,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=n_name
             ]
           )
@@ -108,7 +108,7 @@
             LiteralExpr [STRING] [ps_supplycost]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=ps_supplycost
             ]
           )
@@ -118,7 +118,7 @@
             LiteralExpr [STRING] [Part]
           ]
           AS
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
 ,
           (
             SELECT ELEMENT [
@@ -127,7 +127,7 @@
                 LiteralExpr [STRING] [l_extendedprice]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_extendedprice
                 ]
               )
@@ -135,7 +135,7 @@
                 LiteralExpr [STRING] [l_discount]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_discount
                 ]
               )
@@ -143,7 +143,7 @@
                 LiteralExpr [STRING] [l_quantity]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_quantity
                 ]
               )
@@ -151,7 +151,7 @@
                 LiteralExpr [STRING] [l_partkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_partkey
                 ]
               )
@@ -159,7 +159,7 @@
                 LiteralExpr [STRING] [l_orderkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_orderkey
                 ]
               )
@@ -167,7 +167,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=n_name
                 ]
               )
@@ -175,7 +175,7 @@
                 LiteralExpr [STRING] [ps_supplycost]
                 :
                 FieldAccessor [
-                  Variable [ Name=ps ]
+                  Variable [ Name=$ps ]
                   Field=ps_supplycost
                 ]
               )
@@ -185,7 +185,7 @@
                 LiteralExpr [STRING] [Partsupp]
               ]
               AS
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
 ,
               (
                 SELECT ELEMENT [
@@ -194,7 +194,7 @@
                     LiteralExpr [STRING] [l_suppkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_suppkey
                     ]
                   )
@@ -202,7 +202,7 @@
                     LiteralExpr [STRING] [l_extendedprice]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_extendedprice
                     ]
                   )
@@ -210,7 +210,7 @@
                     LiteralExpr [STRING] [l_discount]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_discount
                     ]
                   )
@@ -218,7 +218,7 @@
                     LiteralExpr [STRING] [l_quantity]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_quantity
                     ]
                   )
@@ -226,7 +226,7 @@
                     LiteralExpr [STRING] [l_partkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_partkey
                     ]
                   )
@@ -234,7 +234,7 @@
                     LiteralExpr [STRING] [l_orderkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_orderkey
                     ]
                   )
@@ -242,7 +242,7 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=s1 ]
+                      Variable [ Name=$s1 ]
                       Field=n_name
                     ]
                   )
@@ -255,7 +255,7 @@
                         LiteralExpr [STRING] [s_suppkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=s ]
+                          Variable [ Name=$s ]
                           Field=s_suppkey
                         ]
                       )
@@ -263,7 +263,7 @@
                         LiteralExpr [STRING] [n_name]
                         :
                         FieldAccessor [
-                          Variable [ Name=n ]
+                          Variable [ Name=$n ]
                           Field=n_name
                         ]
                       )
@@ -273,87 +273,87 @@
                         LiteralExpr [STRING] [Supplier]
                       ]
                       AS
-                      Variable [ Name=s ]
+                      Variable [ Name=$s ]
 ,
                       FunctionCall Metadata.dataset@1[
                         LiteralExpr [STRING] [Nation]
                       ]
                       AS
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                     ]
                     Where
                       OperatorExpr [
                         FieldAccessor [
-                          Variable [ Name=n ]
+                          Variable [ Name=$n ]
                           Field=n_nationkey
                         ]
                         =
                         FieldAccessor [
-                          Variable [ Name=s ]
+                          Variable [ Name=$s ]
                           Field=s_nationkey
                         ]
                       ]
                   )
                   AS
-                  Variable [ Name=s1 ]
+                  Variable [ Name=$s1 ]
 ,
                   FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [LineItem]
                   ]
                   AS
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                 ]
                 Where
                   OperatorExpr [
                     FieldAccessor [
-                      Variable [ Name=s1 ]
+                      Variable [ Name=$s1 ]
                       Field=s_suppkey
                     ]
                     =
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_suppkey
                     ]
                   ]
               )
               AS
-              Variable [ Name=l1 ]
+              Variable [ Name=$l1 ]
             ]
             Where
               OperatorExpr [
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=ps ]
+                    Variable [ Name=$ps ]
                     Field=ps_suppkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_suppkey
                   ]
                 ]
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=ps ]
+                    Variable [ Name=$ps ]
                     Field=ps_partkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_partkey
                   ]
                 ]
               ]
           )
           AS
-          Variable [ Name=l2 ]
+          Variable [ Name=$l2 ]
         ]
         Where
           OperatorExpr [
             FunctionCall tpch.contains@2[
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_name
               ]
               LiteralExpr [STRING] [green]
@@ -361,26 +361,26 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_partkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=l2 ]
+                Variable [ Name=$l2 ]
                 Field=l_partkey
               ]
             ]
           ]
       )
       AS
-      Variable [ Name=l3 ]
+      Variable [ Name=$l3 ]
     ]
-    LetVariable [ Name=amount ]
+    Let Variable [ Name=$amount ]
       :=
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=l_extendedprice
           ]
           *
@@ -388,7 +388,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=l3 ]
+              Variable [ Name=$l3 ]
               Field=l_discount
             ]
           ]
@@ -396,59 +396,63 @@
         -
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=ps_supplycost
           ]
           *
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=l_quantity
           ]
         ]
       ]
-    LetVariable [ Name=o_year ]
+    Let Variable [ Name=$o_year ]
       :=
       FunctionCall tpch.get-year@1[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderdate
         ]
       ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=l3 ]
+          Variable [ Name=$l3 ]
           Field=l_orderkey
         ]
       ]
   )
   AS
-  Variable [ Name=profit ]
+  Variable [ Name=$profit ]
 ]
 Groupby
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
   :=
   FieldAccessor [
-    Variable [ Name=profit ]
+    Variable [ Name=$profit ]
     Field=nation
   ]
-  Variable [ Name=o_year ]
+  Variable [ Name=$o_year ]
   :=
   FieldAccessor [
-    Variable [ Name=profit ]
+    Variable [ Name=$profit ]
     Field=o_year
   ]
-  With
-  Variable [ Name=profit ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$profit ]
+   AS profit
+  )
 
 Orderby
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
   ASC
-  Variable [ Name=o_year ]
+  Variable [ Name=$o_year ]
   DESC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.ast
index 95cef5d..ff09340 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.ast
@@ -5,42 +5,42 @@
   (
     LiteralExpr [STRING] [c_custkey]
     :
-    Variable [ Name=c_custkey ]
+    Variable [ Name=$c_custkey ]
   )
   (
     LiteralExpr [STRING] [c_name]
     :
-    Variable [ Name=c_name ]
+    Variable [ Name=$c_name ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
   (
     LiteralExpr [STRING] [c_acctbal]
     :
-    Variable [ Name=c_acctbal ]
+    Variable [ Name=$c_acctbal ]
   )
   (
     LiteralExpr [STRING] [n_name]
     :
-    Variable [ Name=n_name ]
+    Variable [ Name=$n_name ]
   )
   (
     LiteralExpr [STRING] [c_address]
     :
-    Variable [ Name=c_address ]
+    Variable [ Name=$c_address ]
   )
   (
     LiteralExpr [STRING] [c_phone]
     :
-    Variable [ Name=c_phone ]
+    Variable [ Name=$c_phone ]
   )
   (
     LiteralExpr [STRING] [c_comment]
     :
-    Variable [ Name=c_comment ]
+    Variable [ Name=$c_comment ]
   )
 ]
 ]
@@ -51,7 +51,7 @@
         LiteralExpr [STRING] [c_custkey]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_custkey
         ]
       )
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [c_name]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_name
         ]
       )
@@ -67,7 +67,7 @@
         LiteralExpr [STRING] [c_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_acctbal
         ]
       )
@@ -75,7 +75,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=n_name
         ]
       )
@@ -83,7 +83,7 @@
         LiteralExpr [STRING] [c_address]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_address
         ]
       )
@@ -91,7 +91,7 @@
         LiteralExpr [STRING] [c_phone]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_phone
         ]
       )
@@ -99,7 +99,7 @@
         LiteralExpr [STRING] [c_comment]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_comment
         ]
       )
@@ -107,7 +107,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_extendedprice
         ]
       )
@@ -115,7 +115,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_discount
         ]
       )
@@ -125,7 +125,7 @@
         LiteralExpr [STRING] [LineItem]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
 ,
       (
         SELECT ELEMENT [
@@ -134,7 +134,7 @@
             LiteralExpr [STRING] [c_custkey]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_custkey
             ]
           )
@@ -142,7 +142,7 @@
             LiteralExpr [STRING] [c_name]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_name
             ]
           )
@@ -150,7 +150,7 @@
             LiteralExpr [STRING] [c_acctbal]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_acctbal
             ]
           )
@@ -158,7 +158,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=n ]
+              Variable [ Name=$n ]
               Field=n_name
             ]
           )
@@ -166,7 +166,7 @@
             LiteralExpr [STRING] [c_address]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_address
             ]
           )
@@ -174,7 +174,7 @@
             LiteralExpr [STRING] [c_phone]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_phone
             ]
           )
@@ -182,7 +182,7 @@
             LiteralExpr [STRING] [c_comment]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_comment
             ]
           )
@@ -190,7 +190,7 @@
             LiteralExpr [STRING] [o_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_orderkey
             ]
           )
@@ -200,38 +200,38 @@
             LiteralExpr [STRING] [Orders]
           ]
           AS
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Customer]
           ]
           AS
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Nation]
           ]
           AS
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=c ]
+                  Variable [ Name=$c ]
                   Field=c_custkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_custkey
                 ]
               ]
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
                 >=
@@ -240,7 +240,7 @@
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
                 <
@@ -250,37 +250,37 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=c ]
+                Variable [ Name=$c ]
                 Field=c_nationkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=n ]
+                Variable [ Name=$n ]
                 Field=n_nationkey
               ]
             ]
           ]
       )
       AS
-      Variable [ Name=ocn ]
+      Variable [ Name=$ocn ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_orderkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=ocn ]
+            Variable [ Name=$ocn ]
             Field=o_orderkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_selectflag
           ]
           =
@@ -289,62 +289,66 @@
       ]
   )
   AS
-  Variable [ Name=locn ]
+  Variable [ Name=$locn ]
 ]
 Groupby
-  Variable [ Name=c_custkey ]
+  Variable [ Name=$c_custkey ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_custkey
   ]
-  Variable [ Name=c_name ]
+  Variable [ Name=$c_name ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_name
   ]
-  Variable [ Name=c_acctbal ]
+  Variable [ Name=$c_acctbal ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_acctbal
   ]
-  Variable [ Name=c_phone ]
+  Variable [ Name=$c_phone ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_phone
   ]
-  Variable [ Name=n_name ]
+  Variable [ Name=$n_name ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=n_name
   ]
-  Variable [ Name=c_address ]
+  Variable [ Name=$c_address ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_address
   ]
-  Variable [ Name=c_comment ]
+  Variable [ Name=$c_comment ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_comment
   ]
-  With
-  Variable [ Name=locn ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$locn ]
+   AS locn
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -352,20 +356,20 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=locn ]
+      FROM [        Variable [ Name=$locn ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.ast
index 95cef5d..ff09340 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.ast
@@ -5,42 +5,42 @@
   (
     LiteralExpr [STRING] [c_custkey]
     :
-    Variable [ Name=c_custkey ]
+    Variable [ Name=$c_custkey ]
   )
   (
     LiteralExpr [STRING] [c_name]
     :
-    Variable [ Name=c_name ]
+    Variable [ Name=$c_name ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
   (
     LiteralExpr [STRING] [c_acctbal]
     :
-    Variable [ Name=c_acctbal ]
+    Variable [ Name=$c_acctbal ]
   )
   (
     LiteralExpr [STRING] [n_name]
     :
-    Variable [ Name=n_name ]
+    Variable [ Name=$n_name ]
   )
   (
     LiteralExpr [STRING] [c_address]
     :
-    Variable [ Name=c_address ]
+    Variable [ Name=$c_address ]
   )
   (
     LiteralExpr [STRING] [c_phone]
     :
-    Variable [ Name=c_phone ]
+    Variable [ Name=$c_phone ]
   )
   (
     LiteralExpr [STRING] [c_comment]
     :
-    Variable [ Name=c_comment ]
+    Variable [ Name=$c_comment ]
   )
 ]
 ]
@@ -51,7 +51,7 @@
         LiteralExpr [STRING] [c_custkey]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_custkey
         ]
       )
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [c_name]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_name
         ]
       )
@@ -67,7 +67,7 @@
         LiteralExpr [STRING] [c_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_acctbal
         ]
       )
@@ -75,7 +75,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=n_name
         ]
       )
@@ -83,7 +83,7 @@
         LiteralExpr [STRING] [c_address]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_address
         ]
       )
@@ -91,7 +91,7 @@
         LiteralExpr [STRING] [c_phone]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_phone
         ]
       )
@@ -99,7 +99,7 @@
         LiteralExpr [STRING] [c_comment]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_comment
         ]
       )
@@ -107,7 +107,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_extendedprice
         ]
       )
@@ -115,7 +115,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_discount
         ]
       )
@@ -125,7 +125,7 @@
         LiteralExpr [STRING] [LineItem]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
 ,
       (
         SELECT ELEMENT [
@@ -134,7 +134,7 @@
             LiteralExpr [STRING] [c_custkey]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_custkey
             ]
           )
@@ -142,7 +142,7 @@
             LiteralExpr [STRING] [c_name]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_name
             ]
           )
@@ -150,7 +150,7 @@
             LiteralExpr [STRING] [c_acctbal]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_acctbal
             ]
           )
@@ -158,7 +158,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=n ]
+              Variable [ Name=$n ]
               Field=n_name
             ]
           )
@@ -166,7 +166,7 @@
             LiteralExpr [STRING] [c_address]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_address
             ]
           )
@@ -174,7 +174,7 @@
             LiteralExpr [STRING] [c_phone]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_phone
             ]
           )
@@ -182,7 +182,7 @@
             LiteralExpr [STRING] [c_comment]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_comment
             ]
           )
@@ -190,7 +190,7 @@
             LiteralExpr [STRING] [o_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_orderkey
             ]
           )
@@ -200,38 +200,38 @@
             LiteralExpr [STRING] [Orders]
           ]
           AS
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Customer]
           ]
           AS
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Nation]
           ]
           AS
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=c ]
+                  Variable [ Name=$c ]
                   Field=c_custkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_custkey
                 ]
               ]
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
                 >=
@@ -240,7 +240,7 @@
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
                 <
@@ -250,37 +250,37 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=c ]
+                Variable [ Name=$c ]
                 Field=c_nationkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=n ]
+                Variable [ Name=$n ]
                 Field=n_nationkey
               ]
             ]
           ]
       )
       AS
-      Variable [ Name=ocn ]
+      Variable [ Name=$ocn ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_orderkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=ocn ]
+            Variable [ Name=$ocn ]
             Field=o_orderkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_selectflag
           ]
           =
@@ -289,62 +289,66 @@
       ]
   )
   AS
-  Variable [ Name=locn ]
+  Variable [ Name=$locn ]
 ]
 Groupby
-  Variable [ Name=c_custkey ]
+  Variable [ Name=$c_custkey ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_custkey
   ]
-  Variable [ Name=c_name ]
+  Variable [ Name=$c_name ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_name
   ]
-  Variable [ Name=c_acctbal ]
+  Variable [ Name=$c_acctbal ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_acctbal
   ]
-  Variable [ Name=c_phone ]
+  Variable [ Name=$c_phone ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_phone
   ]
-  Variable [ Name=n_name ]
+  Variable [ Name=$n_name ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=n_name
   ]
-  Variable [ Name=c_address ]
+  Variable [ Name=$c_address ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_address
   ]
-  Variable [ Name=c_comment ]
+  Variable [ Name=$c_comment ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_comment
   ]
-  With
-  Variable [ Name=locn ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$locn ]
+   AS locn
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -352,20 +356,20 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=locn ]
+      FROM [        Variable [ Name=$locn ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.ast
index 6fb853e..a3e3830 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.ast
@@ -1,18 +1,18 @@
 DataverseUse tpch
 Query:
-LetVariable [ Name=sum ]
+Let Variable [ Name=$sum ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
           Field=ps_supplycost
         ]
         *
         FieldAccessor [
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
           Field=ps_availqty
         ]
       ]
@@ -21,7 +21,7 @@
           LiteralExpr [STRING] [Partsupp]
         ]
         AS
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
 ,
         (
           SELECT ELEMENT [
@@ -30,7 +30,7 @@
               LiteralExpr [STRING] [s_suppkey]
               :
               FieldAccessor [
-                Variable [ Name=s ]
+                Variable [ Name=$s ]
                 Field=s_suppkey
               ]
             )
@@ -40,39 +40,39 @@
               LiteralExpr [STRING] [Supplier]
             ]
             AS
-            Variable [ Name=s ]
+            Variable [ Name=$s ]
 ,
             FunctionCall Metadata.dataset@1[
               LiteralExpr [STRING] [Nation]
             ]
             AS
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           Where
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=s ]
+                Variable [ Name=$s ]
                 Field=s_nationkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=n ]
+                Variable [ Name=$n ]
                 Field=n_nationkey
               ]
             ]
         )
         AS
-        Variable [ Name=sn ]
+        Variable [ Name=$sn ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_suppkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=sn ]
+            Variable [ Name=$sn ]
             Field=s_suppkey
           ]
         ]
@@ -84,7 +84,7 @@
     LiteralExpr [STRING] [partkey]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=ps_partkey
     ]
   )
@@ -92,7 +92,7 @@
     LiteralExpr [STRING] [part_value]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=part_value
     ]
   )
@@ -104,7 +104,7 @@
       (
         LiteralExpr [STRING] [ps_partkey]
         :
-        Variable [ Name=ps_partkey ]
+        Variable [ Name=$ps_partkey ]
       )
       (
         LiteralExpr [STRING] [part_value]
@@ -114,19 +114,19 @@
             SELECT ELEMENT [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=ps_supplycost
               ]
               *
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=ps_availqty
               ]
             ]
             ]
-            FROM [              Variable [ Name=ps ]
+            FROM [              Variable [ Name=$ps ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -137,7 +137,7 @@
         LiteralExpr [STRING] [Partsupp]
       ]
       AS
-      Variable [ Name=ps ]
+      Variable [ Name=$ps ]
 ,
       (
         SELECT ELEMENT [
@@ -146,7 +146,7 @@
             LiteralExpr [STRING] [s_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_suppkey
             ]
           )
@@ -156,74 +156,80 @@
             LiteralExpr [STRING] [Supplier]
           ]
           AS
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Nation]
           ]
           AS
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_nationkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=n ]
+              Variable [ Name=$n ]
               Field=n_nationkey
             ]
           ]
       )
       AS
-      Variable [ Name=sn ]
+      Variable [ Name=$sn ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
           Field=ps_suppkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=sn ]
+          Variable [ Name=$sn ]
           Field=s_suppkey
         ]
       ]
     Groupby
-      Variable [ Name=ps_partkey ]
+      Variable [ Name=$ps_partkey ]
       :=
       FieldAccessor [
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
         Field=ps_partkey
       ]
-      With
-      Variable [ Name=ps ]
-      Variable [ Name=sn ]
-      Variable [ Name=sum ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$sn ]
+       AS sn
+      Variable [ Name=$ps ]
+       AS ps
+      Variable [ Name=$sum ]
+       AS sum
+      )
 
   )
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=part_value
     ]
     >
     OperatorExpr [
-      Variable [ Name=sum ]
+      Variable [ Name=$sum ]
       *
       LiteralExpr [DOUBLE] [1.0E-5]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=part_value
   ]
   DESC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.ast
index c478139..6150bd4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [l_shipmode]
     :
-    Variable [ Name=l_shipmode ]
+    Variable [ Name=$l_shipmode ]
   )
   (
     LiteralExpr [STRING] [high_line_count]
@@ -17,7 +17,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=o_orderpriority
               ]
               =
@@ -26,7 +26,7 @@
             or
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=o_orderpriority
               ]
               =
@@ -39,9 +39,9 @@
           LiteralExpr [LONG] [0]
         ]
         ]
-        FROM [          Variable [ Name=o ]
+        FROM [          Variable [ Name=$o ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -56,7 +56,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=o_orderpriority
               ]
               =
@@ -65,7 +65,7 @@
             or
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=o_orderpriority
               ]
               =
@@ -78,9 +78,9 @@
           LiteralExpr [LONG] [1]
         ]
         ]
-        FROM [          Variable [ Name=o ]
+        FROM [          Variable [ Name=$o ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -91,55 +91,55 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_commitdate
       ]
       <
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_receiptdate
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_shipdate
       ]
       <
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_commitdate
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_receiptdate
       ]
       >=
@@ -148,7 +148,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_receiptdate
       ]
       <
@@ -158,7 +158,7 @@
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_shipmode
         ]
         =
@@ -167,7 +167,7 @@
       or
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_shipmode
         ]
         =
@@ -176,17 +176,22 @@
     ]
   ]
 Groupby
-  Variable [ Name=l_shipmode ]
+  Variable [ Name=$l_shipmode ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_shipmode
   ]
-  With
-  Variable [ Name=l ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$o ]
+   AS o
+  Variable [ Name=$l ]
+   AS l
+  )
 
 Orderby
-  Variable [ Name=l_shipmode ]
+  Variable [ Name=$l_shipmode ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
index 2b22632..040038c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [c_count]
     :
-    Variable [ Name=c_count ]
+    Variable [ Name=$c_count ]
   )
   (
     LiteralExpr [STRING] [custdist]
     :
-    Variable [ Name=custdist ]
+    Variable [ Name=$custdist ]
   )
 ]
 ]
@@ -21,7 +21,7 @@
       (
         LiteralExpr [STRING] [c_custkey]
         :
-        Variable [ Name=c_custkey ]
+        Variable [ Name=$c_custkey ]
       )
       (
         LiteralExpr [STRING] [c_count]
@@ -30,13 +30,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=o_orderkey_count
             ]
             ]
-            FROM [              Variable [ Name=co ]
+            FROM [              Variable [ Name=$co ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -50,7 +50,7 @@
             LiteralExpr [STRING] [c_custkey]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_custkey
             ]
           )
@@ -61,7 +61,7 @@
               (
                 SELECT ELEMENT [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderkey
                 ]
                 ]
@@ -69,18 +69,18 @@
                     LiteralExpr [STRING] [Orders]
                   ]
                   AS
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                 ]
                 Where
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=c ]
+                        Variable [ Name=$c ]
                         Field=c_custkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=o ]
+                        Variable [ Name=$o ]
                         Field=o_custkey
                       ]
                     ]
@@ -88,7 +88,7 @@
                     FunctionCall tpch.not@1[
                       FunctionCall tpch.like@2[
                         FieldAccessor [
-                          Variable [ Name=o ]
+                          Variable [ Name=$o ]
                           Field=o_comment
                         ]
                         LiteralExpr [STRING] [%special%requests%]
@@ -104,44 +104,63 @@
             LiteralExpr [STRING] [Customer]
           ]
           AS
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
         ]
       )
       AS
-      Variable [ Name=co ]
+      Variable [ Name=$co ]
     ]
     Groupby
-      Variable [ Name=c_custkey ]
+      Variable [ Name=$c_custkey ]
       :=
       FieldAccessor [
-        Variable [ Name=co ]
+        Variable [ Name=$co ]
         Field=c_custkey
       ]
-      With
-      Variable [ Name=co ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$co ]
+       AS co
+      )
 
   )
   AS
-  Variable [ Name=gco ]
+  Variable [ Name=$gco ]
 ]
 Groupby
-  Variable [ Name=c_count ]
+  Variable [ Name=$c_count ]
   :=
   FieldAccessor [
-    Variable [ Name=gco ]
+    Variable [ Name=$gco ]
     Field=c_count
   ]
-  With
-  Variable [ Name=gco ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$gco ]
+   AS gco
+  )
 
-LetVariable [ Name=custdist ]
+Let Variable [ Name=$custdist ]
   :=
   FunctionCall tpch.count@1[
-    Variable [ Name=gco ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#3 ]
+        Field=gco
+      ]
+      ]
+      FROM [        Variable [ Name=#2 ]
+        AS
+        Variable [ Name=#3 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=custdist ]
+  Variable [ Name=$custdist ]
   DESC
-  Variable [ Name=c_count ]
+  Variable [ Name=$c_count ]
   DESC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
index 57b4c73..86eb727 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
@@ -10,7 +10,7 @@
       FunctionCall tpch.switch-case@5[
         FunctionCall tpch.like@2[
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=p_type
           ]
           LiteralExpr [STRING] [PROMO%]
@@ -18,7 +18,7 @@
         LiteralExpr [TRUE]
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -26,7 +26,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -35,9 +35,9 @@
         LiteralExpr [DOUBLE] [0.0]
       ]
       ]
-      FROM [        Variable [ Name=l ]
+      FROM [        Variable [ Name=$lp ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
@@ -47,7 +47,7 @@
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -55,15 +55,15 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=l ]
+      FROM [        Variable [ Name=$lp ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
@@ -73,31 +73,59 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Part]
   ]
   AS
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
+Let Variable [ Name=$lp ]
+  :=
+  RecordConstructor [
+    (
+      LiteralExpr [STRING] [p_type]
+      :
+      FieldAccessor [
+        Variable [ Name=$p ]
+        Field=p_type
+      ]
+    )
+    (
+      LiteralExpr [STRING] [l_extendedprice]
+      :
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_extendedprice
+      ]
+    )
+    (
+      LiteralExpr [STRING] [l_discount]
+      :
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_discount
+      ]
+    )
+  ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_partkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=p ]
+        Variable [ Name=$p ]
         Field=p_partkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_shipdate
       ]
       >=
@@ -106,7 +134,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_shipdate
       ]
       <
@@ -114,10 +142,17 @@
     ]
   ]
 Groupby
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
   :=
   LiteralExpr [LONG] [1]
-  With
-  Variable [ Name=p ]
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$lp ]
+   AS lp
+  Variable [ Name=$p ]
+   AS p
+  Variable [ Name=$l ]
+   AS l
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.ast
index b19616d..8e0bd84 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.ast
@@ -6,7 +6,7 @@
       (
         LiteralExpr [STRING] [supplier_no]
         :
-        Variable [ Name=l_suppkey ]
+        Variable [ Name=$l_suppkey ]
       )
       (
         LiteralExpr [STRING] [total_revenue]
@@ -16,7 +16,7 @@
             SELECT ELEMENT [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=l_extendedprice
               ]
               *
@@ -24,30 +24,30 @@
                 LiteralExpr [LONG] [1]
                 -
                 FieldAccessor [
-                  Variable [ Name=i ]
+                  Variable [ Name=$i ]
                   Field=l_discount
                 ]
               ]
             ]
             ]
-            FROM [              Variable [ Name=l ]
+            FROM [              Variable [ Name=$l ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=LineItem ]
+    FROM [      Variable [ Name=$LineItem ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_shipdate
           ]
           >=
@@ -56,7 +56,7 @@
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_shipdate
           ]
           <
@@ -64,10 +64,10 @@
         ]
       ]
     Groupby
-      Variable [ Name=l_suppkey ]
+      Variable [ Name=$l_suppkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_suppkey
       ]
 
@@ -75,20 +75,20 @@
 }
 
 Query:
-LetVariable [ Name=m ]
+Let Variable [ Name=$m ]
   :=
   FunctionCall tpch.max@1[
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=r2 ]
+        Variable [ Name=$r2 ]
         Field=total_revenue
       ]
       ]
       FROM [        FunctionCall tpch.revenue@0[
         ]
         AS
-        Variable [ Name=r2 ]
+        Variable [ Name=$r2 ]
       ]
     )
   ]
@@ -98,7 +98,7 @@
     LiteralExpr [STRING] [s_suppkey]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_suppkey
     ]
   )
@@ -106,7 +106,7 @@
     LiteralExpr [STRING] [s_name]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_name
     ]
   )
@@ -114,7 +114,7 @@
     LiteralExpr [STRING] [s_address]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_address
     ]
   )
@@ -122,7 +122,7 @@
     LiteralExpr [STRING] [s_phone]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_phone
     ]
   )
@@ -130,7 +130,7 @@
     LiteralExpr [STRING] [total_revenue]
     :
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=total_revenue
     ]
   )
@@ -140,35 +140,35 @@
     LiteralExpr [STRING] [Supplier]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
 ,
   FunctionCall tpch.revenue@0[
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=s ]
+        Variable [ Name=$s ]
         Field=s_suppkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=r ]
+        Variable [ Name=$r ]
         Field=supplier_no
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=r ]
+        Variable [ Name=$r ]
         Field=total_revenue
       ]
       <
       OperatorExpr [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         +
         LiteralExpr [DOUBLE] [1.0E-9]
       ]
@@ -176,12 +176,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=r ]
+        Variable [ Name=$r ]
         Field=total_revenue
       ]
       >
       OperatorExpr [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         -
         LiteralExpr [DOUBLE] [1.0E-9]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
index dc55293..9fb5785 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
@@ -7,7 +7,7 @@
         LiteralExpr [STRING] [p_brand]
         :
         FieldAccessor [
-          Variable [ Name=psp ]
+          Variable [ Name=$psp ]
           Field=p_brand
         ]
       )
@@ -15,7 +15,7 @@
         LiteralExpr [STRING] [p_type]
         :
         FieldAccessor [
-          Variable [ Name=psp ]
+          Variable [ Name=$psp ]
           Field=p_type
         ]
       )
@@ -23,7 +23,7 @@
         LiteralExpr [STRING] [p_size]
         :
         FieldAccessor [
-          Variable [ Name=psp ]
+          Variable [ Name=$psp ]
           Field=p_size
         ]
       )
@@ -31,7 +31,7 @@
         LiteralExpr [STRING] [ps_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=psp ]
+          Variable [ Name=$psp ]
           Field=ps_suppkey
         ]
       )
@@ -44,7 +44,7 @@
             LiteralExpr [STRING] [p_brand]
             :
             FieldAccessor [
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
               Field=p_brand
             ]
           )
@@ -52,7 +52,7 @@
             LiteralExpr [STRING] [p_type]
             :
             FieldAccessor [
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
               Field=p_type
             ]
           )
@@ -60,7 +60,7 @@
             LiteralExpr [STRING] [p_size]
             :
             FieldAccessor [
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
               Field=p_size
             ]
           )
@@ -68,37 +68,37 @@
             LiteralExpr [STRING] [ps_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_suppkey
             ]
           )
         ]
         ]
-        FROM [          Variable [ Name=Partsupp ]
+        FROM [          Variable [ Name=$Partsupp ]
           AS
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
 ,
-          Variable [ Name=Part ]
+          Variable [ Name=$Part ]
           AS
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_partkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=ps ]
+                Variable [ Name=$ps ]
                 Field=ps_partkey
               ]
             ]
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_brand
               ]
               !=
@@ -108,7 +108,7 @@
             FunctionCall tpch.not@1[
               FunctionCall tpch.like@2[
                 FieldAccessor [
-                  Variable [ Name=p ]
+                  Variable [ Name=$p ]
                   Field=p_type
                 ]
                 LiteralExpr [STRING] [MEDIUM POLISHED%]
@@ -117,22 +117,22 @@
           ]
       )
       AS
-      Variable [ Name=psp ]
+      Variable [ Name=$psp ]
 ,
-      Variable [ Name=Supplier ]
+      Variable [ Name=$Supplier ]
       AS
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=psp ]
+            Variable [ Name=$psp ]
             Field=ps_suppkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=s ]
+            Variable [ Name=$s ]
             Field=s_suppkey
           ]
         ]
@@ -140,7 +140,7 @@
         FunctionCall tpch.not@1[
           FunctionCall tpch.like@2[
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_comment
             ]
             LiteralExpr [STRING] [%Customer%Complaints%]
@@ -156,22 +156,22 @@
   (
     LiteralExpr [STRING] [p_brand]
     :
-    Variable [ Name=p_brand ]
+    Variable [ Name=$p_brand ]
   )
   (
     LiteralExpr [STRING] [p_type]
     :
-    Variable [ Name=p_type ]
+    Variable [ Name=$p_type ]
   )
   (
     LiteralExpr [STRING] [p_size]
     :
-    Variable [ Name=p_size ]
+    Variable [ Name=$p_size ]
   )
   (
     LiteralExpr [STRING] [supplier_cnt]
     :
-    Variable [ Name=supplier_cnt ]
+    Variable [ Name=$supplier_cnt ]
   )
 ]
 ]
@@ -181,35 +181,35 @@
       (
         LiteralExpr [STRING] [p_brand]
         :
-        Variable [ Name=p_brand1 ]
+        Variable [ Name=$p_brand1 ]
       )
       (
         LiteralExpr [STRING] [p_type]
         :
-        Variable [ Name=p_type1 ]
+        Variable [ Name=$p_type1 ]
       )
       (
         LiteralExpr [STRING] [p_size]
         :
-        Variable [ Name=p_size1 ]
+        Variable [ Name=$p_size1 ]
       )
       (
         LiteralExpr [STRING] [ps_suppkey]
         :
-        Variable [ Name=ps_suppkey1 ]
+        Variable [ Name=$ps_suppkey1 ]
       )
     ]
     ]
     FROM [      FunctionCall tpch.tmp@0[
       ]
       AS
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -218,7 +218,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -227,7 +227,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -236,7 +236,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -245,7 +245,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -254,7 +254,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -263,7 +263,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -272,7 +272,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -280,82 +280,90 @@
         ]
       ]
     Groupby
-      Variable [ Name=p_brand1 ]
+      Variable [ Name=$p_brand1 ]
       :=
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=p_brand
       ]
-      Variable [ Name=p_type1 ]
+      Variable [ Name=$p_type1 ]
       :=
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=p_type
       ]
-      Variable [ Name=p_size1 ]
+      Variable [ Name=$p_size1 ]
       :=
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=p_size
       ]
-      Variable [ Name=ps_suppkey1 ]
+      Variable [ Name=$ps_suppkey1 ]
       :=
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=ps_suppkey
       ]
-      With
-      Variable [ Name=t ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$t ]
+       AS t
+      )
 
   )
   AS
-  Variable [ Name=t2 ]
+  Variable [ Name=$t2 ]
 ]
 Groupby
-  Variable [ Name=p_brand ]
+  Variable [ Name=$p_brand ]
   :=
   FieldAccessor [
-    Variable [ Name=t2 ]
+    Variable [ Name=$t2 ]
     Field=p_brand
   ]
-  Variable [ Name=p_type ]
+  Variable [ Name=$p_type ]
   :=
   FieldAccessor [
-    Variable [ Name=t2 ]
+    Variable [ Name=$t2 ]
     Field=p_type
   ]
-  Variable [ Name=p_size ]
+  Variable [ Name=$p_size ]
   :=
   FieldAccessor [
-    Variable [ Name=t2 ]
+    Variable [ Name=$t2 ]
     Field=p_size
   ]
-  With
-  Variable [ Name=t2 ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$t2 ]
+   AS t2
+  )
 
-LetVariable [ Name=supplier_cnt ]
+Let Variable [ Name=$supplier_cnt ]
   :=
   FunctionCall tpch.count@1[
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=ps_suppkey
       ]
       ]
-      FROM [        Variable [ Name=t2 ]
+      FROM [        Variable [ Name=$t2 ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=supplier_cnt ]
+  Variable [ Name=$supplier_cnt ]
   DESC
-  Variable [ Name=p_brand ]
+  Variable [ Name=$p_brand ]
   ASC
-  Variable [ Name=p_type ]
+  Variable [ Name=$p_type ]
   ASC
-  Variable [ Name=p_size ]
+  Variable [ Name=$p_size ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.ast
index 19e5d78..fb8f2cd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [t_partkey]
     :
-    Variable [ Name=l_partkey ]
+    Variable [ Name=$l_partkey ]
   )
   (
     LiteralExpr [STRING] [t_count]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=l ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
   (
@@ -24,13 +35,13 @@
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_quantity
           ]
           ]
-          FROM [            Variable [ Name=l ]
+          FROM [            Variable [ Name=$l ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -43,13 +54,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_suppkey
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -61,13 +72,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_linenumber
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -79,13 +90,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -97,13 +108,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -115,13 +126,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_tax
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -133,13 +144,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_shipdate
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -151,13 +162,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_commitdate
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -169,13 +180,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_receiptdate
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -187,13 +198,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_comment
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -204,19 +215,23 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Groupby
-  Variable [ Name=l_partkey ]
+  Variable [ Name=$l_partkey ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_partkey
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
 Orderby
-  Variable [ Name=l_partkey ]
+  Variable [ Name=$l_partkey ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.ast
index 845240a..cffd853 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.ast
@@ -6,7 +6,7 @@
       (
         LiteralExpr [STRING] [t_partkey]
         :
-        Variable [ Name=l_partkey ]
+        Variable [ Name=$l_partkey ]
       )
       (
         LiteralExpr [STRING] [t_avg_quantity]
@@ -18,13 +18,13 @@
             (
               SELECT ELEMENT [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=l_quantity
               ]
               ]
-              FROM [                Variable [ Name=l ]
+              FROM [                Variable [ Name=$l ]
                 AS
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
               ]
             )
           ]
@@ -32,15 +32,15 @@
       )
     ]
     ]
-    FROM [      Variable [ Name=LineItem ]
+    FROM [      Variable [ Name=$LineItem ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Groupby
-      Variable [ Name=l_partkey ]
+      Variable [ Name=$l_partkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_partkey
       ]
 
@@ -54,7 +54,7 @@
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_extendedprice
       ]
       ]
@@ -62,37 +62,37 @@
           LiteralExpr [STRING] [LineItem]
         ]
         AS
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
 ,
         FunctionCall Metadata.dataset@1[
           LiteralExpr [STRING] [Part]
         ]
         AS
-        Variable [ Name=p ]
+        Variable [ Name=$p ]
 ,
         FunctionCall tpch.tmp@0[
         ]
         AS
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_partkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_partkey
               ]
             ]
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_container
               ]
               =
@@ -103,24 +103,24 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_partkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=t ]
+                Variable [ Name=$t ]
                 Field=t_partkey
               ]
             ]
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               <
               FieldAccessor [
-                Variable [ Name=t ]
+                Variable [ Name=$t ]
                 Field=t_avg_quantity
               ]
             ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.ast
index edf6190..f8e71b5 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.ast
@@ -5,27 +5,27 @@
   (
     LiteralExpr [STRING] [c_name]
     :
-    Variable [ Name=c_name ]
+    Variable [ Name=$c_name ]
   )
   (
     LiteralExpr [STRING] [c_custkey]
     :
-    Variable [ Name=c_custkey ]
+    Variable [ Name=$c_custkey ]
   )
   (
     LiteralExpr [STRING] [o_orderkey]
     :
-    Variable [ Name=o_orderkey ]
+    Variable [ Name=$o_orderkey ]
   )
   (
     LiteralExpr [STRING] [o_orderdate]
     :
-    Variable [ Name=o_orderdate ]
+    Variable [ Name=$o_orderdate ]
   )
   (
     LiteralExpr [STRING] [o_totalprice]
     :
-    Variable [ Name=o_totalprice ]
+    Variable [ Name=$o_totalprice ]
   )
   (
     LiteralExpr [STRING] [sum_quantity]
@@ -34,13 +34,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
         ]
       )
     ]
@@ -51,13 +51,13 @@
     LiteralExpr [STRING] [Customer]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   (
     SELECT ELEMENT [
@@ -65,7 +65,7 @@
       (
         LiteralExpr [STRING] [l_orderkey]
         :
-        Variable [ Name=l_orderkey ]
+        Variable [ Name=$l_orderkey ]
       )
       (
         LiteralExpr [STRING] [t_sum_quantity]
@@ -74,13 +74,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_quantity
             ]
             ]
-            FROM [              Variable [ Name=l ]
+            FROM [              Variable [ Name=$l ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -91,40 +91,46 @@
         LiteralExpr [STRING] [LineItem]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Groupby
-      Variable [ Name=l_orderkey ]
+      Variable [ Name=$l_orderkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
-      With
-      Variable [ Name=l ]
-      Variable [ Name=c ]
-      Variable [ Name=o ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$l ]
+       AS l
+      Variable [ Name=$o ]
+       AS o
+      Variable [ Name=$c ]
+       AS c
+      )
 
   )
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_custkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
     ]
@@ -132,19 +138,19 @@
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=l_orderkey
         ]
       ]
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=t ]
+          Variable [ Name=$t ]
           Field=t_sum_quantity
         ]
         >
@@ -154,57 +160,64 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderkey
       ]
     ]
   ]
 Groupby
-  Variable [ Name=c_name ]
+  Variable [ Name=$c_name ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=c_name
   ]
-  Variable [ Name=c_custkey ]
+  Variable [ Name=$c_custkey ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=c_custkey
   ]
-  Variable [ Name=o_orderkey ]
+  Variable [ Name=$o_orderkey ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderdate
   ]
-  Variable [ Name=o_totalprice ]
+  Variable [ Name=$o_totalprice ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_totalprice
   ]
-  With
-  Variable [ Name=c ]
-  Variable [ Name=t ]
-  Variable [ Name=l ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  Variable [ Name=$t ]
+   AS t
+  Variable [ Name=$o ]
+   AS o
+  Variable [ Name=$c ]
+   AS c
+  )
 
 Orderby
-  Variable [ Name=o_totalprice ]
+  Variable [ Name=$o_totalprice ]
   DESC
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   ASC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q19_discounted_revenue/q19_discounted_revenue.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q19_discounted_revenue/q19_discounted_revenue.3.ast
index 46e01a7..1de3822 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q19_discounted_revenue/q19_discounted_revenue.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q19_discounted_revenue/q19_discounted_revenue.3.ast
@@ -7,7 +7,7 @@
     SELECT ELEMENT [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_extendedprice
       ]
       *
@@ -15,7 +15,7 @@
         LiteralExpr [LONG] [1]
         -
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_discount
         ]
       ]
@@ -25,24 +25,24 @@
         LiteralExpr [STRING] [LineItem]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Part]
       ]
       AS
-      Variable [ Name=p ]
+      Variable [ Name=$p ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_partkey
           ]
         ]
@@ -51,7 +51,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_brand
               ]
               =
@@ -60,7 +60,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_container
               ]
               LiteralExpr [STRING] [SM CASE||SM BOX||SM PACK||SM PKG]
@@ -68,7 +68,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               >=
@@ -77,7 +77,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               <=
@@ -86,7 +86,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               >=
@@ -95,7 +95,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               <=
@@ -104,7 +104,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipmode
               ]
               LiteralExpr [STRING] [AIR||AIR REG]
@@ -112,7 +112,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipinstruct
               ]
               =
@@ -123,7 +123,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_brand
               ]
               =
@@ -132,7 +132,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_container
               ]
               LiteralExpr [STRING] [MED BAG||MED BOX||MED PKG||MED PACK]
@@ -140,7 +140,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               >=
@@ -149,7 +149,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               <=
@@ -158,7 +158,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               >=
@@ -167,7 +167,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               <=
@@ -176,7 +176,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipmode
               ]
               LiteralExpr [STRING] [AIR||AIR REG]
@@ -184,7 +184,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipinstruct
               ]
               =
@@ -195,7 +195,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_brand
               ]
               =
@@ -204,7 +204,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_container
               ]
               LiteralExpr [STRING] [LG CASE||LG BOX||LG PACK||LG PKG]
@@ -212,7 +212,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               >=
@@ -221,7 +221,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               <=
@@ -230,7 +230,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               >=
@@ -239,7 +239,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               <=
@@ -248,7 +248,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipmode
               ]
               LiteralExpr [STRING] [AIR||AIR REG]
@@ -256,7 +256,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipinstruct
               ]
               =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
index fda99ec..6029e08 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [s_name]
     :
     FieldAccessor [
-      Variable [ Name=t4 ]
+      Variable [ Name=$t4 ]
       Field=s_name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [s_address]
     :
     FieldAccessor [
-      Variable [ Name=t4 ]
+      Variable [ Name=$t4 ]
       Field=s_address
     ]
   )
@@ -27,7 +27,7 @@
         LiteralExpr [STRING] [ps_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=pst1 ]
+          Variable [ Name=$pst1 ]
           Field=ps_suppkey
         ]
       )
@@ -39,12 +39,12 @@
           (
             LiteralExpr [STRING] [l_partkey]
             :
-            Variable [ Name=l_partkey ]
+            Variable [ Name=$l_partkey ]
           )
           (
             LiteralExpr [STRING] [l_suppkey]
             :
-            Variable [ Name=l_suppkey ]
+            Variable [ Name=$l_suppkey ]
           )
           (
             LiteralExpr [STRING] [sum_quantity]
@@ -56,13 +56,13 @@
                 (
                   SELECT ELEMENT [
                   FieldAccessor [
-                    Variable [ Name=i ]
+                    Variable [ Name=$i ]
                     Field=l_quantity
                   ]
                   ]
-                  FROM [                    Variable [ Name=l ]
+                  FROM [                    Variable [ Name=$l ]
                     AS
-                    Variable [ Name=i ]
+                    Variable [ Name=$i ]
                   ]
                 )
               ]
@@ -74,27 +74,31 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Groupby
-          Variable [ Name=l_partkey ]
+          Variable [ Name=$l_partkey ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_partkey
           ]
-          Variable [ Name=l_suppkey ]
+          Variable [ Name=$l_suppkey ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_suppkey
           ]
-          With
-          Variable [ Name=l ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$l ]
+           AS l
+          )
 
       )
       AS
-      Variable [ Name=t2 ]
+      Variable [ Name=$t2 ]
 ,
       (
         SELECT ELEMENT [
@@ -103,7 +107,7 @@
             LiteralExpr [STRING] [ps_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_suppkey
             ]
           )
@@ -111,7 +115,7 @@
             LiteralExpr [STRING] [ps_partkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_partkey
             ]
           )
@@ -119,7 +123,7 @@
             LiteralExpr [STRING] [ps_availqty]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_availqty
             ]
           )
@@ -129,7 +133,7 @@
             LiteralExpr [STRING] [Partsupp]
           ]
           AS
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
 ,
           (
             SELECT ELEMENT [
@@ -138,7 +142,7 @@
                 LiteralExpr [STRING] [p_partkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=p ]
+                  Variable [ Name=$p ]
                   Field=p_partkey
                 ]
               )
@@ -148,69 +152,69 @@
                 LiteralExpr [STRING] [Part]
               ]
               AS
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
             ]
           )
           AS
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_partkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=p_partkey
             ]
           ]
       )
       AS
-      Variable [ Name=pst1 ]
+      Variable [ Name=$pst1 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=pst1 ]
+            Variable [ Name=$pst1 ]
             Field=ps_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=l_partkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=pst1 ]
+            Variable [ Name=$pst1 ]
             Field=ps_suppkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=l_suppkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=pst1 ]
+            Variable [ Name=$pst1 ]
             Field=ps_availqty
           ]
           >
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sum_quantity
           ]
         ]
       ]
   )
   AS
-  Variable [ Name=t3 ]
+  Variable [ Name=$t3 ]
 ,
   (
     SELECT ELEMENT [
@@ -219,7 +223,7 @@
         LiteralExpr [STRING] [s_name]
         :
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_name
         ]
       )
@@ -227,7 +231,7 @@
         LiteralExpr [STRING] [s_address]
         :
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_address
         ]
       )
@@ -235,7 +239,7 @@
         LiteralExpr [STRING] [s_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_suppkey
         ]
       )
@@ -245,45 +249,45 @@
         LiteralExpr [STRING] [Nation]
       ]
       AS
-      Variable [ Name=n ]
+      Variable [ Name=$n ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Supplier]
       ]
       AS
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_nationkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
           Field=n_nationkey
         ]
       ]
   )
   AS
-  Variable [ Name=t4 ]
+  Variable [ Name=$t4 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t3 ]
+      Variable [ Name=$t3 ]
       Field=ps_suppkey
     ]
     =
     FieldAccessor [
-      Variable [ Name=t4 ]
+      Variable [ Name=$t4 ]
       Field=s_suppkey
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t4 ]
+    Variable [ Name=$t4 ]
     Field=s_name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.ast
index c471683..c756a58 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.ast
@@ -6,7 +6,7 @@
       (
         LiteralExpr [STRING] [l_orderkey]
         :
-        Variable [ Name=l_orderkey ]
+        Variable [ Name=$l_orderkey ]
       )
       (
         LiteralExpr [STRING] [count_suppkey]
@@ -15,13 +15,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_suppkey
             ]
             ]
-            FROM [              Variable [ Name=l2 ]
+            FROM [              Variable [ Name=$l2 ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -33,13 +33,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_suppkey
             ]
             ]
-            FROM [              Variable [ Name=l2 ]
+            FROM [              Variable [ Name=$l2 ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -52,42 +52,42 @@
           (
             LiteralExpr [STRING] [l_orderkey]
             :
-            Variable [ Name=l_orderkey1 ]
+            Variable [ Name=$l_orderkey1 ]
           )
           (
             LiteralExpr [STRING] [l_suppkey]
             :
-            Variable [ Name=l_suppkey1 ]
+            Variable [ Name=$l_suppkey1 ]
           )
         ]
         ]
-        FROM [          Variable [ Name=LineItem ]
+        FROM [          Variable [ Name=$LineItem ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Groupby
-          Variable [ Name=l_orderkey1 ]
+          Variable [ Name=$l_orderkey1 ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_orderkey
           ]
-          Variable [ Name=l_suppkey1 ]
+          Variable [ Name=$l_suppkey1 ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_suppkey
           ]
 
       )
       AS
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
     ]
     Groupby
-      Variable [ Name=l_orderkey ]
+      Variable [ Name=$l_orderkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l2 ]
+        Variable [ Name=$l2 ]
         Field=l_orderkey
       ]
 
@@ -101,7 +101,7 @@
       (
         LiteralExpr [STRING] [l_orderkey]
         :
-        Variable [ Name=l_orderkey ]
+        Variable [ Name=$l_orderkey ]
       )
       (
         LiteralExpr [STRING] [count_suppkey]
@@ -110,13 +110,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_suppkey
             ]
             ]
-            FROM [              Variable [ Name=l2 ]
+            FROM [              Variable [ Name=$l2 ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -128,13 +128,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_suppkey
             ]
             ]
-            FROM [              Variable [ Name=l2 ]
+            FROM [              Variable [ Name=$l2 ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -147,54 +147,54 @@
           (
             LiteralExpr [STRING] [l_orderkey]
             :
-            Variable [ Name=l_orderkey1 ]
+            Variable [ Name=$l_orderkey1 ]
           )
           (
             LiteralExpr [STRING] [l_suppkey]
             :
-            Variable [ Name=l_suppkey1 ]
+            Variable [ Name=$l_suppkey1 ]
           )
         ]
         ]
-        FROM [          Variable [ Name=LineItem ]
+        FROM [          Variable [ Name=$LineItem ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_receiptdate
             ]
             >
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_commitdate
             ]
           ]
         Groupby
-          Variable [ Name=l_orderkey1 ]
+          Variable [ Name=$l_orderkey1 ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_orderkey
           ]
-          Variable [ Name=l_suppkey1 ]
+          Variable [ Name=$l_suppkey1 ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_suppkey
           ]
 
       )
       AS
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
     ]
     Groupby
-      Variable [ Name=l_orderkey ]
+      Variable [ Name=$l_orderkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l2 ]
+        Variable [ Name=$l2 ]
         Field=l_orderkey
       ]
 
@@ -207,12 +207,12 @@
   (
     LiteralExpr [STRING] [s_name]
     :
-    Variable [ Name=s_name ]
+    Variable [ Name=$s_name ]
   )
   (
     LiteralExpr [STRING] [numwait]
     :
-    Variable [ Name=numwait ]
+    Variable [ Name=$numwait ]
   )
 ]
 ]
@@ -223,7 +223,7 @@
         LiteralExpr [STRING] [s_name]
         :
         FieldAccessor [
-          Variable [ Name=t3 ]
+          Variable [ Name=$t3 ]
           Field=s_name
         ]
       )
@@ -231,7 +231,7 @@
         LiteralExpr [STRING] [l_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=t3 ]
+          Variable [ Name=$t3 ]
           Field=l_suppkey
         ]
       )
@@ -239,7 +239,7 @@
         LiteralExpr [STRING] [l_orderkey]
         :
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=l_orderkey
         ]
       )
@@ -247,7 +247,7 @@
         LiteralExpr [STRING] [count_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=count_suppkey
         ]
       )
@@ -255,7 +255,7 @@
         LiteralExpr [STRING] [max_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=max_suppkey
         ]
       )
@@ -268,7 +268,7 @@
             LiteralExpr [STRING] [s_name]
             :
             FieldAccessor [
-              Variable [ Name=ns ]
+              Variable [ Name=$ns ]
               Field=s_name
             ]
           )
@@ -276,7 +276,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=l_orderkey
             ]
           )
@@ -284,7 +284,7 @@
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
           )
@@ -294,7 +294,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
 ,
           (
             SELECT ELEMENT [
@@ -303,7 +303,7 @@
                 LiteralExpr [STRING] [s_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_name
                 ]
               )
@@ -311,7 +311,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -321,64 +321,64 @@
                 LiteralExpr [STRING] [Nation]
               ]
               AS
-              Variable [ Name=n ]
+              Variable [ Name=$n ]
 ,
               FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Supplier]
               ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
                   Field=n_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=ns ]
+          Variable [ Name=$ns ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Orders]
           ]
           AS
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
 ,
           FunctionCall tpch.tmp1@0[
           ]
           AS
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=ns ]
+                  Variable [ Name=$ns ]
                   Field=s_suppkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_suppkey
                 ]
               ]
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_receiptdate
                 ]
                 >
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_commitdate
                 ]
               ]
@@ -386,42 +386,42 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=o ]
+                Variable [ Name=$o ]
                 Field=o_orderkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_orderkey
               ]
             ]
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_orderkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=l_orderkey
               ]
             ]
           ]
       )
       AS
-      Variable [ Name=t3 ]
+      Variable [ Name=$t3 ]
 ,
       FunctionCall tpch.tmp2@0[
       ]
       AS
-      Variable [ Name=t2 ]
+      Variable [ Name=$t2 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=count_suppkey
           ]
           >=
@@ -430,38 +430,53 @@
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t3 ]
+            Variable [ Name=$t3 ]
             Field=l_orderkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=l_orderkey
           ]
         ]
       ]
   )
   AS
-  Variable [ Name=t4 ]
+  Variable [ Name=$t4 ]
 ]
 Groupby
-  Variable [ Name=s_name ]
+  Variable [ Name=$s_name ]
   :=
   FieldAccessor [
-    Variable [ Name=t4 ]
+    Variable [ Name=$t4 ]
     Field=s_name
   ]
-  With
-  Variable [ Name=t4 ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t4 ]
+   AS t4
+  )
 
-LetVariable [ Name=numwait ]
+Let Variable [ Name=$numwait ]
   :=
   FunctionCall tpch.count@1[
-    Variable [ Name=t4 ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=t4
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=numwait ]
+  Variable [ Name=$numwait ]
   DESC
-  Variable [ Name=s_name ]
+  Variable [ Name=$s_name ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q22_global_sales_opportunity/q22_global_sales_opportunity.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q22_global_sales_opportunity/q22_global_sales_opportunity.3.ast
index 8efbfe5..063914d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q22_global_sales_opportunity/q22_global_sales_opportunity.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q22_global_sales_opportunity/q22_global_sales_opportunity.3.ast
@@ -7,7 +7,7 @@
         LiteralExpr [STRING] [c_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_acctbal
         ]
       )
@@ -15,7 +15,7 @@
         LiteralExpr [STRING] [c_custkey]
         :
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_custkey
         ]
       )
@@ -24,7 +24,7 @@
         :
         FunctionCall tpch.substring@3[
           FieldAccessor [
-            Variable [ Name=c ]
+            Variable [ Name=$c ]
             Field=c_phone
           ]
           LiteralExpr [LONG] [1]
@@ -33,21 +33,21 @@
       )
     ]
     ]
-    FROM [      Variable [ Name=Customer ]
+    FROM [      Variable [ Name=$Customer ]
       AS
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
     ]
   )
 }
 
 Query:
-LetVariable [ Name=avg ]
+Let Variable [ Name=$avg ]
   :=
   FunctionCall tpch.avg@1[
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_acctbal
       ]
       ]
@@ -55,12 +55,12 @@
           LiteralExpr [STRING] [Customer]
         ]
         AS
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=c ]
+            Variable [ Name=$c ]
             Field=c_acctbal
           ]
           >
@@ -73,13 +73,24 @@
   (
     LiteralExpr [STRING] [cntrycode]
     :
-    Variable [ Name=cntrycode ]
+    Variable [ Name=$cntrycode ]
   )
   (
     LiteralExpr [STRING] [numcust]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=ct ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=ct
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
   (
@@ -89,13 +100,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=c_acctbal
         ]
         ]
-        FROM [          Variable [ Name=ct ]
+        FROM [          Variable [ Name=$ct ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -105,29 +116,34 @@
 FROM [  FunctionCall tpch.q22_customer_tmp@0[
   ]
   AS
-  Variable [ Name=ct ]
+  Variable [ Name=$ct ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=ct ]
+      Variable [ Name=$ct ]
       Field=c_acctbal
     ]
     >
-    Variable [ Name=avg ]
+    Variable [ Name=$avg ]
   ]
 Groupby
-  Variable [ Name=cntrycode ]
+  Variable [ Name=$cntrycode ]
   :=
   FieldAccessor [
-    Variable [ Name=ct ]
+    Variable [ Name=$ct ]
     Field=cntrycode
   ]
-  With
-  Variable [ Name=ct ]
-  Variable [ Name=avg ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$ct ]
+   AS ct
+  Variable [ Name=$avg ]
+   AS avg
+  )
 
 Orderby
-  Variable [ Name=cntrycode ]
+  Variable [ Name=$cntrycode ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue601/query-issue601.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue601/query-issue601.3.ast
index 3776535..85c3c0d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue601/query-issue601.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue601/query-issue601.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [l_linenumber]
     :
-    Variable [ Name=l_linenumber ]
+    Variable [ Name=$l_linenumber ]
   )
   (
     LiteralExpr [STRING] [count_order]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=l ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,15 +31,19 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Groupby
-  Variable [ Name=l_linenumber ]
+  Variable [ Name=$l_linenumber ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linenumber
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue638/query-issue638.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue638/query-issue638.3.ast
index 8052433..e455c20 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue638/query-issue638.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue638/query-issue638.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [nation]
     :
-    Variable [ Name=nation ]
+    Variable [ Name=$nation ]
   )
   (
     LiteralExpr [STRING] [o_year]
     :
-    Variable [ Name=o_year ]
+    Variable [ Name=$o_year ]
   )
   (
     LiteralExpr [STRING] [sum_profit]
@@ -19,13 +19,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=pr ]
+          Variable [ Name=$pr ]
           Field=amount
         ]
         ]
-        FROM [          Variable [ Name=profit ]
+        FROM [          Variable [ Name=$profit ]
           AS
-          Variable [ Name=pr ]
+          Variable [ Name=$pr ]
         ]
       )
     ]
@@ -39,19 +39,19 @@
         LiteralExpr [STRING] [nation]
         :
         FieldAccessor [
-          Variable [ Name=l3 ]
+          Variable [ Name=$l3 ]
           Field=n_name
         ]
       )
       (
         LiteralExpr [STRING] [o_year]
         :
-        Variable [ Name=o_year ]
+        Variable [ Name=$o_year ]
       )
       (
         LiteralExpr [STRING] [amount]
         :
-        Variable [ Name=amount ]
+        Variable [ Name=$amount ]
       )
     ]
     ]
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
 ,
       (
         SELECT ELEMENT [
@@ -68,7 +68,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_extendedprice
             ]
           )
@@ -76,7 +76,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_discount
             ]
           )
@@ -84,7 +84,7 @@
             LiteralExpr [STRING] [l_quantity]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_quantity
             ]
           )
@@ -92,7 +92,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_orderkey
             ]
           )
@@ -100,7 +100,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=n_name
             ]
           )
@@ -108,7 +108,7 @@
             LiteralExpr [STRING] [ps_supplycost]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=ps_supplycost
             ]
           )
@@ -118,7 +118,7 @@
             LiteralExpr [STRING] [Part]
           ]
           AS
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
 ,
           (
             SELECT ELEMENT [
@@ -127,7 +127,7 @@
                 LiteralExpr [STRING] [l_extendedprice]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_extendedprice
                 ]
               )
@@ -135,7 +135,7 @@
                 LiteralExpr [STRING] [l_discount]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_discount
                 ]
               )
@@ -143,7 +143,7 @@
                 LiteralExpr [STRING] [l_quantity]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_quantity
                 ]
               )
@@ -151,7 +151,7 @@
                 LiteralExpr [STRING] [l_partkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_partkey
                 ]
               )
@@ -159,7 +159,7 @@
                 LiteralExpr [STRING] [l_orderkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_orderkey
                 ]
               )
@@ -167,7 +167,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=n_name
                 ]
               )
@@ -175,7 +175,7 @@
                 LiteralExpr [STRING] [ps_supplycost]
                 :
                 FieldAccessor [
-                  Variable [ Name=ps ]
+                  Variable [ Name=$ps ]
                   Field=ps_supplycost
                 ]
               )
@@ -185,7 +185,7 @@
                 LiteralExpr [STRING] [Partsupp]
               ]
               AS
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
 ,
               (
                 SELECT ELEMENT [
@@ -194,7 +194,7 @@
                     LiteralExpr [STRING] [l_suppkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_suppkey
                     ]
                   )
@@ -202,7 +202,7 @@
                     LiteralExpr [STRING] [l_extendedprice]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_extendedprice
                     ]
                   )
@@ -210,7 +210,7 @@
                     LiteralExpr [STRING] [l_discount]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_discount
                     ]
                   )
@@ -218,7 +218,7 @@
                     LiteralExpr [STRING] [l_quantity]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_quantity
                     ]
                   )
@@ -226,7 +226,7 @@
                     LiteralExpr [STRING] [l_partkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_partkey
                     ]
                   )
@@ -234,7 +234,7 @@
                     LiteralExpr [STRING] [l_orderkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_orderkey
                     ]
                   )
@@ -242,7 +242,7 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=s1 ]
+                      Variable [ Name=$s1 ]
                       Field=n_name
                     ]
                   )
@@ -255,7 +255,7 @@
                         LiteralExpr [STRING] [s_suppkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=s ]
+                          Variable [ Name=$s ]
                           Field=s_suppkey
                         ]
                       )
@@ -263,7 +263,7 @@
                         LiteralExpr [STRING] [n_name]
                         :
                         FieldAccessor [
-                          Variable [ Name=n ]
+                          Variable [ Name=$n ]
                           Field=n_name
                         ]
                       )
@@ -273,87 +273,87 @@
                         LiteralExpr [STRING] [Supplier]
                       ]
                       AS
-                      Variable [ Name=s ]
+                      Variable [ Name=$s ]
 ,
                       FunctionCall Metadata.dataset@1[
                         LiteralExpr [STRING] [Nation]
                       ]
                       AS
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                     ]
                     Where
                       OperatorExpr [
                         FieldAccessor [
-                          Variable [ Name=n ]
+                          Variable [ Name=$n ]
                           Field=n_nationkey
                         ]
                         =
                         FieldAccessor [
-                          Variable [ Name=s ]
+                          Variable [ Name=$s ]
                           Field=s_nationkey
                         ]
                       ]
                   )
                   AS
-                  Variable [ Name=s1 ]
+                  Variable [ Name=$s1 ]
 ,
                   FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [LineItem]
                   ]
                   AS
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                 ]
                 Where
                   OperatorExpr [
                     FieldAccessor [
-                      Variable [ Name=s1 ]
+                      Variable [ Name=$s1 ]
                       Field=s_suppkey
                     ]
                     =
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_suppkey
                     ]
                   ]
               )
               AS
-              Variable [ Name=l1 ]
+              Variable [ Name=$l1 ]
             ]
             Where
               OperatorExpr [
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=ps ]
+                    Variable [ Name=$ps ]
                     Field=ps_suppkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_suppkey
                   ]
                 ]
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=ps ]
+                    Variable [ Name=$ps ]
                     Field=ps_partkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_partkey
                   ]
                 ]
               ]
           )
           AS
-          Variable [ Name=l2 ]
+          Variable [ Name=$l2 ]
         ]
         Where
           OperatorExpr [
             FunctionCall tpch.contains@2[
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_name
               ]
               LiteralExpr [STRING] [green]
@@ -361,26 +361,26 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_partkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=l2 ]
+                Variable [ Name=$l2 ]
                 Field=l_partkey
               ]
             ]
           ]
       )
       AS
-      Variable [ Name=l3 ]
+      Variable [ Name=$l3 ]
     ]
-    LetVariable [ Name=amount ]
+    Let Variable [ Name=$amount ]
       :=
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=l_extendedprice
           ]
           *
@@ -388,7 +388,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=l3 ]
+              Variable [ Name=$l3 ]
               Field=l_discount
             ]
           ]
@@ -396,59 +396,63 @@
         -
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=ps_supplycost
           ]
           *
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=l_quantity
           ]
         ]
       ]
-    LetVariable [ Name=o_year ]
+    Let Variable [ Name=$o_year ]
       :=
       FunctionCall tpch.get-year@1[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderdate
         ]
       ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=l3 ]
+          Variable [ Name=$l3 ]
           Field=l_orderkey
         ]
       ]
   )
   AS
-  Variable [ Name=profit ]
+  Variable [ Name=$profit ]
 ]
 Groupby
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
   :=
   FieldAccessor [
-    Variable [ Name=profit ]
+    Variable [ Name=$profit ]
     Field=nation
   ]
-  Variable [ Name=o_year ]
+  Variable [ Name=$o_year ]
   :=
   FieldAccessor [
-    Variable [ Name=profit ]
+    Variable [ Name=$profit ]
     Field=o_year
   ]
-  With
-  Variable [ Name=profit ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$profit ]
+   AS profit
+  )
 
 Orderby
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
   ASC
-  Variable [ Name=o_year ]
+  Variable [ Name=$o_year ]
   DESC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue785-2/query-issue785-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue785-2/query-issue785-2.3.ast
index 715999d..3b22218 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue785-2/query-issue785-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue785-2/query-issue785-2.3.ast
@@ -1,6 +1,6 @@
 DataverseUse tpch
 Query:
-LetVariable [ Name=t ]
+Let Variable [ Name=$t ]
   :=
   (
     SELECT ELEMENT [
@@ -9,7 +9,7 @@
         LiteralExpr [STRING] [n_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_nationkey
         ]
       )
@@ -17,7 +17,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_name
         ]
       )
@@ -27,28 +27,28 @@
         LiteralExpr [STRING] [Nation]
       ]
       AS
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [SelectedNation]
       ]
       AS
-      Variable [ Name=sn ]
+      Variable [ Name=$sn ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_nationkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=sn ]
+          Variable [ Name=$sn ]
           Field=n_nationkey
         ]
       ]
   )
-LetVariable [ Name=X ]
+Let Variable [ Name=$X ]
   :=
   (
     SELECT ELEMENT [
@@ -56,94 +56,101 @@
       (
         LiteralExpr [STRING] [nation_key]
         :
-        Variable [ Name=nation_key ]
+        Variable [ Name=$nation_key ]
       )
       (
         LiteralExpr [STRING] [order_date]
         :
-        Variable [ Name=orderdate ]
+        Variable [ Name=$orderdate ]
       )
       (
         LiteralExpr [STRING] [sum_price]
         :
-        Variable [ Name=sum ]
+        Variable [ Name=$sum ]
       )
     ]
     ]
-    FROM [      Variable [ Name=t ]
+    FROM [      Variable [ Name=$t ]
       AS
-      Variable [ Name=n ]
+      Variable [ Name=$n ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Customer]
       ]
       AS
-      Variable [ Name=customer ]
+      Variable [ Name=$customer ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=orders ]
+      Variable [ Name=$orders ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=orders ]
+            Variable [ Name=$orders ]
             Field=o_custkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_custkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_nationkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
             Field=n_nationkey
           ]
         ]
       ]
     Groupby
-      Variable [ Name=orderdate ]
+      Variable [ Name=$orderdate ]
       :=
       FieldAccessor [
-        Variable [ Name=orders ]
+        Variable [ Name=$orders ]
         Field=o_orderdate
       ]
-      Variable [ Name=nation_key ]
+      Variable [ Name=$nation_key ]
       :=
       FieldAccessor [
-        Variable [ Name=n ]
+        Variable [ Name=$n ]
         Field=n_nationkey
       ]
-      With
-      Variable [ Name=orders ]
-      Variable [ Name=n ]
-      Variable [ Name=customer ]
-      Variable [ Name=t ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$orders ]
+       AS orders
+      Variable [ Name=$customer ]
+       AS customer
+      Variable [ Name=$n ]
+       AS n
+      Variable [ Name=$t ]
+       AS t
+      )
 
-    LetVariable [ Name=sum ]
+    Let Variable [ Name=$sum ]
       :=
       FunctionCall tpch.sum@1[
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_totalprice
           ]
           ]
-          FROM [            Variable [ Name=orders ]
+          FROM [            Variable [ Name=$orders ]
             AS
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
           ]
         )
       ]
@@ -153,7 +160,7 @@
   (
     LiteralExpr [STRING] [nation_key]
     :
-    Variable [ Name=nation_key ]
+    Variable [ Name=$nation_key ]
   )
   (
     LiteralExpr [STRING] [sum_price]
@@ -165,7 +172,7 @@
           LiteralExpr [STRING] [orderdate]
           :
           FieldAccessor [
-            Variable [ Name=y ]
+            Variable [ Name=$y ]
             Field=order_date
           ]
         )
@@ -173,19 +180,19 @@
           LiteralExpr [STRING] [sum_price]
           :
           FieldAccessor [
-            Variable [ Name=y ]
+            Variable [ Name=$y ]
             Field=sum_price
           ]
         )
       ]
       ]
-      FROM [        Variable [ Name=x ]
+      FROM [        Variable [ Name=$x ]
         AS
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
       ]
       Orderby
         FieldAccessor [
-          Variable [ Name=y ]
+          Variable [ Name=$y ]
           Field=sum_price
         ]
         DESC
@@ -196,19 +203,25 @@
   )
 ]
 ]
-FROM [  Variable [ Name=X ]
+FROM [  Variable [ Name=$X ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Groupby
-  Variable [ Name=nation_key ]
+  Variable [ Name=$nation_key ]
   :=
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=nation_key
   ]
-  With
-  Variable [ Name=x ]
-  Variable [ Name=X ]
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$x ]
+   AS x
+  Variable [ Name=$X ]
+   AS X
+  Variable [ Name=$t ]
+   AS t
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue785/query-issue785.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue785/query-issue785.3.ast
index f69a6be..e59376e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue785/query-issue785.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue785/query-issue785.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [nation_key]
     :
-    Variable [ Name=nation_key ]
+    Variable [ Name=$nation_key ]
   )
   (
     LiteralExpr [STRING] [sum_price]
@@ -16,49 +16,57 @@
         (
           LiteralExpr [STRING] [orderdate]
           :
-          Variable [ Name=od ]
+          Variable [ Name=$od ]
         )
         (
           LiteralExpr [STRING] [sum_price]
           :
-          Variable [ Name=sum ]
+          Variable [ Name=$sum ]
         )
       ]
       ]
-      FROM [        Variable [ Name=x ]
+      FROM [        Variable [ Name=$x ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
       Groupby
-        Variable [ Name=od ]
+        Variable [ Name=$od ]
         :=
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=order_date
         ]
-        With
-        Variable [ Name=i ]
-        Variable [ Name=x ]
-        Variable [ Name=nation_key ]
+        GROUP AS
+        Variable [ Name=#3 ]
+        (
+        Variable [ Name=$i ]
+         AS i
+        Variable [ Name=$x ]
+         AS x
+        Variable [ Name=$nation_key ]
+         AS nation_key
+        Variable [ Name=#2 ]
+         AS #2
+        )
 
-      LetVariable [ Name=sum ]
+      Let Variable [ Name=$sum ]
         :=
         FunctionCall tpch.sum@1[
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=sum_price
             ]
             ]
-            FROM [              Variable [ Name=i ]
+            FROM [              Variable [ Name=$i ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
             ]
           )
         ]
       Orderby
-        Variable [ Name=sum ]
+        Variable [ Name=$sum ]
         DESC
 
       Limit
@@ -73,12 +81,12 @@
       (
         LiteralExpr [STRING] [nation_key]
         :
-        Variable [ Name=nation_key ]
+        Variable [ Name=$nation_key ]
       )
       (
         LiteralExpr [STRING] [order_date]
         :
-        Variable [ Name=orderdate ]
+        Variable [ Name=$orderdate ]
       )
       (
         LiteralExpr [STRING] [sum_price]
@@ -87,13 +95,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_totalprice
             ]
             ]
-            FROM [              Variable [ Name=orders ]
+            FROM [              Variable [ Name=$orders ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
             ]
           )
         ]
@@ -104,75 +112,85 @@
         LiteralExpr [STRING] [Nation]
       ]
       AS
-      Variable [ Name=n ]
+      Variable [ Name=$n ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Customer]
       ]
       AS
-      Variable [ Name=customer ]
+      Variable [ Name=$customer ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=orders ]
+      Variable [ Name=$orders ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=orders ]
+            Variable [ Name=$orders ]
             Field=o_custkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_custkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_nationkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
             Field=n_nationkey
           ]
         ]
       ]
     Groupby
-      Variable [ Name=orderdate ]
+      Variable [ Name=$orderdate ]
       :=
       FieldAccessor [
-        Variable [ Name=orders ]
+        Variable [ Name=$orders ]
         Field=o_orderdate
       ]
-      Variable [ Name=nation_key ]
+      Variable [ Name=$nation_key ]
       :=
       FieldAccessor [
-        Variable [ Name=n ]
+        Variable [ Name=$n ]
         Field=n_nationkey
       ]
-      With
-      Variable [ Name=orders ]
-      Variable [ Name=n ]
-      Variable [ Name=customer ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$orders ]
+       AS orders
+      Variable [ Name=$customer ]
+       AS customer
+      Variable [ Name=$n ]
+       AS n
+      )
 
   )
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Groupby
-  Variable [ Name=nation_key ]
+  Variable [ Name=$nation_key ]
   :=
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=nation_key
   ]
-  With
-  Variable [ Name=x ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$x ]
+   AS x
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue786/query-issue786.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue786/query-issue786.3.ast
index dcd0269..4cd1b1f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue786/query-issue786.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/query-issue786/query-issue786.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [nation_key]
     :
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_nationkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_name
     ]
   )
@@ -27,12 +27,12 @@
         (
           LiteralExpr [STRING] [order_date]
           :
-          Variable [ Name=orderdate ]
+          Variable [ Name=$orderdate ]
         )
         (
           LiteralExpr [STRING] [sum_price]
           :
-          Variable [ Name=sum ]
+          Variable [ Name=$sum ]
         )
       ]
       ]
@@ -40,71 +40,78 @@
           LiteralExpr [STRING] [Orders]
         ]
         AS
-        Variable [ Name=orders ]
+        Variable [ Name=$orders ]
 ,
         FunctionCall Metadata.dataset@1[
           LiteralExpr [STRING] [Customer]
         ]
         AS
-        Variable [ Name=customer ]
+        Variable [ Name=$customer ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=orders ]
+              Variable [ Name=$orders ]
               Field=o_custkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=customer ]
+              Variable [ Name=$customer ]
               Field=c_custkey
             ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=customer ]
+              Variable [ Name=$customer ]
               Field=c_nationkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=nation ]
+              Variable [ Name=$nation ]
               Field=n_nationkey
             ]
           ]
         ]
       Groupby
-        Variable [ Name=orderdate ]
+        Variable [ Name=$orderdate ]
         :=
         FieldAccessor [
-          Variable [ Name=orders ]
+          Variable [ Name=$orders ]
           Field=o_orderdate
         ]
-        With
-        Variable [ Name=orders ]
-        Variable [ Name=customer ]
-        Variable [ Name=nation ]
-        Variable [ Name=sn ]
+        GROUP AS
+        Variable [ Name=#1 ]
+        (
+        Variable [ Name=$customer ]
+         AS customer
+        Variable [ Name=$orders ]
+         AS orders
+        Variable [ Name=$sn ]
+         AS sn
+        Variable [ Name=$nation ]
+         AS nation
+        )
 
-      LetVariable [ Name=sum ]
+      Let Variable [ Name=$sum ]
         :=
         FunctionCall tpch.sum@1[
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_totalprice
             ]
             ]
-            FROM [              Variable [ Name=orders ]
+            FROM [              Variable [ Name=$orders ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
             ]
           )
         ]
       Orderby
-        Variable [ Name=sum ]
+        Variable [ Name=$sum ]
         DESC
 
       Limit
@@ -117,23 +124,23 @@
     LiteralExpr [STRING] [Nation]
   ]
   AS
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [SelectedNation]
   ]
   AS
-  Variable [ Name=sn ]
+  Variable [ Name=$sn ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_nationkey
     ]
     =
     FieldAccessor [
-      Variable [ Name=sn ]
+      Variable [ Name=$sn ]
       Field=sn_nationkey
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/distinct_by/distinct_by.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/distinct_by/distinct_by.3.ast
index b8d2c7f..1ffbc72 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/distinct_by/distinct_by.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/distinct_by/distinct_by.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [l_returnflag]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_returnflag
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [l_linestatus]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_linestatus
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [l_shipmode]
     :
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipmode
     ]
   )
@@ -32,21 +32,21 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_shipmode
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/group_no_agg/group_no_agg.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/group_no_agg/group_no_agg.3.ast
index 8a7df20..5a2efb6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/group_no_agg/group_no_agg.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/group_no_agg/group_no_agg.3.ast
@@ -1,25 +1,29 @@
 DataverseUse tpch
 Query:
 SELECT ELEMENT [
-Variable [ Name=name ]
+Variable [ Name=$name ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Regions_group_no_agg]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Groupby
-  Variable [ Name=name ]
+  Variable [ Name=$name ]
   :=
   FieldAccessor [
-    Variable [ Name=r ]
+    Variable [ Name=$r ]
     Field=r_name
   ]
-  With
-  Variable [ Name=r ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$r ]
+   AS r
+  )
 
 Orderby
-  Variable [ Name=name ]
+  Variable [ Name=$name ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/nest_aggregate/nest_aggregate.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/nest_aggregate/nest_aggregate.3.ast
index 47eea36..12d0a2e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/nest_aggregate/nest_aggregate.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/nest_aggregate/nest_aggregate.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [nation_key]
     :
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_nationkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_name
     ]
   )
@@ -27,12 +27,12 @@
         (
           LiteralExpr [STRING] [order_date]
           :
-          Variable [ Name=orderdate ]
+          Variable [ Name=$orderdate ]
         )
         (
           LiteralExpr [STRING] [sum_price]
           :
-          Variable [ Name=sum ]
+          Variable [ Name=$sum ]
         )
       ]
       ]
@@ -40,71 +40,78 @@
           LiteralExpr [STRING] [Orders]
         ]
         AS
-        Variable [ Name=orders ]
+        Variable [ Name=$orders ]
 ,
         FunctionCall Metadata.dataset@1[
           LiteralExpr [STRING] [Customer]
         ]
         AS
-        Variable [ Name=customer ]
+        Variable [ Name=$customer ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=orders ]
+              Variable [ Name=$orders ]
               Field=o_custkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=customer ]
+              Variable [ Name=$customer ]
               Field=c_custkey
             ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=customer ]
+              Variable [ Name=$customer ]
               Field=c_nationkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=nation ]
+              Variable [ Name=$nation ]
               Field=n_nationkey
             ]
           ]
         ]
       Groupby
-        Variable [ Name=orderdate ]
+        Variable [ Name=$orderdate ]
         :=
         FieldAccessor [
-          Variable [ Name=orders ]
+          Variable [ Name=$orders ]
           Field=o_orderdate
         ]
-        With
-        Variable [ Name=orders ]
-        Variable [ Name=customer ]
-        Variable [ Name=nation ]
-        Variable [ Name=sn ]
+        GROUP AS
+        Variable [ Name=#1 ]
+        (
+        Variable [ Name=$customer ]
+         AS customer
+        Variable [ Name=$orders ]
+         AS orders
+        Variable [ Name=$sn ]
+         AS sn
+        Variable [ Name=$nation ]
+         AS nation
+        )
 
-      LetVariable [ Name=sum ]
+      Let Variable [ Name=$sum ]
         :=
         FunctionCall tpch.sum@1[
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_totalprice
             ]
             ]
-            FROM [              Variable [ Name=orders ]
+            FROM [              Variable [ Name=$orders ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
             ]
           )
         ]
       Orderby
-        Variable [ Name=sum ]
+        Variable [ Name=$sum ]
         ASC
 
       Limit
@@ -117,29 +124,29 @@
     LiteralExpr [STRING] [Nation]
   ]
   AS
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [SelectedNation]
   ]
   AS
-  Variable [ Name=sn ]
+  Variable [ Name=$sn ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_nationkey
     ]
     =
     FieldAccessor [
-      Variable [ Name=sn ]
+      Variable [ Name=$sn ]
       Field=n_nationkey
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=nation ]
+    Variable [ Name=$nation ]
     Field=n_nationkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
index 40474c7..cafd221 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [sum_qty]
@@ -20,13 +20,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -38,13 +38,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -57,7 +57,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -65,15 +65,15 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -86,7 +86,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -94,7 +94,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -103,15 +103,15 @@
             LiteralExpr [LONG] [1]
             +
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_tax
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -123,13 +123,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -141,13 +141,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -159,13 +159,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -174,7 +174,18 @@
     LiteralExpr [STRING] [count_order]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=l ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -183,36 +194,40 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipdate
     ]
     <=
     LiteralExpr [STRING] [1998-09-02]
   ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
index 52df01f..bcdbaa0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
@@ -7,7 +7,7 @@
         LiteralExpr [STRING] [s_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_acctbal
         ]
       )
@@ -15,7 +15,7 @@
         LiteralExpr [STRING] [s_name]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_name
         ]
       )
@@ -23,7 +23,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=n_name
         ]
       )
@@ -31,7 +31,7 @@
         LiteralExpr [STRING] [p_partkey]
         :
         FieldAccessor [
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
           Field=p_partkey
         ]
       )
@@ -39,7 +39,7 @@
         LiteralExpr [STRING] [ps_supplycost]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=ps_supplycost
         ]
       )
@@ -47,7 +47,7 @@
         LiteralExpr [STRING] [p_mfgr]
         :
         FieldAccessor [
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
           Field=p_mfgr
         ]
       )
@@ -55,7 +55,7 @@
         LiteralExpr [STRING] [s_address]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_address
         ]
       )
@@ -63,7 +63,7 @@
         LiteralExpr [STRING] [s_phone]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_phone
         ]
       )
@@ -71,15 +71,15 @@
         LiteralExpr [STRING] [s_comment]
         :
         FieldAccessor [
-          Variable [ Name=pssrn ]
+          Variable [ Name=$pssrn ]
           Field=s_comment
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=Part ]
+    FROM [      Variable [ Name=$Part ]
       AS
-      Variable [ Name=p ]
+      Variable [ Name=$p ]
 ,
       (
         SELECT ELEMENT [
@@ -88,7 +88,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=n_name
             ]
           )
@@ -96,7 +96,7 @@
             LiteralExpr [STRING] [p_partkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_partkey
             ]
           )
@@ -104,7 +104,7 @@
             LiteralExpr [STRING] [ps_supplycost]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_supplycost
             ]
           )
@@ -112,7 +112,7 @@
             LiteralExpr [STRING] [s_name]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_name
             ]
           )
@@ -120,7 +120,7 @@
             LiteralExpr [STRING] [s_acctbal]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_acctbal
             ]
           )
@@ -128,7 +128,7 @@
             LiteralExpr [STRING] [s_address]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_address
             ]
           )
@@ -136,7 +136,7 @@
             LiteralExpr [STRING] [s_phone]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_phone
             ]
           )
@@ -144,15 +144,15 @@
             LiteralExpr [STRING] [s_comment]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_comment
             ]
           )
         ]
         ]
-        FROM [          Variable [ Name=Partsupp ]
+        FROM [          Variable [ Name=$Partsupp ]
           AS
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
 ,
           (
             SELECT ELEMENT [
@@ -161,7 +161,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -169,7 +169,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=rn ]
+                  Variable [ Name=$rn ]
                   Field=n_name
                 ]
               )
@@ -177,7 +177,7 @@
                 LiteralExpr [STRING] [s_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_name
                 ]
               )
@@ -185,7 +185,7 @@
                 LiteralExpr [STRING] [s_acctbal]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_acctbal
                 ]
               )
@@ -193,7 +193,7 @@
                 LiteralExpr [STRING] [s_address]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_address
                 ]
               )
@@ -201,7 +201,7 @@
                 LiteralExpr [STRING] [s_phone]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_phone
                 ]
               )
@@ -209,15 +209,15 @@
                 LiteralExpr [STRING] [s_comment]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_comment
                 ]
               )
             ]
             ]
-            FROM [              Variable [ Name=Supplier ]
+            FROM [              Variable [ Name=$Supplier ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
 ,
               (
                 SELECT ELEMENT [
@@ -226,7 +226,7 @@
                     LiteralExpr [STRING] [n_nationkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_nationkey
                     ]
                   )
@@ -234,37 +234,37 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_name
                     ]
                   )
                 ]
                 ]
-                FROM [                  Variable [ Name=Region ]
+                FROM [                  Variable [ Name=$Region ]
                   AS
-                  Variable [ Name=r ]
+                  Variable [ Name=$r ]
 ,
-                  Variable [ Name=Nation ]
+                  Variable [ Name=$Nation ]
                   AS
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
                 ]
                 Where
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=n ]
+                        Variable [ Name=$n ]
                         Field=n_regionkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_regionkey
                       ]
                     ]
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_name
                       ]
                       =
@@ -273,57 +273,57 @@
                   ]
               )
               AS
-              Variable [ Name=rn ]
+              Variable [ Name=$rn ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=rn ]
+                  Variable [ Name=$rn ]
                   Field=n_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=srn ]
+          Variable [ Name=$srn ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=pssrn ]
+      Variable [ Name=$pssrn ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=pssrn ]
+            Variable [ Name=$pssrn ]
             Field=p_partkey
           ]
         ]
         and
         FunctionCall tpch.like@2[
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_type
           ]
           LiteralExpr [STRING] [%BRASS]
@@ -339,7 +339,7 @@
       (
         LiteralExpr [STRING] [p_partkey]
         :
-        Variable [ Name=p_partkey ]
+        Variable [ Name=$p_partkey ]
       )
       (
         LiteralExpr [STRING] [ps_min_supplycost]
@@ -348,22 +348,22 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=ps_supplycost
             ]
             ]
-            FROM [              Variable [ Name=pssrn ]
+            FROM [              Variable [ Name=$pssrn ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=Part ]
+    FROM [      Variable [ Name=$Part ]
       AS
-      Variable [ Name=p ]
+      Variable [ Name=$p ]
 ,
       (
         SELECT ELEMENT [
@@ -372,7 +372,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=n_name
             ]
           )
@@ -380,7 +380,7 @@
             LiteralExpr [STRING] [p_partkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_partkey
             ]
           )
@@ -388,7 +388,7 @@
             LiteralExpr [STRING] [ps_supplycost]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_supplycost
             ]
           )
@@ -396,7 +396,7 @@
             LiteralExpr [STRING] [s_name]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_name
             ]
           )
@@ -404,7 +404,7 @@
             LiteralExpr [STRING] [s_acctbal]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_acctbal
             ]
           )
@@ -412,7 +412,7 @@
             LiteralExpr [STRING] [s_address]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_address
             ]
           )
@@ -420,7 +420,7 @@
             LiteralExpr [STRING] [s_phone]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_phone
             ]
           )
@@ -428,15 +428,15 @@
             LiteralExpr [STRING] [s_comment]
             :
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_comment
             ]
           )
         ]
         ]
-        FROM [          Variable [ Name=Partsupp ]
+        FROM [          Variable [ Name=$Partsupp ]
           AS
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
 ,
           (
             SELECT ELEMENT [
@@ -445,7 +445,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -453,7 +453,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=rn ]
+                  Variable [ Name=$rn ]
                   Field=n_name
                 ]
               )
@@ -461,7 +461,7 @@
                 LiteralExpr [STRING] [s_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_name
                 ]
               )
@@ -469,7 +469,7 @@
                 LiteralExpr [STRING] [s_acctbal]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_acctbal
                 ]
               )
@@ -477,7 +477,7 @@
                 LiteralExpr [STRING] [s_address]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_address
                 ]
               )
@@ -485,7 +485,7 @@
                 LiteralExpr [STRING] [s_phone]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_phone
                 ]
               )
@@ -493,15 +493,15 @@
                 LiteralExpr [STRING] [s_comment]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_comment
                 ]
               )
             ]
             ]
-            FROM [              Variable [ Name=Supplier ]
+            FROM [              Variable [ Name=$Supplier ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
 ,
               (
                 SELECT ELEMENT [
@@ -510,7 +510,7 @@
                     LiteralExpr [STRING] [n_nationkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_nationkey
                     ]
                   )
@@ -518,37 +518,37 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_name
                     ]
                   )
                 ]
                 ]
-                FROM [                  Variable [ Name=Region ]
+                FROM [                  Variable [ Name=$Region ]
                   AS
-                  Variable [ Name=r ]
+                  Variable [ Name=$r ]
 ,
-                  Variable [ Name=Nation ]
+                  Variable [ Name=$Nation ]
                   AS
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
                 ]
                 Where
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=n ]
+                        Variable [ Name=$n ]
                         Field=n_regionkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_regionkey
                       ]
                     ]
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=r ]
+                        Variable [ Name=$r ]
                         Field=r_name
                       ]
                       =
@@ -557,67 +557,67 @@
                   ]
               )
               AS
-              Variable [ Name=rn ]
+              Variable [ Name=$rn ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=rn ]
+                  Variable [ Name=$rn ]
                   Field=n_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=srn ]
+          Variable [ Name=$srn ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=srn ]
+              Variable [ Name=$srn ]
               Field=s_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=pssrn ]
+      Variable [ Name=$pssrn ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=pssrn ]
+            Variable [ Name=$pssrn ]
             Field=p_partkey
           ]
         ]
         and
         FunctionCall tpch.like@2[
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_type
           ]
           LiteralExpr [STRING] [%BRASS]
         ]
       ]
     Groupby
-      Variable [ Name=p_partkey ]
+      Variable [ Name=$p_partkey ]
       :=
       FieldAccessor [
-        Variable [ Name=pssrn ]
+        Variable [ Name=$pssrn ]
         Field=p_partkey
       ]
 
@@ -631,7 +631,7 @@
     LiteralExpr [STRING] [s_acctbal]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_acctbal
     ]
   )
@@ -639,7 +639,7 @@
     LiteralExpr [STRING] [s_name]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_name
     ]
   )
@@ -647,7 +647,7 @@
     LiteralExpr [STRING] [n_name]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=n_name
     ]
   )
@@ -655,7 +655,7 @@
     LiteralExpr [STRING] [p_partkey]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=p_partkey
     ]
   )
@@ -663,7 +663,7 @@
     LiteralExpr [STRING] [p_mfgr]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=p_mfgr
     ]
   )
@@ -671,7 +671,7 @@
     LiteralExpr [STRING] [s_address]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_address
     ]
   )
@@ -679,7 +679,7 @@
     LiteralExpr [STRING] [s_phone]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_phone
     ]
   )
@@ -687,7 +687,7 @@
     LiteralExpr [STRING] [s_comment]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=s_comment
     ]
   )
@@ -696,57 +696,57 @@
 FROM [  FunctionCall tpch.tmp2@0[
   ]
   AS
-  Variable [ Name=t2 ]
+  Variable [ Name=$t2 ]
 ,
   FunctionCall tpch.tmp1@0[
   ]
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=p_partkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=p_partkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t1 ]
+        Variable [ Name=$t1 ]
         Field=ps_supplycost
       ]
       =
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=ps_min_supplycost
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=s_acctbal
   ]
   DESC
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=n_name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=s_name
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=p_partkey
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
index 8193892..5bb4ef8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
@@ -5,22 +5,22 @@
   (
     LiteralExpr [STRING] [l_orderkey]
     :
-    Variable [ Name=l_orderkey ]
+    Variable [ Name=$l_orderkey ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
   (
     LiteralExpr [STRING] [o_orderdate]
     :
-    Variable [ Name=o_orderdate ]
+    Variable [ Name=$o_orderdate ]
   )
   (
     LiteralExpr [STRING] [o_shippriority]
     :
-    Variable [ Name=o_shippriority ]
+    Variable [ Name=$o_shippriority ]
   )
 ]
 ]
@@ -28,26 +28,26 @@
     LiteralExpr [STRING] [Customer]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_mktsegment
         ]
         =
@@ -56,12 +56,12 @@
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_custkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_custkey
         ]
       ]
@@ -70,19 +70,19 @@
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_orderkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderkey
         ]
       ]
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderdate
         ]
         <
@@ -91,7 +91,7 @@
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_shipdate
         ]
         >
@@ -100,37 +100,43 @@
     ]
   ]
 Groupby
-  Variable [ Name=l_orderkey ]
+  Variable [ Name=$l_orderkey ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_orderkey
   ]
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderdate
   ]
-  Variable [ Name=o_shippriority ]
+  Variable [ Name=$o_shippriority ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_shippriority
   ]
-  With
-  Variable [ Name=c ]
-  Variable [ Name=l ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  Variable [ Name=$o ]
+   AS o
+  Variable [ Name=$c ]
+   AS c
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -138,22 +144,22 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=l ]
+      FROM [        Variable [ Name=$l ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   ASC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q04_order_priority/q04_order_priority.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q04_order_priority/q04_order_priority.3.ast
index 2f4234e..b9aa68f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q04_order_priority/q04_order_priority.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q04_order_priority/q04_order_priority.3.ast
@@ -7,25 +7,25 @@
         LiteralExpr [STRING] [o_orderkey]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_orderkey
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=LineItem ]
+    FROM [      Variable [ Name=$LineItem ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_commitdate
         ]
         <
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_receiptdate
         ]
       ]
@@ -38,13 +38,24 @@
   (
     LiteralExpr [STRING] [order_priority]
     :
-    Variable [ Name=o_orderpriority ]
+    Variable [ Name=$o_orderpriority ]
   )
   (
     LiteralExpr [STRING] [count]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=o ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=o
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -53,21 +64,21 @@
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
   INNER JOIN
     FunctionCall tpch.tmp@0[
     ]
     AS
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     ON
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=o_orderkey
       ]
     ]
@@ -76,7 +87,7 @@
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderdate
       ]
       >=
@@ -85,7 +96,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderdate
       ]
       <
@@ -93,17 +104,22 @@
     ]
   ]
 Groupby
-  Variable [ Name=o_orderpriority ]
+  Variable [ Name=$o_orderpriority ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderpriority
   ]
-  With
-  Variable [ Name=t ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  Variable [ Name=$o ]
+   AS o
+  )
 
 Orderby
-  Variable [ Name=o_orderpriority ]
+  Variable [ Name=$o_orderpriority ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q05_local_supplier_volume/q05_local_supplier_volume.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
index 2b505fb..92d992a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [n_name]
     :
-    Variable [ Name=n_name ]
+    Variable [ Name=$n_name ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
 ]
 ]
@@ -18,7 +18,7 @@
     LiteralExpr [STRING] [Customer]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   (
     SELECT ELEMENT [
@@ -27,7 +27,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=n_name
         ]
       )
@@ -35,7 +35,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_extendedprice
         ]
       )
@@ -43,7 +43,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_discount
         ]
       )
@@ -51,7 +51,7 @@
         LiteralExpr [STRING] [s_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=s_nationkey
         ]
       )
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [o_custkey]
         :
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_custkey
         ]
       )
@@ -69,7 +69,7 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
 ,
       (
         SELECT ELEMENT [
@@ -78,7 +78,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=n_name
             ]
           )
@@ -86,7 +86,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_extendedprice
             ]
           )
@@ -94,7 +94,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_discount
             ]
           )
@@ -102,7 +102,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_orderkey
             ]
           )
@@ -110,7 +110,7 @@
             LiteralExpr [STRING] [s_nationkey]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=s_nationkey
             ]
           )
@@ -120,7 +120,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
 ,
           (
             SELECT ELEMENT [
@@ -129,7 +129,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=n1 ]
+                  Variable [ Name=$n1 ]
                   Field=n_name
                 ]
               )
@@ -137,7 +137,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -145,7 +145,7 @@
                 LiteralExpr [STRING] [s_nationkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
               )
@@ -155,7 +155,7 @@
                 LiteralExpr [STRING] [Supplier]
               ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
 ,
               (
                 SELECT ELEMENT [
@@ -164,7 +164,7 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_name
                     ]
                   )
@@ -172,7 +172,7 @@
                     LiteralExpr [STRING] [n_nationkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_nationkey
                     ]
                   )
@@ -182,79 +182,79 @@
                     LiteralExpr [STRING] [Nation]
                   ]
                   AS
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
 ,
                   FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [Region]
                   ]
                   AS
-                  Variable [ Name=r ]
+                  Variable [ Name=$r ]
                 ]
                 Where
                   OperatorExpr [
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_regionkey
                     ]
                     =
                     FieldAccessor [
-                      Variable [ Name=r ]
+                      Variable [ Name=$r ]
                       Field=r_regionkey
                     ]
                   ]
               )
               AS
-              Variable [ Name=n1 ]
+              Variable [ Name=$n1 ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=n1 ]
+                  Variable [ Name=$n1 ]
                   Field=n_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=s1 ]
+          Variable [ Name=$s1 ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=s_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=l1 ]
+      Variable [ Name=$l1 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l1 ]
+            Variable [ Name=$l1 ]
             Field=l_orderkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderdate
           ]
           >=
@@ -263,7 +263,7 @@
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderdate
           ]
           <
@@ -272,53 +272,58 @@
       ]
   )
   AS
-  Variable [ Name=o1 ]
+  Variable [ Name=$o1 ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_nationkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=s_nationkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_custkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o1 ]
+        Variable [ Name=$o1 ]
         Field=o_custkey
       ]
     ]
   ]
 Groupby
-  Variable [ Name=n_name ]
+  Variable [ Name=$n_name ]
   :=
   FieldAccessor [
-    Variable [ Name=o1 ]
+    Variable [ Name=$o1 ]
     Field=n_name
   ]
-  With
-  Variable [ Name=o1 ]
-  Variable [ Name=c ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$o1 ]
+   AS o1
+  Variable [ Name=$c ]
+   AS c
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -326,19 +331,19 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=o1 ]
+      FROM [        Variable [ Name=$o1 ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast
index f802e5e..592238f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast
@@ -9,12 +9,12 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_extendedprice
           ]
           *
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_discount
           ]
         ]
@@ -23,13 +23,13 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipdate
               ]
               >=
@@ -38,7 +38,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipdate
               ]
               <
@@ -47,7 +47,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_discount
               ]
               >=
@@ -56,7 +56,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_discount
               ]
               <=
@@ -65,7 +65,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               <
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q07_volume_shipping/q07_volume_shipping.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q07_volume_shipping/q07_volume_shipping.3.ast
index deed492..ac8fbda 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q07_volume_shipping/q07_volume_shipping.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q07_volume_shipping/q07_volume_shipping.3.ast
@@ -7,7 +7,7 @@
         LiteralExpr [STRING] [supp_nation]
         :
         FieldAccessor [
-          Variable [ Name=n1 ]
+          Variable [ Name=$n1 ]
           Field=n_name
         ]
       )
@@ -15,7 +15,7 @@
         LiteralExpr [STRING] [cust_nation]
         :
         FieldAccessor [
-          Variable [ Name=n2 ]
+          Variable [ Name=$n2 ]
           Field=n_name
         ]
       )
@@ -23,7 +23,7 @@
         LiteralExpr [STRING] [s_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=n1 ]
+          Variable [ Name=$n1 ]
           Field=n_nationkey
         ]
       )
@@ -31,25 +31,25 @@
         LiteralExpr [STRING] [c_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=n2 ]
+          Variable [ Name=$n2 ]
           Field=n_nationkey
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=Nation ]
+    FROM [      Variable [ Name=$Nation ]
       AS
-      Variable [ Name=n1 ]
+      Variable [ Name=$n1 ]
 ,
-      Variable [ Name=Nation ]
+      Variable [ Name=$Nation ]
       AS
-      Variable [ Name=n2 ]
+      Variable [ Name=$n2 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=n2 ]
+            Variable [ Name=$n2 ]
             Field=n_name
           ]
           =
@@ -58,7 +58,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=n1 ]
+            Variable [ Name=$n1 ]
             Field=n_name
           ]
           =
@@ -74,22 +74,22 @@
   (
     LiteralExpr [STRING] [supp_nation]
     :
-    Variable [ Name=supp_nation ]
+    Variable [ Name=$supp_nation ]
   )
   (
     LiteralExpr [STRING] [cust_nation]
     :
-    Variable [ Name=cust_nation ]
+    Variable [ Name=$cust_nation ]
   )
   (
     LiteralExpr [STRING] [l_year]
     :
-    Variable [ Name=l_year ]
+    Variable [ Name=$l_year ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
 ]
 ]
@@ -100,7 +100,7 @@
         LiteralExpr [STRING] [l_shipdate]
         :
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=l_shipdate
         ]
       )
@@ -108,7 +108,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=l_extendedprice
         ]
       )
@@ -116,7 +116,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=l_discount
         ]
       )
@@ -124,7 +124,7 @@
         LiteralExpr [STRING] [c_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=c_nationkey
         ]
       )
@@ -132,7 +132,7 @@
         LiteralExpr [STRING] [s_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_nationkey
         ]
       )
@@ -145,7 +145,7 @@
             LiteralExpr [STRING] [l_shipdate]
             :
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=l_shipdate
             ]
           )
@@ -153,7 +153,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=l_extendedprice
             ]
           )
@@ -161,7 +161,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=l_discount
             ]
           )
@@ -169,7 +169,7 @@
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=l_suppkey
             ]
           )
@@ -177,7 +177,7 @@
             LiteralExpr [STRING] [c_nationkey]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_nationkey
             ]
           )
@@ -190,7 +190,7 @@
                 LiteralExpr [STRING] [l_shipdate]
                 :
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_shipdate
                 ]
               )
@@ -198,7 +198,7 @@
                 LiteralExpr [STRING] [l_extendedprice]
                 :
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_extendedprice
                 ]
               )
@@ -206,7 +206,7 @@
                 LiteralExpr [STRING] [l_discount]
                 :
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_discount
                 ]
               )
@@ -214,7 +214,7 @@
                 LiteralExpr [STRING] [l_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                   Field=l_suppkey
                 ]
               )
@@ -222,7 +222,7 @@
                 LiteralExpr [STRING] [o_custkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_custkey
                 ]
               )
@@ -232,31 +232,31 @@
                 LiteralExpr [STRING] [LineItem]
               ]
               AS
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
 ,
               FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Orders]
               ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
             ]
             Where
               OperatorExpr [
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=o ]
+                    Variable [ Name=$o ]
                     Field=o_orderkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l ]
+                    Variable [ Name=$l ]
                     Field=l_orderkey
                   ]
                 ]
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=l ]
+                    Variable [ Name=$l ]
                     Field=l_shipdate
                   ]
                   >=
@@ -265,7 +265,7 @@
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=l ]
+                    Variable [ Name=$l ]
                     Field=l_shipdate
                   ]
                   <=
@@ -274,62 +274,62 @@
               ]
           )
           AS
-          Variable [ Name=lo ]
+          Variable [ Name=$lo ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Customer]
           ]
           AS
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_custkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=lo ]
+              Variable [ Name=$lo ]
               Field=o_custkey
             ]
           ]
       )
       AS
-      Variable [ Name=loc ]
+      Variable [ Name=$loc ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Supplier]
       ]
       AS
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_suppkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=loc ]
+          Variable [ Name=$loc ]
           Field=l_suppkey
         ]
       ]
   )
   AS
-  Variable [ Name=locs ]
+  Variable [ Name=$locs ]
 ,
   FunctionCall tpch.q7_volume_shipping_tmp@0[
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
-LetVariable [ Name=l_year0 ]
+Let Variable [ Name=$l_year0 ]
   :=
   FunctionCall tpch.get-year@1[
     FieldAccessor [
-      Variable [ Name=locs ]
+      Variable [ Name=$locs ]
       Field=l_shipdate
     ]
   ]
@@ -337,57 +337,63 @@
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=locs ]
+        Variable [ Name=$locs ]
         Field=c_nationkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=c_nationkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=locs ]
+        Variable [ Name=$locs ]
         Field=s_nationkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=s_nationkey
       ]
     ]
   ]
 Groupby
-  Variable [ Name=supp_nation ]
+  Variable [ Name=$supp_nation ]
   :=
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=supp_nation
   ]
-  Variable [ Name=cust_nation ]
+  Variable [ Name=$cust_nation ]
   :=
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=cust_nation
   ]
-  Variable [ Name=l_year ]
+  Variable [ Name=$l_year ]
   :=
-  Variable [ Name=l_year0 ]
-  With
-  Variable [ Name=l_year0 ]
-  Variable [ Name=locs ]
-  Variable [ Name=t ]
+  Variable [ Name=$l_year0 ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l_year0 ]
+   AS l_year0
+  Variable [ Name=$t ]
+   AS t
+  Variable [ Name=$locs ]
+   AS locs
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -395,23 +401,23 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=locs ]
+      FROM [        Variable [ Name=$locs ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=supp_nation ]
+  Variable [ Name=$supp_nation ]
   ASC
-  Variable [ Name=cust_nation ]
+  Variable [ Name=$cust_nation ]
   ASC
-  Variable [ Name=l_year ]
+  Variable [ Name=$l_year ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.ast
index f6dbd18..eca3549 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [year]
     :
-    Variable [ Name=year ]
+    Variable [ Name=$year ]
   )
   (
     LiteralExpr [STRING] [mkt_share]
@@ -17,7 +17,7 @@
           FunctionCall tpch.switch-case@5[
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=s_name
               ]
               =
@@ -25,16 +25,16 @@
             ]
             LiteralExpr [TRUE]
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=revenue
             ]
             LiteralExpr [FALSE]
             LiteralExpr [DOUBLE] [0.0]
           ]
           ]
-          FROM [            Variable [ Name=t ]
+          FROM [            Variable [ Name=$t ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -43,13 +43,13 @@
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=revenue
           ]
           ]
-          FROM [            Variable [ Name=t ]
+          FROM [            Variable [ Name=$t ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -63,14 +63,14 @@
       (
         LiteralExpr [STRING] [year]
         :
-        Variable [ Name=o_year ]
+        Variable [ Name=$o_year ]
       )
       (
         LiteralExpr [STRING] [revenue]
         :
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=slnrcop ]
+            Variable [ Name=$slnrcop ]
             Field=l_extendedprice
           ]
           *
@@ -78,7 +78,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=slnrcop ]
+              Variable [ Name=$slnrcop ]
               Field=l_discount
             ]
           ]
@@ -88,7 +88,7 @@
         LiteralExpr [STRING] [s_name]
         :
         FieldAccessor [
-          Variable [ Name=n2 ]
+          Variable [ Name=$n2 ]
           Field=n_name
         ]
       )
@@ -101,7 +101,7 @@
             LiteralExpr [STRING] [o_orderdate]
             :
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=o_orderdate
             ]
           )
@@ -109,7 +109,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=l_discount
             ]
           )
@@ -117,7 +117,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=l_extendedprice
             ]
           )
@@ -125,7 +125,7 @@
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=l_suppkey
             ]
           )
@@ -133,7 +133,7 @@
             LiteralExpr [STRING] [s_nationkey]
             :
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_nationkey
             ]
           )
@@ -143,7 +143,7 @@
             LiteralExpr [STRING] [Supplier]
           ]
           AS
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
 ,
           (
             SELECT ELEMENT [
@@ -152,7 +152,7 @@
                 LiteralExpr [STRING] [o_orderdate]
                 :
                 FieldAccessor [
-                  Variable [ Name=lnrco ]
+                  Variable [ Name=$lnrco ]
                   Field=o_orderdate
                 ]
               )
@@ -160,7 +160,7 @@
                 LiteralExpr [STRING] [l_discount]
                 :
                 FieldAccessor [
-                  Variable [ Name=lnrco ]
+                  Variable [ Name=$lnrco ]
                   Field=l_discount
                 ]
               )
@@ -168,7 +168,7 @@
                 LiteralExpr [STRING] [l_extendedprice]
                 :
                 FieldAccessor [
-                  Variable [ Name=lnrco ]
+                  Variable [ Name=$lnrco ]
                   Field=l_extendedprice
                 ]
               )
@@ -176,7 +176,7 @@
                 LiteralExpr [STRING] [l_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=lnrco ]
+                  Variable [ Name=$lnrco ]
                   Field=l_suppkey
                 ]
               )
@@ -189,7 +189,7 @@
                     LiteralExpr [STRING] [o_orderdate]
                     :
                     FieldAccessor [
-                      Variable [ Name=nrco ]
+                      Variable [ Name=$nrco ]
                       Field=o_orderdate
                     ]
                   )
@@ -197,7 +197,7 @@
                     LiteralExpr [STRING] [l_partkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_partkey
                     ]
                   )
@@ -205,7 +205,7 @@
                     LiteralExpr [STRING] [l_discount]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_discount
                     ]
                   )
@@ -213,7 +213,7 @@
                     LiteralExpr [STRING] [l_extendedprice]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_extendedprice
                     ]
                   )
@@ -221,7 +221,7 @@
                     LiteralExpr [STRING] [l_suppkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_suppkey
                     ]
                   )
@@ -231,7 +231,7 @@
                     LiteralExpr [STRING] [LineItem]
                   ]
                   AS
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
 ,
                   (
                     SELECT ELEMENT [
@@ -240,7 +240,7 @@
                         LiteralExpr [STRING] [o_orderdate]
                         :
                         FieldAccessor [
-                          Variable [ Name=o ]
+                          Variable [ Name=$o ]
                           Field=o_orderdate
                         ]
                       )
@@ -248,7 +248,7 @@
                         LiteralExpr [STRING] [o_orderkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=o ]
+                          Variable [ Name=$o ]
                           Field=o_orderkey
                         ]
                       )
@@ -258,7 +258,7 @@
                         LiteralExpr [STRING] [Orders]
                       ]
                       AS
-                      Variable [ Name=o ]
+                      Variable [ Name=$o ]
 ,
                       (
                         SELECT ELEMENT [
@@ -267,7 +267,7 @@
                             LiteralExpr [STRING] [c_custkey]
                             :
                             FieldAccessor [
-                              Variable [ Name=c ]
+                              Variable [ Name=$c ]
                               Field=c_custkey
                             ]
                           )
@@ -277,7 +277,7 @@
                             LiteralExpr [STRING] [Customer]
                           ]
                           AS
-                          Variable [ Name=c ]
+                          Variable [ Name=$c ]
 ,
                           (
                             SELECT ELEMENT [
@@ -286,7 +286,7 @@
                                 LiteralExpr [STRING] [n_nationkey]
                                 :
                                 FieldAccessor [
-                                  Variable [ Name=n1 ]
+                                  Variable [ Name=$n1 ]
                                   Field=n_nationkey
                                 ]
                               )
@@ -296,31 +296,31 @@
                                 LiteralExpr [STRING] [Nation]
                               ]
                               AS
-                              Variable [ Name=n1 ]
+                              Variable [ Name=$n1 ]
 ,
                               FunctionCall Metadata.dataset@1[
                                 LiteralExpr [STRING] [Region]
                               ]
                               AS
-                              Variable [ Name=r1 ]
+                              Variable [ Name=$r1 ]
                             ]
                             Where
                               OperatorExpr [
                                 OperatorExpr [
                                   FieldAccessor [
-                                    Variable [ Name=n1 ]
+                                    Variable [ Name=$n1 ]
                                     Field=n_regionkey
                                   ]
                                   =
                                   FieldAccessor [
-                                    Variable [ Name=r1 ]
+                                    Variable [ Name=$r1 ]
                                     Field=r_regionkey
                                   ]
                                 ]
                                 and
                                 OperatorExpr [
                                   FieldAccessor [
-                                    Variable [ Name=r1 ]
+                                    Variable [ Name=$r1 ]
                                     Field=r_name
                                   ]
                                   =
@@ -329,57 +329,57 @@
                               ]
                           )
                           AS
-                          Variable [ Name=nr ]
+                          Variable [ Name=$nr ]
                         ]
                         Where
                           OperatorExpr [
                             FieldAccessor [
-                              Variable [ Name=c ]
+                              Variable [ Name=$c ]
                               Field=c_nationkey
                             ]
                             =
                             FieldAccessor [
-                              Variable [ Name=nr ]
+                              Variable [ Name=$nr ]
                               Field=n_nationkey
                             ]
                           ]
                       )
                       AS
-                      Variable [ Name=nrc ]
+                      Variable [ Name=$nrc ]
                     ]
                     Where
                       OperatorExpr [
                         FieldAccessor [
-                          Variable [ Name=nrc ]
+                          Variable [ Name=$nrc ]
                           Field=c_custkey
                         ]
                         =
                         FieldAccessor [
-                          Variable [ Name=o ]
+                          Variable [ Name=$o ]
                           Field=o_custkey
                         ]
                       ]
                   )
                   AS
-                  Variable [ Name=nrco ]
+                  Variable [ Name=$nrco ]
                 ]
                 Where
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=l ]
+                        Variable [ Name=$l ]
                         Field=l_orderkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=nrco ]
+                        Variable [ Name=$nrco ]
                         Field=o_orderkey
                       ]
                     ]
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=nrco ]
+                        Variable [ Name=$nrco ]
                         Field=o_orderdate
                       ]
                       >=
@@ -388,7 +388,7 @@
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=nrco ]
+                        Variable [ Name=$nrco ]
                         Field=o_orderdate
                       ]
                       <
@@ -397,31 +397,31 @@
                   ]
               )
               AS
-              Variable [ Name=lnrco ]
+              Variable [ Name=$lnrco ]
 ,
               FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Part]
               ]
               AS
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
             ]
             Where
               OperatorExpr [
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=p ]
+                    Variable [ Name=$p ]
                     Field=p_partkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=lnrco ]
+                    Variable [ Name=$lnrco ]
                     Field=l_partkey
                   ]
                 ]
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=p ]
+                    Variable [ Name=$p ]
                     Field=p_type
                   ]
                   =
@@ -430,65 +430,69 @@
               ]
           )
           AS
-          Variable [ Name=lnrcop ]
+          Variable [ Name=$lnrcop ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_suppkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=lnrcop ]
+              Variable [ Name=$lnrcop ]
               Field=l_suppkey
             ]
           ]
       )
       AS
-      Variable [ Name=slnrcop ]
+      Variable [ Name=$slnrcop ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Nation]
       ]
       AS
-      Variable [ Name=n2 ]
+      Variable [ Name=$n2 ]
     ]
-    LetVariable [ Name=o_year ]
+    Let Variable [ Name=$o_year ]
       :=
       FunctionCall tpch.get-year@1[
         FieldAccessor [
-          Variable [ Name=slnrcop ]
+          Variable [ Name=$slnrcop ]
           Field=o_orderdate
         ]
       ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=slnrcop ]
+          Variable [ Name=$slnrcop ]
           Field=s_nationkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=n2 ]
+          Variable [ Name=$n2 ]
           Field=n_nationkey
         ]
       ]
   )
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Groupby
-  Variable [ Name=year ]
+  Variable [ Name=$year ]
   :=
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=year
   ]
-  With
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t ]
+   AS t
+  )
 
 Orderby
-  Variable [ Name=year ]
+  Variable [ Name=$year ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
index 2472739..f0b946e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [nation]
     :
-    Variable [ Name=nation ]
+    Variable [ Name=$nation ]
   )
   (
     LiteralExpr [STRING] [o_year]
     :
-    Variable [ Name=o_year ]
+    Variable [ Name=$o_year ]
   )
   (
     LiteralExpr [STRING] [sum_profit]
@@ -19,13 +19,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=pr ]
+          Variable [ Name=$pr ]
           Field=amount
         ]
         ]
-        FROM [          Variable [ Name=profit ]
+        FROM [          Variable [ Name=$profit ]
           AS
-          Variable [ Name=pr ]
+          Variable [ Name=$pr ]
         ]
       )
     ]
@@ -39,19 +39,19 @@
         LiteralExpr [STRING] [nation]
         :
         FieldAccessor [
-          Variable [ Name=l3 ]
+          Variable [ Name=$l3 ]
           Field=n_name
         ]
       )
       (
         LiteralExpr [STRING] [o_year]
         :
-        Variable [ Name=o_year ]
+        Variable [ Name=$o_year ]
       )
       (
         LiteralExpr [STRING] [amount]
         :
-        Variable [ Name=amount ]
+        Variable [ Name=$amount ]
       )
     ]
     ]
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
 ,
       (
         SELECT ELEMENT [
@@ -68,7 +68,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_extendedprice
             ]
           )
@@ -76,7 +76,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_discount
             ]
           )
@@ -84,7 +84,7 @@
             LiteralExpr [STRING] [l_quantity]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_quantity
             ]
           )
@@ -92,7 +92,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_orderkey
             ]
           )
@@ -100,7 +100,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=n_name
             ]
           )
@@ -108,7 +108,7 @@
             LiteralExpr [STRING] [ps_supplycost]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=ps_supplycost
             ]
           )
@@ -118,7 +118,7 @@
             LiteralExpr [STRING] [Part]
           ]
           AS
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
           INNER JOIN
             (
               SELECT ELEMENT [
@@ -127,7 +127,7 @@
                   LiteralExpr [STRING] [l_extendedprice]
                   :
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_extendedprice
                   ]
                 )
@@ -135,7 +135,7 @@
                   LiteralExpr [STRING] [l_discount]
                   :
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_discount
                   ]
                 )
@@ -143,7 +143,7 @@
                   LiteralExpr [STRING] [l_quantity]
                   :
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_quantity
                   ]
                 )
@@ -151,7 +151,7 @@
                   LiteralExpr [STRING] [l_partkey]
                   :
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_partkey
                   ]
                 )
@@ -159,7 +159,7 @@
                   LiteralExpr [STRING] [l_orderkey]
                   :
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_orderkey
                   ]
                 )
@@ -167,7 +167,7 @@
                   LiteralExpr [STRING] [n_name]
                   :
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=n_name
                   ]
                 )
@@ -175,7 +175,7 @@
                   LiteralExpr [STRING] [ps_supplycost]
                   :
                   FieldAccessor [
-                    Variable [ Name=ps ]
+                    Variable [ Name=$ps ]
                     Field=ps_supplycost
                   ]
                 )
@@ -185,7 +185,7 @@
                   LiteralExpr [STRING] [Partsupp]
                 ]
                 AS
-                Variable [ Name=ps ]
+                Variable [ Name=$ps ]
                 INNER JOIN
                   (
                     SELECT ELEMENT [
@@ -194,7 +194,7 @@
                         LiteralExpr [STRING] [l_suppkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=l ]
+                          Variable [ Name=$l ]
                           Field=l_suppkey
                         ]
                       )
@@ -202,7 +202,7 @@
                         LiteralExpr [STRING] [l_extendedprice]
                         :
                         FieldAccessor [
-                          Variable [ Name=l ]
+                          Variable [ Name=$l ]
                           Field=l_extendedprice
                         ]
                       )
@@ -210,7 +210,7 @@
                         LiteralExpr [STRING] [l_discount]
                         :
                         FieldAccessor [
-                          Variable [ Name=l ]
+                          Variable [ Name=$l ]
                           Field=l_discount
                         ]
                       )
@@ -218,7 +218,7 @@
                         LiteralExpr [STRING] [l_quantity]
                         :
                         FieldAccessor [
-                          Variable [ Name=l ]
+                          Variable [ Name=$l ]
                           Field=l_quantity
                         ]
                       )
@@ -226,7 +226,7 @@
                         LiteralExpr [STRING] [l_partkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=l ]
+                          Variable [ Name=$l ]
                           Field=l_partkey
                         ]
                       )
@@ -234,7 +234,7 @@
                         LiteralExpr [STRING] [l_orderkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=l ]
+                          Variable [ Name=$l ]
                           Field=l_orderkey
                         ]
                       )
@@ -242,7 +242,7 @@
                         LiteralExpr [STRING] [n_name]
                         :
                         FieldAccessor [
-                          Variable [ Name=s1 ]
+                          Variable [ Name=$s1 ]
                           Field=n_name
                         ]
                       )
@@ -255,7 +255,7 @@
                             LiteralExpr [STRING] [s_suppkey]
                             :
                             FieldAccessor [
-                              Variable [ Name=s ]
+                              Variable [ Name=$s ]
                               Field=s_suppkey
                             ]
                           )
@@ -263,7 +263,7 @@
                             LiteralExpr [STRING] [n_name]
                             :
                             FieldAccessor [
-                              Variable [ Name=n ]
+                              Variable [ Name=$n ]
                               Field=n_name
                             ]
                           )
@@ -273,73 +273,73 @@
                             LiteralExpr [STRING] [Supplier]
                           ]
                           AS
-                          Variable [ Name=s ]
+                          Variable [ Name=$s ]
 ,
                           FunctionCall Metadata.dataset@1[
                             LiteralExpr [STRING] [Nation]
                           ]
                           AS
-                          Variable [ Name=n ]
+                          Variable [ Name=$n ]
                         ]
                         Where
                           OperatorExpr [
                             FieldAccessor [
-                              Variable [ Name=n ]
+                              Variable [ Name=$n ]
                               Field=n_nationkey
                             ]
                             =
                             FieldAccessor [
-                              Variable [ Name=s ]
+                              Variable [ Name=$s ]
                               Field=s_nationkey
                             ]
                           ]
                       )
                       AS
-                      Variable [ Name=s1 ]
+                      Variable [ Name=$s1 ]
                       INNER JOIN
                         FunctionCall Metadata.dataset@1[
                           LiteralExpr [STRING] [LineItem]
                         ]
                         AS
-                        Variable [ Name=l ]
+                        Variable [ Name=$l ]
                         ON
                         OperatorExpr [
                           FieldAccessor [
-                            Variable [ Name=s1 ]
+                            Variable [ Name=$s1 ]
                             Field=s_suppkey
                           ]
                           =
                           FieldAccessor [
-                            Variable [ Name=l ]
+                            Variable [ Name=$l ]
                             Field=l_suppkey
                           ]
                         ]
                     ]
                   )
                   AS
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   ON
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=ps ]
+                        Variable [ Name=$ps ]
                         Field=ps_suppkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=l1 ]
+                        Variable [ Name=$l1 ]
                         Field=l_suppkey
                       ]
                     ]
                     and
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=ps ]
+                        Variable [ Name=$ps ]
                         Field=ps_partkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=l1 ]
+                        Variable [ Name=$l1 ]
                         Field=l_partkey
                       ]
                     ]
@@ -347,12 +347,12 @@
               ]
             )
             AS
-            Variable [ Name=l2 ]
+            Variable [ Name=$l2 ]
             ON
             OperatorExpr [
               FunctionCall tpch.contains@2[
                 FieldAccessor [
-                  Variable [ Name=p ]
+                  Variable [ Name=$p ]
                   Field=p_name
                 ]
                 LiteralExpr [STRING] [green]
@@ -360,12 +360,12 @@
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=p ]
+                  Variable [ Name=$p ]
                   Field=p_partkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=l2 ]
+                  Variable [ Name=$l2 ]
                   Field=l_partkey
                 ]
               ]
@@ -373,14 +373,14 @@
         ]
       )
       AS
-      Variable [ Name=l3 ]
+      Variable [ Name=$l3 ]
     ]
-    LetVariable [ Name=amount ]
+    Let Variable [ Name=$amount ]
       :=
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=l_extendedprice
           ]
           *
@@ -388,7 +388,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=l3 ]
+              Variable [ Name=$l3 ]
               Field=l_discount
             ]
           ]
@@ -396,59 +396,63 @@
         -
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=ps_supplycost
           ]
           *
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=l_quantity
           ]
         ]
       ]
-    LetVariable [ Name=o_year ]
+    Let Variable [ Name=$o_year ]
       :=
       FunctionCall tpch.get-year@1[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderdate
         ]
       ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=l3 ]
+          Variable [ Name=$l3 ]
           Field=l_orderkey
         ]
       ]
   )
   AS
-  Variable [ Name=profit ]
+  Variable [ Name=$profit ]
 ]
 Groupby
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
   :=
   FieldAccessor [
-    Variable [ Name=profit ]
+    Variable [ Name=$profit ]
     Field=nation
   ]
-  Variable [ Name=o_year ]
+  Variable [ Name=$o_year ]
   :=
   FieldAccessor [
-    Variable [ Name=profit ]
+    Variable [ Name=$profit ]
     Field=o_year
   ]
-  With
-  Variable [ Name=profit ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$profit ]
+   AS profit
+  )
 
 Orderby
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
   ASC
-  Variable [ Name=o_year ]
+  Variable [ Name=$o_year ]
   DESC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q10_returned_item/q10_returned_item.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q10_returned_item/q10_returned_item.3.ast
index 4f80066..794ca6a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q10_returned_item/q10_returned_item.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q10_returned_item/q10_returned_item.3.ast
@@ -5,42 +5,42 @@
   (
     LiteralExpr [STRING] [c_custkey]
     :
-    Variable [ Name=c_custkey ]
+    Variable [ Name=$c_custkey ]
   )
   (
     LiteralExpr [STRING] [c_name]
     :
-    Variable [ Name=c_name ]
+    Variable [ Name=$c_name ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
   (
     LiteralExpr [STRING] [c_acctbal]
     :
-    Variable [ Name=c_acctbal ]
+    Variable [ Name=$c_acctbal ]
   )
   (
     LiteralExpr [STRING] [n_name]
     :
-    Variable [ Name=n_name ]
+    Variable [ Name=$n_name ]
   )
   (
     LiteralExpr [STRING] [c_address]
     :
-    Variable [ Name=c_address ]
+    Variable [ Name=$c_address ]
   )
   (
     LiteralExpr [STRING] [c_phone]
     :
-    Variable [ Name=c_phone ]
+    Variable [ Name=$c_phone ]
   )
   (
     LiteralExpr [STRING] [c_comment]
     :
-    Variable [ Name=c_comment ]
+    Variable [ Name=$c_comment ]
   )
 ]
 ]
@@ -51,7 +51,7 @@
         LiteralExpr [STRING] [c_custkey]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_custkey
         ]
       )
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [c_name]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_name
         ]
       )
@@ -67,7 +67,7 @@
         LiteralExpr [STRING] [c_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_acctbal
         ]
       )
@@ -75,7 +75,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=n_name
         ]
       )
@@ -83,7 +83,7 @@
         LiteralExpr [STRING] [c_address]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_address
         ]
       )
@@ -91,7 +91,7 @@
         LiteralExpr [STRING] [c_phone]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_phone
         ]
       )
@@ -99,7 +99,7 @@
         LiteralExpr [STRING] [c_comment]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_comment
         ]
       )
@@ -107,7 +107,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_extendedprice
         ]
       )
@@ -115,7 +115,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_discount
         ]
       )
@@ -125,7 +125,7 @@
         LiteralExpr [STRING] [LineItem]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
 ,
       (
         SELECT ELEMENT [
@@ -134,7 +134,7 @@
             LiteralExpr [STRING] [c_custkey]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_custkey
             ]
           )
@@ -142,7 +142,7 @@
             LiteralExpr [STRING] [c_name]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_name
             ]
           )
@@ -150,7 +150,7 @@
             LiteralExpr [STRING] [c_acctbal]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_acctbal
             ]
           )
@@ -158,7 +158,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=n ]
+              Variable [ Name=$n ]
               Field=n_name
             ]
           )
@@ -166,7 +166,7 @@
             LiteralExpr [STRING] [c_address]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_address
             ]
           )
@@ -174,7 +174,7 @@
             LiteralExpr [STRING] [c_phone]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_phone
             ]
           )
@@ -182,7 +182,7 @@
             LiteralExpr [STRING] [c_comment]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_comment
             ]
           )
@@ -190,7 +190,7 @@
             LiteralExpr [STRING] [o_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_orderkey
             ]
           )
@@ -200,38 +200,38 @@
             LiteralExpr [STRING] [Orders]
           ]
           AS
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Customer]
           ]
           AS
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Nation]
           ]
           AS
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=c ]
+                  Variable [ Name=$c ]
                   Field=c_custkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_custkey
                 ]
               ]
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
                 >=
@@ -240,7 +240,7 @@
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
                 <
@@ -250,37 +250,37 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=c ]
+                Variable [ Name=$c ]
                 Field=c_nationkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=n ]
+                Variable [ Name=$n ]
                 Field=n_nationkey
               ]
             ]
           ]
       )
       AS
-      Variable [ Name=ocn ]
+      Variable [ Name=$ocn ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_orderkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=ocn ]
+            Variable [ Name=$ocn ]
             Field=o_orderkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_returnflag
           ]
           =
@@ -289,62 +289,66 @@
       ]
   )
   AS
-  Variable [ Name=locn ]
+  Variable [ Name=$locn ]
 ]
 Groupby
-  Variable [ Name=c_custkey ]
+  Variable [ Name=$c_custkey ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_custkey
   ]
-  Variable [ Name=c_name ]
+  Variable [ Name=$c_name ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_name
   ]
-  Variable [ Name=c_acctbal ]
+  Variable [ Name=$c_acctbal ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_acctbal
   ]
-  Variable [ Name=c_phone ]
+  Variable [ Name=$c_phone ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_phone
   ]
-  Variable [ Name=n_name ]
+  Variable [ Name=$n_name ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=n_name
   ]
-  Variable [ Name=c_address ]
+  Variable [ Name=$c_address ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_address
   ]
-  Variable [ Name=c_comment ]
+  Variable [ Name=$c_comment ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_comment
   ]
-  With
-  Variable [ Name=locn ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$locn ]
+   AS locn
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -352,20 +356,20 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=locn ]
+      FROM [        Variable [ Name=$locn ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q10_returned_item_int64/q10_returned_item_int64.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q10_returned_item_int64/q10_returned_item_int64.3.ast
index 4f80066..794ca6a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q10_returned_item_int64/q10_returned_item_int64.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q10_returned_item_int64/q10_returned_item_int64.3.ast
@@ -5,42 +5,42 @@
   (
     LiteralExpr [STRING] [c_custkey]
     :
-    Variable [ Name=c_custkey ]
+    Variable [ Name=$c_custkey ]
   )
   (
     LiteralExpr [STRING] [c_name]
     :
-    Variable [ Name=c_name ]
+    Variable [ Name=$c_name ]
   )
   (
     LiteralExpr [STRING] [revenue]
     :
-    Variable [ Name=revenue ]
+    Variable [ Name=$revenue ]
   )
   (
     LiteralExpr [STRING] [c_acctbal]
     :
-    Variable [ Name=c_acctbal ]
+    Variable [ Name=$c_acctbal ]
   )
   (
     LiteralExpr [STRING] [n_name]
     :
-    Variable [ Name=n_name ]
+    Variable [ Name=$n_name ]
   )
   (
     LiteralExpr [STRING] [c_address]
     :
-    Variable [ Name=c_address ]
+    Variable [ Name=$c_address ]
   )
   (
     LiteralExpr [STRING] [c_phone]
     :
-    Variable [ Name=c_phone ]
+    Variable [ Name=$c_phone ]
   )
   (
     LiteralExpr [STRING] [c_comment]
     :
-    Variable [ Name=c_comment ]
+    Variable [ Name=$c_comment ]
   )
 ]
 ]
@@ -51,7 +51,7 @@
         LiteralExpr [STRING] [c_custkey]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_custkey
         ]
       )
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [c_name]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_name
         ]
       )
@@ -67,7 +67,7 @@
         LiteralExpr [STRING] [c_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_acctbal
         ]
       )
@@ -75,7 +75,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=n_name
         ]
       )
@@ -83,7 +83,7 @@
         LiteralExpr [STRING] [c_address]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_address
         ]
       )
@@ -91,7 +91,7 @@
         LiteralExpr [STRING] [c_phone]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_phone
         ]
       )
@@ -99,7 +99,7 @@
         LiteralExpr [STRING] [c_comment]
         :
         FieldAccessor [
-          Variable [ Name=ocn ]
+          Variable [ Name=$ocn ]
           Field=c_comment
         ]
       )
@@ -107,7 +107,7 @@
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_extendedprice
         ]
       )
@@ -115,7 +115,7 @@
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_discount
         ]
       )
@@ -125,7 +125,7 @@
         LiteralExpr [STRING] [LineItem]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
 ,
       (
         SELECT ELEMENT [
@@ -134,7 +134,7 @@
             LiteralExpr [STRING] [c_custkey]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_custkey
             ]
           )
@@ -142,7 +142,7 @@
             LiteralExpr [STRING] [c_name]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_name
             ]
           )
@@ -150,7 +150,7 @@
             LiteralExpr [STRING] [c_acctbal]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_acctbal
             ]
           )
@@ -158,7 +158,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=n ]
+              Variable [ Name=$n ]
               Field=n_name
             ]
           )
@@ -166,7 +166,7 @@
             LiteralExpr [STRING] [c_address]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_address
             ]
           )
@@ -174,7 +174,7 @@
             LiteralExpr [STRING] [c_phone]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_phone
             ]
           )
@@ -182,7 +182,7 @@
             LiteralExpr [STRING] [c_comment]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_comment
             ]
           )
@@ -190,7 +190,7 @@
             LiteralExpr [STRING] [o_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_orderkey
             ]
           )
@@ -200,38 +200,38 @@
             LiteralExpr [STRING] [Orders]
           ]
           AS
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Customer]
           ]
           AS
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Nation]
           ]
           AS
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=c ]
+                  Variable [ Name=$c ]
                   Field=c_custkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_custkey
                 ]
               ]
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
                 >=
@@ -240,7 +240,7 @@
               and
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
                 <
@@ -250,37 +250,37 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=c ]
+                Variable [ Name=$c ]
                 Field=c_nationkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=n ]
+                Variable [ Name=$n ]
                 Field=n_nationkey
               ]
             ]
           ]
       )
       AS
-      Variable [ Name=ocn ]
+      Variable [ Name=$ocn ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_orderkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=ocn ]
+            Variable [ Name=$ocn ]
             Field=o_orderkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_returnflag
           ]
           =
@@ -289,62 +289,66 @@
       ]
   )
   AS
-  Variable [ Name=locn ]
+  Variable [ Name=$locn ]
 ]
 Groupby
-  Variable [ Name=c_custkey ]
+  Variable [ Name=$c_custkey ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_custkey
   ]
-  Variable [ Name=c_name ]
+  Variable [ Name=$c_name ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_name
   ]
-  Variable [ Name=c_acctbal ]
+  Variable [ Name=$c_acctbal ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_acctbal
   ]
-  Variable [ Name=c_phone ]
+  Variable [ Name=$c_phone ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_phone
   ]
-  Variable [ Name=n_name ]
+  Variable [ Name=$n_name ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=n_name
   ]
-  Variable [ Name=c_address ]
+  Variable [ Name=$c_address ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_address
   ]
-  Variable [ Name=c_comment ]
+  Variable [ Name=$c_comment ]
   :=
   FieldAccessor [
-    Variable [ Name=locn ]
+    Variable [ Name=$locn ]
     Field=c_comment
   ]
-  With
-  Variable [ Name=locn ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$locn ]
+   AS locn
+  )
 
-LetVariable [ Name=revenue ]
+Let Variable [ Name=$revenue ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -352,20 +356,20 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=locn ]
+      FROM [        Variable [ Name=$locn ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=revenue ]
+  Variable [ Name=$revenue ]
   DESC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q11_important_stock/q11_important_stock.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q11_important_stock/q11_important_stock.3.ast
index 6fb853e..a3e3830 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q11_important_stock/q11_important_stock.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q11_important_stock/q11_important_stock.3.ast
@@ -1,18 +1,18 @@
 DataverseUse tpch
 Query:
-LetVariable [ Name=sum ]
+Let Variable [ Name=$sum ]
   :=
   FunctionCall tpch.sum@1[
     (
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
           Field=ps_supplycost
         ]
         *
         FieldAccessor [
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
           Field=ps_availqty
         ]
       ]
@@ -21,7 +21,7 @@
           LiteralExpr [STRING] [Partsupp]
         ]
         AS
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
 ,
         (
           SELECT ELEMENT [
@@ -30,7 +30,7 @@
               LiteralExpr [STRING] [s_suppkey]
               :
               FieldAccessor [
-                Variable [ Name=s ]
+                Variable [ Name=$s ]
                 Field=s_suppkey
               ]
             )
@@ -40,39 +40,39 @@
               LiteralExpr [STRING] [Supplier]
             ]
             AS
-            Variable [ Name=s ]
+            Variable [ Name=$s ]
 ,
             FunctionCall Metadata.dataset@1[
               LiteralExpr [STRING] [Nation]
             ]
             AS
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
           ]
           Where
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=s ]
+                Variable [ Name=$s ]
                 Field=s_nationkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=n ]
+                Variable [ Name=$n ]
                 Field=n_nationkey
               ]
             ]
         )
         AS
-        Variable [ Name=sn ]
+        Variable [ Name=$sn ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=ps ]
+            Variable [ Name=$ps ]
             Field=ps_suppkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=sn ]
+            Variable [ Name=$sn ]
             Field=s_suppkey
           ]
         ]
@@ -84,7 +84,7 @@
     LiteralExpr [STRING] [partkey]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=ps_partkey
     ]
   )
@@ -92,7 +92,7 @@
     LiteralExpr [STRING] [part_value]
     :
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=part_value
     ]
   )
@@ -104,7 +104,7 @@
       (
         LiteralExpr [STRING] [ps_partkey]
         :
-        Variable [ Name=ps_partkey ]
+        Variable [ Name=$ps_partkey ]
       )
       (
         LiteralExpr [STRING] [part_value]
@@ -114,19 +114,19 @@
             SELECT ELEMENT [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=ps_supplycost
               ]
               *
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=ps_availqty
               ]
             ]
             ]
-            FROM [              Variable [ Name=ps ]
+            FROM [              Variable [ Name=$ps ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -137,7 +137,7 @@
         LiteralExpr [STRING] [Partsupp]
       ]
       AS
-      Variable [ Name=ps ]
+      Variable [ Name=$ps ]
 ,
       (
         SELECT ELEMENT [
@@ -146,7 +146,7 @@
             LiteralExpr [STRING] [s_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_suppkey
             ]
           )
@@ -156,74 +156,80 @@
             LiteralExpr [STRING] [Supplier]
           ]
           AS
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Nation]
           ]
           AS
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_nationkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=n ]
+              Variable [ Name=$n ]
               Field=n_nationkey
             ]
           ]
       )
       AS
-      Variable [ Name=sn ]
+      Variable [ Name=$sn ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
           Field=ps_suppkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=sn ]
+          Variable [ Name=$sn ]
           Field=s_suppkey
         ]
       ]
     Groupby
-      Variable [ Name=ps_partkey ]
+      Variable [ Name=$ps_partkey ]
       :=
       FieldAccessor [
-        Variable [ Name=ps ]
+        Variable [ Name=$ps ]
         Field=ps_partkey
       ]
-      With
-      Variable [ Name=ps ]
-      Variable [ Name=sn ]
-      Variable [ Name=sum ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$sn ]
+       AS sn
+      Variable [ Name=$ps ]
+       AS ps
+      Variable [ Name=$sum ]
+       AS sum
+      )
 
   )
   AS
-  Variable [ Name=t1 ]
+  Variable [ Name=$t1 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t1 ]
+      Variable [ Name=$t1 ]
       Field=part_value
     ]
     >
     OperatorExpr [
-      Variable [ Name=sum ]
+      Variable [ Name=$sum ]
       *
       LiteralExpr [DOUBLE] [1.0E-5]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t1 ]
+    Variable [ Name=$t1 ]
     Field=part_value
   ]
   DESC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q12_shipping/q12_shipping.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q12_shipping/q12_shipping.3.ast
index c478139..6150bd4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q12_shipping/q12_shipping.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q12_shipping/q12_shipping.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [l_shipmode]
     :
-    Variable [ Name=l_shipmode ]
+    Variable [ Name=$l_shipmode ]
   )
   (
     LiteralExpr [STRING] [high_line_count]
@@ -17,7 +17,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=o_orderpriority
               ]
               =
@@ -26,7 +26,7 @@
             or
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=o_orderpriority
               ]
               =
@@ -39,9 +39,9 @@
           LiteralExpr [LONG] [0]
         ]
         ]
-        FROM [          Variable [ Name=o ]
+        FROM [          Variable [ Name=$o ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -56,7 +56,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=o_orderpriority
               ]
               =
@@ -65,7 +65,7 @@
             or
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=o_orderpriority
               ]
               =
@@ -78,9 +78,9 @@
           LiteralExpr [LONG] [1]
         ]
         ]
-        FROM [          Variable [ Name=o ]
+        FROM [          Variable [ Name=$o ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -91,55 +91,55 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_commitdate
       ]
       <
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_receiptdate
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_shipdate
       ]
       <
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_commitdate
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_receiptdate
       ]
       >=
@@ -148,7 +148,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_receiptdate
       ]
       <
@@ -158,7 +158,7 @@
     OperatorExpr [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_shipmode
         ]
         =
@@ -167,7 +167,7 @@
       or
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_shipmode
         ]
         =
@@ -176,17 +176,22 @@
     ]
   ]
 Groupby
-  Variable [ Name=l_shipmode ]
+  Variable [ Name=$l_shipmode ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_shipmode
   ]
-  With
-  Variable [ Name=l ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$o ]
+   AS o
+  Variable [ Name=$l ]
+   AS l
+  )
 
 Orderby
-  Variable [ Name=l_shipmode ]
+  Variable [ Name=$l_shipmode ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.ast
index 2b22632..040038c 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.ast
@@ -6,12 +6,12 @@
   (
     LiteralExpr [STRING] [c_count]
     :
-    Variable [ Name=c_count ]
+    Variable [ Name=$c_count ]
   )
   (
     LiteralExpr [STRING] [custdist]
     :
-    Variable [ Name=custdist ]
+    Variable [ Name=$custdist ]
   )
 ]
 ]
@@ -21,7 +21,7 @@
       (
         LiteralExpr [STRING] [c_custkey]
         :
-        Variable [ Name=c_custkey ]
+        Variable [ Name=$c_custkey ]
       )
       (
         LiteralExpr [STRING] [c_count]
@@ -30,13 +30,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=o_orderkey_count
             ]
             ]
-            FROM [              Variable [ Name=co ]
+            FROM [              Variable [ Name=$co ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -50,7 +50,7 @@
             LiteralExpr [STRING] [c_custkey]
             :
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_custkey
             ]
           )
@@ -61,7 +61,7 @@
               (
                 SELECT ELEMENT [
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderkey
                 ]
                 ]
@@ -69,18 +69,18 @@
                     LiteralExpr [STRING] [Orders]
                   ]
                   AS
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                 ]
                 Where
                   OperatorExpr [
                     OperatorExpr [
                       FieldAccessor [
-                        Variable [ Name=c ]
+                        Variable [ Name=$c ]
                         Field=c_custkey
                       ]
                       =
                       FieldAccessor [
-                        Variable [ Name=o ]
+                        Variable [ Name=$o ]
                         Field=o_custkey
                       ]
                     ]
@@ -88,7 +88,7 @@
                     FunctionCall tpch.not@1[
                       FunctionCall tpch.like@2[
                         FieldAccessor [
-                          Variable [ Name=o ]
+                          Variable [ Name=$o ]
                           Field=o_comment
                         ]
                         LiteralExpr [STRING] [%special%requests%]
@@ -104,44 +104,63 @@
             LiteralExpr [STRING] [Customer]
           ]
           AS
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
         ]
       )
       AS
-      Variable [ Name=co ]
+      Variable [ Name=$co ]
     ]
     Groupby
-      Variable [ Name=c_custkey ]
+      Variable [ Name=$c_custkey ]
       :=
       FieldAccessor [
-        Variable [ Name=co ]
+        Variable [ Name=$co ]
         Field=c_custkey
       ]
-      With
-      Variable [ Name=co ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$co ]
+       AS co
+      )
 
   )
   AS
-  Variable [ Name=gco ]
+  Variable [ Name=$gco ]
 ]
 Groupby
-  Variable [ Name=c_count ]
+  Variable [ Name=$c_count ]
   :=
   FieldAccessor [
-    Variable [ Name=gco ]
+    Variable [ Name=$gco ]
     Field=c_count
   ]
-  With
-  Variable [ Name=gco ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$gco ]
+   AS gco
+  )
 
-LetVariable [ Name=custdist ]
+Let Variable [ Name=$custdist ]
   :=
   FunctionCall tpch.count@1[
-    Variable [ Name=gco ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#3 ]
+        Field=gco
+      ]
+      ]
+      FROM [        Variable [ Name=#2 ]
+        AS
+        Variable [ Name=#3 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=custdist ]
+  Variable [ Name=$custdist ]
   DESC
-  Variable [ Name=c_count ]
+  Variable [ Name=$c_count ]
   DESC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.ast
index 57b4c73..86eb727 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.ast
@@ -10,7 +10,7 @@
       FunctionCall tpch.switch-case@5[
         FunctionCall tpch.like@2[
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=p_type
           ]
           LiteralExpr [STRING] [PROMO%]
@@ -18,7 +18,7 @@
         LiteralExpr [TRUE]
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -26,7 +26,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -35,9 +35,9 @@
         LiteralExpr [DOUBLE] [0.0]
       ]
       ]
-      FROM [        Variable [ Name=l ]
+      FROM [        Variable [ Name=$lp ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
@@ -47,7 +47,7 @@
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         *
@@ -55,15 +55,15 @@
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=l ]
+      FROM [        Variable [ Name=$lp ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
@@ -73,31 +73,59 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Part]
   ]
   AS
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ]
+Let Variable [ Name=$lp ]
+  :=
+  RecordConstructor [
+    (
+      LiteralExpr [STRING] [p_type]
+      :
+      FieldAccessor [
+        Variable [ Name=$p ]
+        Field=p_type
+      ]
+    )
+    (
+      LiteralExpr [STRING] [l_extendedprice]
+      :
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_extendedprice
+      ]
+    )
+    (
+      LiteralExpr [STRING] [l_discount]
+      :
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_discount
+      ]
+    )
+  ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_partkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=p ]
+        Variable [ Name=$p ]
         Field=p_partkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_shipdate
       ]
       >=
@@ -106,7 +134,7 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_shipdate
       ]
       <
@@ -114,10 +142,17 @@
     ]
   ]
 Groupby
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
   :=
   LiteralExpr [LONG] [1]
-  With
-  Variable [ Name=p ]
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$lp ]
+   AS lp
+  Variable [ Name=$p ]
+   AS p
+  Variable [ Name=$l ]
+   AS l
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q15_top_supplier/q15_top_supplier.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q15_top_supplier/q15_top_supplier.3.ast
index b19616d..8e0bd84 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q15_top_supplier/q15_top_supplier.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q15_top_supplier/q15_top_supplier.3.ast
@@ -6,7 +6,7 @@
       (
         LiteralExpr [STRING] [supplier_no]
         :
-        Variable [ Name=l_suppkey ]
+        Variable [ Name=$l_suppkey ]
       )
       (
         LiteralExpr [STRING] [total_revenue]
@@ -16,7 +16,7 @@
             SELECT ELEMENT [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=i ]
+                Variable [ Name=$i ]
                 Field=l_extendedprice
               ]
               *
@@ -24,30 +24,30 @@
                 LiteralExpr [LONG] [1]
                 -
                 FieldAccessor [
-                  Variable [ Name=i ]
+                  Variable [ Name=$i ]
                   Field=l_discount
                 ]
               ]
             ]
             ]
-            FROM [              Variable [ Name=l ]
+            FROM [              Variable [ Name=$l ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
       )
     ]
     ]
-    FROM [      Variable [ Name=LineItem ]
+    FROM [      Variable [ Name=$LineItem ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_shipdate
           ]
           >=
@@ -56,7 +56,7 @@
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_shipdate
           ]
           <
@@ -64,10 +64,10 @@
         ]
       ]
     Groupby
-      Variable [ Name=l_suppkey ]
+      Variable [ Name=$l_suppkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_suppkey
       ]
 
@@ -75,20 +75,20 @@
 }
 
 Query:
-LetVariable [ Name=m ]
+Let Variable [ Name=$m ]
   :=
   FunctionCall tpch.max@1[
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=r2 ]
+        Variable [ Name=$r2 ]
         Field=total_revenue
       ]
       ]
       FROM [        FunctionCall tpch.revenue@0[
         ]
         AS
-        Variable [ Name=r2 ]
+        Variable [ Name=$r2 ]
       ]
     )
   ]
@@ -98,7 +98,7 @@
     LiteralExpr [STRING] [s_suppkey]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_suppkey
     ]
   )
@@ -106,7 +106,7 @@
     LiteralExpr [STRING] [s_name]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_name
     ]
   )
@@ -114,7 +114,7 @@
     LiteralExpr [STRING] [s_address]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_address
     ]
   )
@@ -122,7 +122,7 @@
     LiteralExpr [STRING] [s_phone]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_phone
     ]
   )
@@ -130,7 +130,7 @@
     LiteralExpr [STRING] [total_revenue]
     :
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=total_revenue
     ]
   )
@@ -140,35 +140,35 @@
     LiteralExpr [STRING] [Supplier]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
 ,
   FunctionCall tpch.revenue@0[
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=s ]
+        Variable [ Name=$s ]
         Field=s_suppkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=r ]
+        Variable [ Name=$r ]
         Field=supplier_no
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=r ]
+        Variable [ Name=$r ]
         Field=total_revenue
       ]
       <
       OperatorExpr [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         +
         LiteralExpr [DOUBLE] [1.0E-9]
       ]
@@ -176,12 +176,12 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=r ]
+        Variable [ Name=$r ]
         Field=total_revenue
       ]
       >
       OperatorExpr [
-        Variable [ Name=m ]
+        Variable [ Name=$m ]
         -
         LiteralExpr [DOUBLE] [1.0E-9]
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
index dc55293..9fb5785 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
@@ -7,7 +7,7 @@
         LiteralExpr [STRING] [p_brand]
         :
         FieldAccessor [
-          Variable [ Name=psp ]
+          Variable [ Name=$psp ]
           Field=p_brand
         ]
       )
@@ -15,7 +15,7 @@
         LiteralExpr [STRING] [p_type]
         :
         FieldAccessor [
-          Variable [ Name=psp ]
+          Variable [ Name=$psp ]
           Field=p_type
         ]
       )
@@ -23,7 +23,7 @@
         LiteralExpr [STRING] [p_size]
         :
         FieldAccessor [
-          Variable [ Name=psp ]
+          Variable [ Name=$psp ]
           Field=p_size
         ]
       )
@@ -31,7 +31,7 @@
         LiteralExpr [STRING] [ps_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=psp ]
+          Variable [ Name=$psp ]
           Field=ps_suppkey
         ]
       )
@@ -44,7 +44,7 @@
             LiteralExpr [STRING] [p_brand]
             :
             FieldAccessor [
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
               Field=p_brand
             ]
           )
@@ -52,7 +52,7 @@
             LiteralExpr [STRING] [p_type]
             :
             FieldAccessor [
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
               Field=p_type
             ]
           )
@@ -60,7 +60,7 @@
             LiteralExpr [STRING] [p_size]
             :
             FieldAccessor [
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
               Field=p_size
             ]
           )
@@ -68,37 +68,37 @@
             LiteralExpr [STRING] [ps_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_suppkey
             ]
           )
         ]
         ]
-        FROM [          Variable [ Name=Partsupp ]
+        FROM [          Variable [ Name=$Partsupp ]
           AS
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
 ,
-          Variable [ Name=Part ]
+          Variable [ Name=$Part ]
           AS
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_partkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=ps ]
+                Variable [ Name=$ps ]
                 Field=ps_partkey
               ]
             ]
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_brand
               ]
               !=
@@ -108,7 +108,7 @@
             FunctionCall tpch.not@1[
               FunctionCall tpch.like@2[
                 FieldAccessor [
-                  Variable [ Name=p ]
+                  Variable [ Name=$p ]
                   Field=p_type
                 ]
                 LiteralExpr [STRING] [MEDIUM POLISHED%]
@@ -117,22 +117,22 @@
           ]
       )
       AS
-      Variable [ Name=psp ]
+      Variable [ Name=$psp ]
 ,
-      Variable [ Name=Supplier ]
+      Variable [ Name=$Supplier ]
       AS
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=psp ]
+            Variable [ Name=$psp ]
             Field=ps_suppkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=s ]
+            Variable [ Name=$s ]
             Field=s_suppkey
           ]
         ]
@@ -140,7 +140,7 @@
         FunctionCall tpch.not@1[
           FunctionCall tpch.like@2[
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=s_comment
             ]
             LiteralExpr [STRING] [%Customer%Complaints%]
@@ -156,22 +156,22 @@
   (
     LiteralExpr [STRING] [p_brand]
     :
-    Variable [ Name=p_brand ]
+    Variable [ Name=$p_brand ]
   )
   (
     LiteralExpr [STRING] [p_type]
     :
-    Variable [ Name=p_type ]
+    Variable [ Name=$p_type ]
   )
   (
     LiteralExpr [STRING] [p_size]
     :
-    Variable [ Name=p_size ]
+    Variable [ Name=$p_size ]
   )
   (
     LiteralExpr [STRING] [supplier_cnt]
     :
-    Variable [ Name=supplier_cnt ]
+    Variable [ Name=$supplier_cnt ]
   )
 ]
 ]
@@ -181,35 +181,35 @@
       (
         LiteralExpr [STRING] [p_brand]
         :
-        Variable [ Name=p_brand1 ]
+        Variable [ Name=$p_brand1 ]
       )
       (
         LiteralExpr [STRING] [p_type]
         :
-        Variable [ Name=p_type1 ]
+        Variable [ Name=$p_type1 ]
       )
       (
         LiteralExpr [STRING] [p_size]
         :
-        Variable [ Name=p_size1 ]
+        Variable [ Name=$p_size1 ]
       )
       (
         LiteralExpr [STRING] [ps_suppkey]
         :
-        Variable [ Name=ps_suppkey1 ]
+        Variable [ Name=$ps_suppkey1 ]
       )
     ]
     ]
     FROM [      FunctionCall tpch.tmp@0[
       ]
       AS
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -218,7 +218,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -227,7 +227,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -236,7 +236,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -245,7 +245,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -254,7 +254,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -263,7 +263,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -272,7 +272,7 @@
         or
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t ]
+            Variable [ Name=$t ]
             Field=p_size
           ]
           =
@@ -280,82 +280,90 @@
         ]
       ]
     Groupby
-      Variable [ Name=p_brand1 ]
+      Variable [ Name=$p_brand1 ]
       :=
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=p_brand
       ]
-      Variable [ Name=p_type1 ]
+      Variable [ Name=$p_type1 ]
       :=
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=p_type
       ]
-      Variable [ Name=p_size1 ]
+      Variable [ Name=$p_size1 ]
       :=
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=p_size
       ]
-      Variable [ Name=ps_suppkey1 ]
+      Variable [ Name=$ps_suppkey1 ]
       :=
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=ps_suppkey
       ]
-      With
-      Variable [ Name=t ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$t ]
+       AS t
+      )
 
   )
   AS
-  Variable [ Name=t2 ]
+  Variable [ Name=$t2 ]
 ]
 Groupby
-  Variable [ Name=p_brand ]
+  Variable [ Name=$p_brand ]
   :=
   FieldAccessor [
-    Variable [ Name=t2 ]
+    Variable [ Name=$t2 ]
     Field=p_brand
   ]
-  Variable [ Name=p_type ]
+  Variable [ Name=$p_type ]
   :=
   FieldAccessor [
-    Variable [ Name=t2 ]
+    Variable [ Name=$t2 ]
     Field=p_type
   ]
-  Variable [ Name=p_size ]
+  Variable [ Name=$p_size ]
   :=
   FieldAccessor [
-    Variable [ Name=t2 ]
+    Variable [ Name=$t2 ]
     Field=p_size
   ]
-  With
-  Variable [ Name=t2 ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$t2 ]
+   AS t2
+  )
 
-LetVariable [ Name=supplier_cnt ]
+Let Variable [ Name=$supplier_cnt ]
   :=
   FunctionCall tpch.count@1[
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=ps_suppkey
       ]
       ]
-      FROM [        Variable [ Name=t2 ]
+      FROM [        Variable [ Name=$t2 ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
     )
   ]
 Orderby
-  Variable [ Name=supplier_cnt ]
+  Variable [ Name=$supplier_cnt ]
   DESC
-  Variable [ Name=p_brand ]
+  Variable [ Name=$p_brand ]
   ASC
-  Variable [ Name=p_type ]
+  Variable [ Name=$p_type ]
   ASC
-  Variable [ Name=p_size ]
+  Variable [ Name=$p_size ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q17_large_gby_variant/q17_large_gby_variant.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q17_large_gby_variant/q17_large_gby_variant.3.ast
index 19e5d78..fb8f2cd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q17_large_gby_variant/q17_large_gby_variant.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q17_large_gby_variant/q17_large_gby_variant.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [t_partkey]
     :
-    Variable [ Name=l_partkey ]
+    Variable [ Name=$l_partkey ]
   )
   (
     LiteralExpr [STRING] [t_count]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=l ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
   (
@@ -24,13 +35,13 @@
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_quantity
           ]
           ]
-          FROM [            Variable [ Name=l ]
+          FROM [            Variable [ Name=$l ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -43,13 +54,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_suppkey
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -61,13 +72,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_linenumber
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -79,13 +90,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -97,13 +108,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -115,13 +126,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_tax
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -133,13 +144,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_shipdate
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -151,13 +162,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_commitdate
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -169,13 +180,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_receiptdate
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -187,13 +198,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_comment
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -204,19 +215,23 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Groupby
-  Variable [ Name=l_partkey ]
+  Variable [ Name=$l_partkey ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_partkey
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
 Orderby
-  Variable [ Name=l_partkey ]
+  Variable [ Name=$l_partkey ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q18_large_volume_customer/q18_large_volume_customer.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q18_large_volume_customer/q18_large_volume_customer.3.ast
index 440f07a..ea93017 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q18_large_volume_customer/q18_large_volume_customer.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q18_large_volume_customer/q18_large_volume_customer.3.ast
@@ -5,27 +5,27 @@
   (
     LiteralExpr [STRING] [c_name]
     :
-    Variable [ Name=c_name ]
+    Variable [ Name=$c_name ]
   )
   (
     LiteralExpr [STRING] [c_custkey]
     :
-    Variable [ Name=c_custkey ]
+    Variable [ Name=$c_custkey ]
   )
   (
     LiteralExpr [STRING] [o_orderkey]
     :
-    Variable [ Name=o_orderkey ]
+    Variable [ Name=$o_orderkey ]
   )
   (
     LiteralExpr [STRING] [o_orderdate]
     :
-    Variable [ Name=o_orderdate ]
+    Variable [ Name=$o_orderdate ]
   )
   (
     LiteralExpr [STRING] [o_totalprice]
     :
-    Variable [ Name=o_totalprice ]
+    Variable [ Name=$o_totalprice ]
   )
   (
     LiteralExpr [STRING] [sum_quantity]
@@ -34,13 +34,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=l ]
+        FROM [          Variable [ Name=$l ]
           AS
-          Variable [ Name=j ]
+          Variable [ Name=$j ]
         ]
       )
     ]
@@ -51,13 +51,13 @@
     LiteralExpr [STRING] [Customer]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   (
     SELECT ELEMENT [
@@ -65,7 +65,7 @@
       (
         LiteralExpr [STRING] [l_orderkey]
         :
-        Variable [ Name=l_orderkey ]
+        Variable [ Name=$l_orderkey ]
       )
       (
         LiteralExpr [STRING] [t_sum_quantity]
@@ -74,13 +74,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_quantity
             ]
             ]
-            FROM [              Variable [ Name=l ]
+            FROM [              Variable [ Name=$l ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -91,59 +91,65 @@
         LiteralExpr [STRING] [LineItem]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
     ]
     Groupby
-      Variable [ Name=l_orderkey ]
+      Variable [ Name=$l_orderkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
-      With
-      Variable [ Name=l ]
-      Variable [ Name=c ]
-      Variable [ Name=o ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$l ]
+       AS l
+      Variable [ Name=$o ]
+       AS o
+      Variable [ Name=$c ]
+       AS c
+      )
 
   )
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_custkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_custkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_orderkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=l_orderkey
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=t_sum_quantity
       ]
       >
@@ -152,57 +158,64 @@
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_orderkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=t ]
+        Variable [ Name=$t ]
         Field=l_orderkey
       ]
     ]
   ]
 Groupby
-  Variable [ Name=c_name ]
+  Variable [ Name=$c_name ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=c_name
   ]
-  Variable [ Name=c_custkey ]
+  Variable [ Name=$c_custkey ]
   :=
   FieldAccessor [
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
     Field=c_custkey
   ]
-  Variable [ Name=o_orderkey ]
+  Variable [ Name=$o_orderkey ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderdate
   ]
-  Variable [ Name=o_totalprice ]
+  Variable [ Name=$o_totalprice ]
   :=
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_totalprice
   ]
-  With
-  Variable [ Name=c ]
-  Variable [ Name=t ]
-  Variable [ Name=l ]
-  Variable [ Name=o ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  Variable [ Name=$t ]
+   AS t
+  Variable [ Name=$o ]
+   AS o
+  Variable [ Name=$c ]
+   AS c
+  )
 
 Orderby
-  Variable [ Name=o_totalprice ]
+  Variable [ Name=$o_totalprice ]
   DESC
-  Variable [ Name=o_orderdate ]
+  Variable [ Name=$o_orderdate ]
   ASC
 
 Limit
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q19_discounted_revenue/q19_discounted_revenue.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q19_discounted_revenue/q19_discounted_revenue.3.ast
index 46e01a7..1de3822 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q19_discounted_revenue/q19_discounted_revenue.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q19_discounted_revenue/q19_discounted_revenue.3.ast
@@ -7,7 +7,7 @@
     SELECT ELEMENT [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         Field=l_extendedprice
       ]
       *
@@ -15,7 +15,7 @@
         LiteralExpr [LONG] [1]
         -
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_discount
         ]
       ]
@@ -25,24 +25,24 @@
         LiteralExpr [STRING] [LineItem]
       ]
       AS
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Part]
       ]
       AS
-      Variable [ Name=p ]
+      Variable [ Name=$p ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=p ]
+            Variable [ Name=$p ]
             Field=p_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_partkey
           ]
         ]
@@ -51,7 +51,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_brand
               ]
               =
@@ -60,7 +60,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_container
               ]
               LiteralExpr [STRING] [SM CASE||SM BOX||SM PACK||SM PKG]
@@ -68,7 +68,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               >=
@@ -77,7 +77,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               <=
@@ -86,7 +86,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               >=
@@ -95,7 +95,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               <=
@@ -104,7 +104,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipmode
               ]
               LiteralExpr [STRING] [AIR||AIR REG]
@@ -112,7 +112,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipinstruct
               ]
               =
@@ -123,7 +123,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_brand
               ]
               =
@@ -132,7 +132,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_container
               ]
               LiteralExpr [STRING] [MED BAG||MED BOX||MED PKG||MED PACK]
@@ -140,7 +140,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               >=
@@ -149,7 +149,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               <=
@@ -158,7 +158,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               >=
@@ -167,7 +167,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               <=
@@ -176,7 +176,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipmode
               ]
               LiteralExpr [STRING] [AIR||AIR REG]
@@ -184,7 +184,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipinstruct
               ]
               =
@@ -195,7 +195,7 @@
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_brand
               ]
               =
@@ -204,7 +204,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_container
               ]
               LiteralExpr [STRING] [LG CASE||LG BOX||LG PACK||LG PKG]
@@ -212,7 +212,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               >=
@@ -221,7 +221,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_quantity
               ]
               <=
@@ -230,7 +230,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               >=
@@ -239,7 +239,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_size
               ]
               <=
@@ -248,7 +248,7 @@
             and
             FunctionCall tpch.reg-exp@2[
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipmode
               ]
               LiteralExpr [STRING] [AIR||AIR REG]
@@ -256,7 +256,7 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_shipinstruct
               ]
               =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q20_potential_part_promotion/q20_potential_part_promotion.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
index fda99ec..6029e08 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [s_name]
     :
     FieldAccessor [
-      Variable [ Name=t4 ]
+      Variable [ Name=$t4 ]
       Field=s_name
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [s_address]
     :
     FieldAccessor [
-      Variable [ Name=t4 ]
+      Variable [ Name=$t4 ]
       Field=s_address
     ]
   )
@@ -27,7 +27,7 @@
         LiteralExpr [STRING] [ps_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=pst1 ]
+          Variable [ Name=$pst1 ]
           Field=ps_suppkey
         ]
       )
@@ -39,12 +39,12 @@
           (
             LiteralExpr [STRING] [l_partkey]
             :
-            Variable [ Name=l_partkey ]
+            Variable [ Name=$l_partkey ]
           )
           (
             LiteralExpr [STRING] [l_suppkey]
             :
-            Variable [ Name=l_suppkey ]
+            Variable [ Name=$l_suppkey ]
           )
           (
             LiteralExpr [STRING] [sum_quantity]
@@ -56,13 +56,13 @@
                 (
                   SELECT ELEMENT [
                   FieldAccessor [
-                    Variable [ Name=i ]
+                    Variable [ Name=$i ]
                     Field=l_quantity
                   ]
                   ]
-                  FROM [                    Variable [ Name=l ]
+                  FROM [                    Variable [ Name=$l ]
                     AS
-                    Variable [ Name=i ]
+                    Variable [ Name=$i ]
                   ]
                 )
               ]
@@ -74,27 +74,31 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Groupby
-          Variable [ Name=l_partkey ]
+          Variable [ Name=$l_partkey ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_partkey
           ]
-          Variable [ Name=l_suppkey ]
+          Variable [ Name=$l_suppkey ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_suppkey
           ]
-          With
-          Variable [ Name=l ]
+          GROUP AS
+          Variable [ Name=#1 ]
+          (
+          Variable [ Name=$l ]
+           AS l
+          )
 
       )
       AS
-      Variable [ Name=t2 ]
+      Variable [ Name=$t2 ]
 ,
       (
         SELECT ELEMENT [
@@ -103,7 +107,7 @@
             LiteralExpr [STRING] [ps_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_suppkey
             ]
           )
@@ -111,7 +115,7 @@
             LiteralExpr [STRING] [ps_partkey]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_partkey
             ]
           )
@@ -119,7 +123,7 @@
             LiteralExpr [STRING] [ps_availqty]
             :
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_availqty
             ]
           )
@@ -129,7 +133,7 @@
             LiteralExpr [STRING] [Partsupp]
           ]
           AS
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
 ,
           (
             SELECT ELEMENT [
@@ -138,7 +142,7 @@
                 LiteralExpr [STRING] [p_partkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=p ]
+                  Variable [ Name=$p ]
                   Field=p_partkey
                 ]
               )
@@ -148,69 +152,69 @@
                 LiteralExpr [STRING] [Part]
               ]
               AS
-              Variable [ Name=p ]
+              Variable [ Name=$p ]
             ]
           )
           AS
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
               Field=ps_partkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=p_partkey
             ]
           ]
       )
       AS
-      Variable [ Name=pst1 ]
+      Variable [ Name=$pst1 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=pst1 ]
+            Variable [ Name=$pst1 ]
             Field=ps_partkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=l_partkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=pst1 ]
+            Variable [ Name=$pst1 ]
             Field=ps_suppkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=l_suppkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=pst1 ]
+            Variable [ Name=$pst1 ]
             Field=ps_availqty
           ]
           >
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=sum_quantity
           ]
         ]
       ]
   )
   AS
-  Variable [ Name=t3 ]
+  Variable [ Name=$t3 ]
 ,
   (
     SELECT ELEMENT [
@@ -219,7 +223,7 @@
         LiteralExpr [STRING] [s_name]
         :
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_name
         ]
       )
@@ -227,7 +231,7 @@
         LiteralExpr [STRING] [s_address]
         :
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_address
         ]
       )
@@ -235,7 +239,7 @@
         LiteralExpr [STRING] [s_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_suppkey
         ]
       )
@@ -245,45 +249,45 @@
         LiteralExpr [STRING] [Nation]
       ]
       AS
-      Variable [ Name=n ]
+      Variable [ Name=$n ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Supplier]
       ]
       AS
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=s ]
+          Variable [ Name=$s ]
           Field=s_nationkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=n ]
+          Variable [ Name=$n ]
           Field=n_nationkey
         ]
       ]
   )
   AS
-  Variable [ Name=t4 ]
+  Variable [ Name=$t4 ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=t3 ]
+      Variable [ Name=$t3 ]
       Field=ps_suppkey
     ]
     =
     FieldAccessor [
-      Variable [ Name=t4 ]
+      Variable [ Name=$t4 ]
       Field=s_suppkey
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t4 ]
+    Variable [ Name=$t4 ]
     Field=s_name
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.ast
index 02b134c..1d055ab 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.ast
@@ -6,7 +6,7 @@
       (
         LiteralExpr [STRING] [l_orderkey]
         :
-        Variable [ Name=l_orderkey ]
+        Variable [ Name=$l_orderkey ]
       )
       (
         LiteralExpr [STRING] [count_suppkey]
@@ -15,13 +15,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_suppkey
             ]
             ]
-            FROM [              Variable [ Name=l2 ]
+            FROM [              Variable [ Name=$l2 ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -33,13 +33,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_suppkey
             ]
             ]
-            FROM [              Variable [ Name=l2 ]
+            FROM [              Variable [ Name=$l2 ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -52,42 +52,42 @@
           (
             LiteralExpr [STRING] [l_orderkey]
             :
-            Variable [ Name=l_orderkey1 ]
+            Variable [ Name=$l_orderkey1 ]
           )
           (
             LiteralExpr [STRING] [l_suppkey]
             :
-            Variable [ Name=l_suppkey1 ]
+            Variable [ Name=$l_suppkey1 ]
           )
         ]
         ]
-        FROM [          Variable [ Name=LineItem ]
+        FROM [          Variable [ Name=$LineItem ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Groupby
-          Variable [ Name=l_orderkey1 ]
+          Variable [ Name=$l_orderkey1 ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_orderkey
           ]
-          Variable [ Name=l_suppkey1 ]
+          Variable [ Name=$l_suppkey1 ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_suppkey
           ]
 
       )
       AS
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
     ]
     Groupby
-      Variable [ Name=l_orderkey ]
+      Variable [ Name=$l_orderkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l2 ]
+        Variable [ Name=$l2 ]
         Field=l_orderkey
       ]
 
@@ -101,7 +101,7 @@
       (
         LiteralExpr [STRING] [l_orderkey]
         :
-        Variable [ Name=l_orderkey ]
+        Variable [ Name=$l_orderkey ]
       )
       (
         LiteralExpr [STRING] [count_suppkey]
@@ -110,13 +110,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_suppkey
             ]
             ]
-            FROM [              Variable [ Name=l2 ]
+            FROM [              Variable [ Name=$l2 ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -128,13 +128,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_suppkey
             ]
             ]
-            FROM [              Variable [ Name=l2 ]
+            FROM [              Variable [ Name=$l2 ]
               AS
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
           )
         ]
@@ -147,54 +147,54 @@
           (
             LiteralExpr [STRING] [l_orderkey]
             :
-            Variable [ Name=l_orderkey1 ]
+            Variable [ Name=$l_orderkey1 ]
           )
           (
             LiteralExpr [STRING] [l_suppkey]
             :
-            Variable [ Name=l_suppkey1 ]
+            Variable [ Name=$l_suppkey1 ]
           )
         ]
         ]
-        FROM [          Variable [ Name=LineItem ]
+        FROM [          Variable [ Name=$LineItem ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_receiptdate
             ]
             >
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_commitdate
             ]
           ]
         Groupby
-          Variable [ Name=l_orderkey1 ]
+          Variable [ Name=$l_orderkey1 ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_orderkey
           ]
-          Variable [ Name=l_suppkey1 ]
+          Variable [ Name=$l_suppkey1 ]
           :=
           FieldAccessor [
-            Variable [ Name=l ]
+            Variable [ Name=$l ]
             Field=l_suppkey
           ]
 
       )
       AS
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
     ]
     Groupby
-      Variable [ Name=l_orderkey ]
+      Variable [ Name=$l_orderkey ]
       :=
       FieldAccessor [
-        Variable [ Name=l2 ]
+        Variable [ Name=$l2 ]
         Field=l_orderkey
       ]
 
@@ -207,12 +207,12 @@
   (
     LiteralExpr [STRING] [s_name]
     :
-    Variable [ Name=s_name ]
+    Variable [ Name=$s_name ]
   )
   (
     LiteralExpr [STRING] [numwait]
     :
-    Variable [ Name=numwait ]
+    Variable [ Name=$numwait ]
   )
 ]
 ]
@@ -223,7 +223,7 @@
         LiteralExpr [STRING] [s_name]
         :
         FieldAccessor [
-          Variable [ Name=t3 ]
+          Variable [ Name=$t3 ]
           Field=s_name
         ]
       )
@@ -231,7 +231,7 @@
         LiteralExpr [STRING] [l_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=t3 ]
+          Variable [ Name=$t3 ]
           Field=l_suppkey
         ]
       )
@@ -239,7 +239,7 @@
         LiteralExpr [STRING] [l_orderkey]
         :
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=l_orderkey
         ]
       )
@@ -247,7 +247,7 @@
         LiteralExpr [STRING] [count_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=count_suppkey
         ]
       )
@@ -255,7 +255,7 @@
         LiteralExpr [STRING] [max_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=max_suppkey
         ]
       )
@@ -268,7 +268,7 @@
             LiteralExpr [STRING] [s_name]
             :
             FieldAccessor [
-              Variable [ Name=ns ]
+              Variable [ Name=$ns ]
               Field=s_name
             ]
           )
@@ -276,7 +276,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=t1 ]
+              Variable [ Name=$t1 ]
               Field=l_orderkey
             ]
           )
@@ -284,7 +284,7 @@
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
           )
@@ -294,7 +294,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
 ,
           (
             SELECT ELEMENT [
@@ -303,7 +303,7 @@
                 LiteralExpr [STRING] [s_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_name
                 ]
               )
@@ -311,7 +311,7 @@
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -321,105 +321,105 @@
                 LiteralExpr [STRING] [Nation]
               ]
               AS
-              Variable [ Name=n ]
+              Variable [ Name=$n ]
 ,
               FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Supplier]
               ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
             ]
             Where
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
                 =
                 FieldAccessor [
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
                   Field=n_nationkey
                 ]
               ]
           )
           AS
-          Variable [ Name=ns ]
+          Variable [ Name=$ns ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Orders]
           ]
           AS
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
 ,
           FunctionCall tpch.tmp1@0[
           ]
           AS
-          Variable [ Name=t1 ]
+          Variable [ Name=$t1 ]
         ]
         Where
           OperatorExpr [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=ns ]
+                Variable [ Name=$ns ]
                 Field=s_suppkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_suppkey
               ]
             ]
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_receiptdate
               ]
               >
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_commitdate
               ]
             ]
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=o ]
+                Variable [ Name=$o ]
                 Field=o_orderkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_orderkey
               ]
             ]
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=l ]
+                Variable [ Name=$l ]
                 Field=l_orderkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=t1 ]
+                Variable [ Name=$t1 ]
                 Field=l_orderkey
               ]
             ]
           ]
       )
       AS
-      Variable [ Name=t3 ]
+      Variable [ Name=$t3 ]
 ,
       FunctionCall tpch.tmp2@0[
       ]
       AS
-      Variable [ Name=t2 ]
+      Variable [ Name=$t2 ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=count_suppkey
           ]
           >=
@@ -428,38 +428,53 @@
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=t3 ]
+            Variable [ Name=$t3 ]
             Field=l_orderkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=l_orderkey
           ]
         ]
       ]
   )
   AS
-  Variable [ Name=t4 ]
+  Variable [ Name=$t4 ]
 ]
 Groupby
-  Variable [ Name=s_name ]
+  Variable [ Name=$s_name ]
   :=
   FieldAccessor [
-    Variable [ Name=t4 ]
+    Variable [ Name=$t4 ]
     Field=s_name
   ]
-  With
-  Variable [ Name=t4 ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$t4 ]
+   AS t4
+  )
 
-LetVariable [ Name=numwait ]
+Let Variable [ Name=$numwait ]
   :=
   FunctionCall tpch.count@1[
-    Variable [ Name=t4 ]
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#2 ]
+        Field=t4
+      ]
+      ]
+      FROM [        Variable [ Name=#1 ]
+        AS
+        Variable [ Name=#2 ]
+      ]
+    )
   ]
 Orderby
-  Variable [ Name=numwait ]
+  Variable [ Name=$numwait ]
   DESC
-  Variable [ Name=s_name ]
+  Variable [ Name=$s_name ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q22_global_sales_opportunity/q22_global_sales_opportunity.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q22_global_sales_opportunity/q22_global_sales_opportunity.3.ast
index 8efbfe5..063914d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q22_global_sales_opportunity/q22_global_sales_opportunity.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q22_global_sales_opportunity/q22_global_sales_opportunity.3.ast
@@ -7,7 +7,7 @@
         LiteralExpr [STRING] [c_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_acctbal
         ]
       )
@@ -15,7 +15,7 @@
         LiteralExpr [STRING] [c_custkey]
         :
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_custkey
         ]
       )
@@ -24,7 +24,7 @@
         :
         FunctionCall tpch.substring@3[
           FieldAccessor [
-            Variable [ Name=c ]
+            Variable [ Name=$c ]
             Field=c_phone
           ]
           LiteralExpr [LONG] [1]
@@ -33,21 +33,21 @@
       )
     ]
     ]
-    FROM [      Variable [ Name=Customer ]
+    FROM [      Variable [ Name=$Customer ]
       AS
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
     ]
   )
 }
 
 Query:
-LetVariable [ Name=avg ]
+Let Variable [ Name=$avg ]
   :=
   FunctionCall tpch.avg@1[
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_acctbal
       ]
       ]
@@ -55,12 +55,12 @@
           LiteralExpr [STRING] [Customer]
         ]
         AS
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
       ]
       Where
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=c ]
+            Variable [ Name=$c ]
             Field=c_acctbal
           ]
           >
@@ -73,13 +73,24 @@
   (
     LiteralExpr [STRING] [cntrycode]
     :
-    Variable [ Name=cntrycode ]
+    Variable [ Name=$cntrycode ]
   )
   (
     LiteralExpr [STRING] [numcust]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=ct ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=ct
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
   (
@@ -89,13 +100,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=c_acctbal
         ]
         ]
-        FROM [          Variable [ Name=ct ]
+        FROM [          Variable [ Name=$ct ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -105,29 +116,34 @@
 FROM [  FunctionCall tpch.q22_customer_tmp@0[
   ]
   AS
-  Variable [ Name=ct ]
+  Variable [ Name=$ct ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=ct ]
+      Variable [ Name=$ct ]
       Field=c_acctbal
     ]
     >
-    Variable [ Name=avg ]
+    Variable [ Name=$avg ]
   ]
 Groupby
-  Variable [ Name=cntrycode ]
+  Variable [ Name=$cntrycode ]
   :=
   FieldAccessor [
-    Variable [ Name=ct ]
+    Variable [ Name=$ct ]
     Field=cntrycode
   ]
-  With
-  Variable [ Name=ct ]
-  Variable [ Name=avg ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$ct ]
+   AS ct
+  Variable [ Name=$avg ]
+   AS avg
+  )
 
 Orderby
-  Variable [ Name=cntrycode ]
+  Variable [ Name=$cntrycode ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue562/query-issue562.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue562/query-issue562.3.ast
index a596782..a2adf67 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue562/query-issue562.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue562/query-issue562.3.ast
@@ -7,7 +7,7 @@
         LiteralExpr [STRING] [c_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_acctbal
         ]
       )
@@ -15,26 +15,26 @@
         LiteralExpr [STRING] [c_custkey]
         :
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_custkey
         ]
       )
       (
         LiteralExpr [STRING] [cntrycode]
         :
-        Variable [ Name=phone_substr ]
+        Variable [ Name=$phone_substr ]
       )
     ]
     ]
-    FROM [      Variable [ Name=Customer ]
+    FROM [      Variable [ Name=$Customer ]
       AS
-      Variable [ Name=c ]
+      Variable [ Name=$c ]
     ]
-    LetVariable [ Name=phone_substr ]
+    Let Variable [ Name=$phone_substr ]
       :=
       FunctionCall tpch.substring@3[
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_phone
         ]
         LiteralExpr [LONG] [1]
@@ -43,43 +43,43 @@
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [13]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [31]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [23]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [29]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [30]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [18]
         ]
         or
         OperatorExpr [
-          Variable [ Name=phone_substr ]
+          Variable [ Name=$phone_substr ]
           =
           LiteralExpr [STRING] [17]
         ]
@@ -88,13 +88,13 @@
 }
 
 Query:
-LetVariable [ Name=avg ]
+Let Variable [ Name=$avg ]
   :=
   FunctionCall tpch.avg@1[
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
         Field=c_acctbal
       ]
       ]
@@ -102,13 +102,13 @@
           LiteralExpr [STRING] [Customer]
         ]
         AS
-        Variable [ Name=c ]
+        Variable [ Name=$c ]
       ]
-      LetVariable [ Name=phone_substr ]
+      Let Variable [ Name=$phone_substr ]
         :=
         FunctionCall tpch.substring@3[
           FieldAccessor [
-            Variable [ Name=c ]
+            Variable [ Name=$c ]
             Field=c_phone
           ]
           LiteralExpr [LONG] [1]
@@ -118,7 +118,7 @@
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_acctbal
             ]
             >
@@ -127,43 +127,43 @@
           and
           OperatorExpr [
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [13]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [31]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [23]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [29]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [30]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [18]
             ]
             or
             OperatorExpr [
-              Variable [ Name=phone_substr ]
+              Variable [ Name=$phone_substr ]
               =
               LiteralExpr [STRING] [17]
             ]
@@ -176,13 +176,24 @@
   (
     LiteralExpr [STRING] [cntrycode]
     :
-    Variable [ Name=cntrycode ]
+    Variable [ Name=$cntrycode ]
   )
   (
     LiteralExpr [STRING] [numcust]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=ct ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=ct
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
   (
@@ -192,13 +203,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=c_acctbal
         ]
         ]
-        FROM [          Variable [ Name=ct ]
+        FROM [          Variable [ Name=$ct ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -208,30 +219,30 @@
 FROM [  FunctionCall tpch.q22_customer_tmp@0[
   ]
   AS
-  Variable [ Name=ct ]
+  Variable [ Name=$ct ]
 ]
 Where
   OperatorExpr [
     FunctionCall tpch.count@1[
       (
         SELECT ELEMENT [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [Orders]
           ]
           AS
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=ct ]
+              Variable [ Name=$ct ]
               Field=c_custkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_custkey
             ]
           ]
@@ -241,17 +252,22 @@
     LiteralExpr [LONG] [0]
   ]
 Groupby
-  Variable [ Name=cntrycode ]
+  Variable [ Name=$cntrycode ]
   :=
   FieldAccessor [
-    Variable [ Name=ct ]
+    Variable [ Name=$ct ]
     Field=cntrycode
   ]
-  With
-  Variable [ Name=ct ]
-  Variable [ Name=avg ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$ct ]
+   AS ct
+  Variable [ Name=$avg ]
+   AS avg
+  )
 
 Orderby
-  Variable [ Name=cntrycode ]
+  Variable [ Name=$cntrycode ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue601/query-issue601.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue601/query-issue601.3.ast
index 3776535..85c3c0d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue601/query-issue601.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue601/query-issue601.3.ast
@@ -5,13 +5,24 @@
   (
     LiteralExpr [STRING] [l_linenumber]
     :
-    Variable [ Name=l_linenumber ]
+    Variable [ Name=$l_linenumber ]
   )
   (
     LiteralExpr [STRING] [count_order]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=l ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
+        ]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS
+          Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]
@@ -20,15 +31,19 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Groupby
-  Variable [ Name=l_linenumber ]
+  Variable [ Name=$l_linenumber ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linenumber
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue638/query-issue638.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue638/query-issue638.3.ast
index 8052433..e455c20 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue638/query-issue638.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue638/query-issue638.3.ast
@@ -5,12 +5,12 @@
   (
     LiteralExpr [STRING] [nation]
     :
-    Variable [ Name=nation ]
+    Variable [ Name=$nation ]
   )
   (
     LiteralExpr [STRING] [o_year]
     :
-    Variable [ Name=o_year ]
+    Variable [ Name=$o_year ]
   )
   (
     LiteralExpr [STRING] [sum_profit]
@@ -19,13 +19,13 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=pr ]
+          Variable [ Name=$pr ]
           Field=amount
         ]
         ]
-        FROM [          Variable [ Name=profit ]
+        FROM [          Variable [ Name=$profit ]
           AS
-          Variable [ Name=pr ]
+          Variable [ Name=$pr ]
         ]
       )
     ]
@@ -39,19 +39,19 @@
         LiteralExpr [STRING] [nation]
         :
         FieldAccessor [
-          Variable [ Name=l3 ]
+          Variable [ Name=$l3 ]
           Field=n_name
         ]
       )
       (
         LiteralExpr [STRING] [o_year]
         :
-        Variable [ Name=o_year ]
+        Variable [ Name=$o_year ]
       )
       (
         LiteralExpr [STRING] [amount]
         :
-        Variable [ Name=amount ]
+        Variable [ Name=$amount ]
       )
     ]
     ]
@@ -59,7 +59,7 @@
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
 ,
       (
         SELECT ELEMENT [
@@ -68,7 +68,7 @@
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_extendedprice
             ]
           )
@@ -76,7 +76,7 @@
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_discount
             ]
           )
@@ -84,7 +84,7 @@
             LiteralExpr [STRING] [l_quantity]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_quantity
             ]
           )
@@ -92,7 +92,7 @@
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=l_orderkey
             ]
           )
@@ -100,7 +100,7 @@
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=n_name
             ]
           )
@@ -108,7 +108,7 @@
             LiteralExpr [STRING] [ps_supplycost]
             :
             FieldAccessor [
-              Variable [ Name=l2 ]
+              Variable [ Name=$l2 ]
               Field=ps_supplycost
             ]
           )
@@ -118,7 +118,7 @@
             LiteralExpr [STRING] [Part]
           ]
           AS
-          Variable [ Name=p ]
+          Variable [ Name=$p ]
 ,
           (
             SELECT ELEMENT [
@@ -127,7 +127,7 @@
                 LiteralExpr [STRING] [l_extendedprice]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_extendedprice
                 ]
               )
@@ -135,7 +135,7 @@
                 LiteralExpr [STRING] [l_discount]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_discount
                 ]
               )
@@ -143,7 +143,7 @@
                 LiteralExpr [STRING] [l_quantity]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_quantity
                 ]
               )
@@ -151,7 +151,7 @@
                 LiteralExpr [STRING] [l_partkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_partkey
                 ]
               )
@@ -159,7 +159,7 @@
                 LiteralExpr [STRING] [l_orderkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=l_orderkey
                 ]
               )
@@ -167,7 +167,7 @@
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=l1 ]
+                  Variable [ Name=$l1 ]
                   Field=n_name
                 ]
               )
@@ -175,7 +175,7 @@
                 LiteralExpr [STRING] [ps_supplycost]
                 :
                 FieldAccessor [
-                  Variable [ Name=ps ]
+                  Variable [ Name=$ps ]
                   Field=ps_supplycost
                 ]
               )
@@ -185,7 +185,7 @@
                 LiteralExpr [STRING] [Partsupp]
               ]
               AS
-              Variable [ Name=ps ]
+              Variable [ Name=$ps ]
 ,
               (
                 SELECT ELEMENT [
@@ -194,7 +194,7 @@
                     LiteralExpr [STRING] [l_suppkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_suppkey
                     ]
                   )
@@ -202,7 +202,7 @@
                     LiteralExpr [STRING] [l_extendedprice]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_extendedprice
                     ]
                   )
@@ -210,7 +210,7 @@
                     LiteralExpr [STRING] [l_discount]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_discount
                     ]
                   )
@@ -218,7 +218,7 @@
                     LiteralExpr [STRING] [l_quantity]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_quantity
                     ]
                   )
@@ -226,7 +226,7 @@
                     LiteralExpr [STRING] [l_partkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_partkey
                     ]
                   )
@@ -234,7 +234,7 @@
                     LiteralExpr [STRING] [l_orderkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_orderkey
                     ]
                   )
@@ -242,7 +242,7 @@
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=s1 ]
+                      Variable [ Name=$s1 ]
                       Field=n_name
                     ]
                   )
@@ -255,7 +255,7 @@
                         LiteralExpr [STRING] [s_suppkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=s ]
+                          Variable [ Name=$s ]
                           Field=s_suppkey
                         ]
                       )
@@ -263,7 +263,7 @@
                         LiteralExpr [STRING] [n_name]
                         :
                         FieldAccessor [
-                          Variable [ Name=n ]
+                          Variable [ Name=$n ]
                           Field=n_name
                         ]
                       )
@@ -273,87 +273,87 @@
                         LiteralExpr [STRING] [Supplier]
                       ]
                       AS
-                      Variable [ Name=s ]
+                      Variable [ Name=$s ]
 ,
                       FunctionCall Metadata.dataset@1[
                         LiteralExpr [STRING] [Nation]
                       ]
                       AS
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                     ]
                     Where
                       OperatorExpr [
                         FieldAccessor [
-                          Variable [ Name=n ]
+                          Variable [ Name=$n ]
                           Field=n_nationkey
                         ]
                         =
                         FieldAccessor [
-                          Variable [ Name=s ]
+                          Variable [ Name=$s ]
                           Field=s_nationkey
                         ]
                       ]
                   )
                   AS
-                  Variable [ Name=s1 ]
+                  Variable [ Name=$s1 ]
 ,
                   FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [LineItem]
                   ]
                   AS
-                  Variable [ Name=l ]
+                  Variable [ Name=$l ]
                 ]
                 Where
                   OperatorExpr [
                     FieldAccessor [
-                      Variable [ Name=s1 ]
+                      Variable [ Name=$s1 ]
                       Field=s_suppkey
                     ]
                     =
                     FieldAccessor [
-                      Variable [ Name=l ]
+                      Variable [ Name=$l ]
                       Field=l_suppkey
                     ]
                   ]
               )
               AS
-              Variable [ Name=l1 ]
+              Variable [ Name=$l1 ]
             ]
             Where
               OperatorExpr [
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=ps ]
+                    Variable [ Name=$ps ]
                     Field=ps_suppkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_suppkey
                   ]
                 ]
                 and
                 OperatorExpr [
                   FieldAccessor [
-                    Variable [ Name=ps ]
+                    Variable [ Name=$ps ]
                     Field=ps_partkey
                   ]
                   =
                   FieldAccessor [
-                    Variable [ Name=l1 ]
+                    Variable [ Name=$l1 ]
                     Field=l_partkey
                   ]
                 ]
               ]
           )
           AS
-          Variable [ Name=l2 ]
+          Variable [ Name=$l2 ]
         ]
         Where
           OperatorExpr [
             FunctionCall tpch.contains@2[
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_name
               ]
               LiteralExpr [STRING] [green]
@@ -361,26 +361,26 @@
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=p ]
+                Variable [ Name=$p ]
                 Field=p_partkey
               ]
               =
               FieldAccessor [
-                Variable [ Name=l2 ]
+                Variable [ Name=$l2 ]
                 Field=l_partkey
               ]
             ]
           ]
       )
       AS
-      Variable [ Name=l3 ]
+      Variable [ Name=$l3 ]
     ]
-    LetVariable [ Name=amount ]
+    Let Variable [ Name=$amount ]
       :=
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=l_extendedprice
           ]
           *
@@ -388,7 +388,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=l3 ]
+              Variable [ Name=$l3 ]
               Field=l_discount
             ]
           ]
@@ -396,59 +396,63 @@
         -
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=ps_supplycost
           ]
           *
           FieldAccessor [
-            Variable [ Name=l3 ]
+            Variable [ Name=$l3 ]
             Field=l_quantity
           ]
         ]
       ]
-    LetVariable [ Name=o_year ]
+    Let Variable [ Name=$o_year ]
       :=
       FunctionCall tpch.get-year@1[
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderdate
         ]
       ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_orderkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=l3 ]
+          Variable [ Name=$l3 ]
           Field=l_orderkey
         ]
       ]
   )
   AS
-  Variable [ Name=profit ]
+  Variable [ Name=$profit ]
 ]
 Groupby
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
   :=
   FieldAccessor [
-    Variable [ Name=profit ]
+    Variable [ Name=$profit ]
     Field=nation
   ]
-  Variable [ Name=o_year ]
+  Variable [ Name=$o_year ]
   :=
   FieldAccessor [
-    Variable [ Name=profit ]
+    Variable [ Name=$profit ]
     Field=o_year
   ]
-  With
-  Variable [ Name=profit ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$profit ]
+   AS profit
+  )
 
 Orderby
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
   ASC
-  Variable [ Name=o_year ]
+  Variable [ Name=$o_year ]
   DESC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue785-2/query-issue785-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue785-2/query-issue785-2.3.ast
index 715999d..3b22218 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue785-2/query-issue785-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue785-2/query-issue785-2.3.ast
@@ -1,6 +1,6 @@
 DataverseUse tpch
 Query:
-LetVariable [ Name=t ]
+Let Variable [ Name=$t ]
   :=
   (
     SELECT ELEMENT [
@@ -9,7 +9,7 @@
         LiteralExpr [STRING] [n_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_nationkey
         ]
       )
@@ -17,7 +17,7 @@
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_name
         ]
       )
@@ -27,28 +27,28 @@
         LiteralExpr [STRING] [Nation]
       ]
       AS
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [SelectedNation]
       ]
       AS
-      Variable [ Name=sn ]
+      Variable [ Name=$sn ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_nationkey
         ]
         =
         FieldAccessor [
-          Variable [ Name=sn ]
+          Variable [ Name=$sn ]
           Field=n_nationkey
         ]
       ]
   )
-LetVariable [ Name=X ]
+Let Variable [ Name=$X ]
   :=
   (
     SELECT ELEMENT [
@@ -56,94 +56,101 @@
       (
         LiteralExpr [STRING] [nation_key]
         :
-        Variable [ Name=nation_key ]
+        Variable [ Name=$nation_key ]
       )
       (
         LiteralExpr [STRING] [order_date]
         :
-        Variable [ Name=orderdate ]
+        Variable [ Name=$orderdate ]
       )
       (
         LiteralExpr [STRING] [sum_price]
         :
-        Variable [ Name=sum ]
+        Variable [ Name=$sum ]
       )
     ]
     ]
-    FROM [      Variable [ Name=t ]
+    FROM [      Variable [ Name=$t ]
       AS
-      Variable [ Name=n ]
+      Variable [ Name=$n ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Customer]
       ]
       AS
-      Variable [ Name=customer ]
+      Variable [ Name=$customer ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=orders ]
+      Variable [ Name=$orders ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=orders ]
+            Variable [ Name=$orders ]
             Field=o_custkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_custkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_nationkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
             Field=n_nationkey
           ]
         ]
       ]
     Groupby
-      Variable [ Name=orderdate ]
+      Variable [ Name=$orderdate ]
       :=
       FieldAccessor [
-        Variable [ Name=orders ]
+        Variable [ Name=$orders ]
         Field=o_orderdate
       ]
-      Variable [ Name=nation_key ]
+      Variable [ Name=$nation_key ]
       :=
       FieldAccessor [
-        Variable [ Name=n ]
+        Variable [ Name=$n ]
         Field=n_nationkey
       ]
-      With
-      Variable [ Name=orders ]
-      Variable [ Name=n ]
-      Variable [ Name=customer ]
-      Variable [ Name=t ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$orders ]
+       AS orders
+      Variable [ Name=$customer ]
+       AS customer
+      Variable [ Name=$n ]
+       AS n
+      Variable [ Name=$t ]
+       AS t
+      )
 
-    LetVariable [ Name=sum ]
+    Let Variable [ Name=$sum ]
       :=
       FunctionCall tpch.sum@1[
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_totalprice
           ]
           ]
-          FROM [            Variable [ Name=orders ]
+          FROM [            Variable [ Name=$orders ]
             AS
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
           ]
         )
       ]
@@ -153,7 +160,7 @@
   (
     LiteralExpr [STRING] [nation_key]
     :
-    Variable [ Name=nation_key ]
+    Variable [ Name=$nation_key ]
   )
   (
     LiteralExpr [STRING] [sum_price]
@@ -165,7 +172,7 @@
           LiteralExpr [STRING] [orderdate]
           :
           FieldAccessor [
-            Variable [ Name=y ]
+            Variable [ Name=$y ]
             Field=order_date
           ]
         )
@@ -173,19 +180,19 @@
           LiteralExpr [STRING] [sum_price]
           :
           FieldAccessor [
-            Variable [ Name=y ]
+            Variable [ Name=$y ]
             Field=sum_price
           ]
         )
       ]
       ]
-      FROM [        Variable [ Name=x ]
+      FROM [        Variable [ Name=$x ]
         AS
-        Variable [ Name=y ]
+        Variable [ Name=$y ]
       ]
       Orderby
         FieldAccessor [
-          Variable [ Name=y ]
+          Variable [ Name=$y ]
           Field=sum_price
         ]
         DESC
@@ -196,19 +203,25 @@
   )
 ]
 ]
-FROM [  Variable [ Name=X ]
+FROM [  Variable [ Name=$X ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Groupby
-  Variable [ Name=nation_key ]
+  Variable [ Name=$nation_key ]
   :=
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=nation_key
   ]
-  With
-  Variable [ Name=x ]
-  Variable [ Name=X ]
-  Variable [ Name=t ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$x ]
+   AS x
+  Variable [ Name=$X ]
+   AS X
+  Variable [ Name=$t ]
+   AS t
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue785/query-issue785.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue785/query-issue785.3.ast
index f69a6be..e59376e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue785/query-issue785.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue785/query-issue785.3.ast
@@ -5,7 +5,7 @@
   (
     LiteralExpr [STRING] [nation_key]
     :
-    Variable [ Name=nation_key ]
+    Variable [ Name=$nation_key ]
   )
   (
     LiteralExpr [STRING] [sum_price]
@@ -16,49 +16,57 @@
         (
           LiteralExpr [STRING] [orderdate]
           :
-          Variable [ Name=od ]
+          Variable [ Name=$od ]
         )
         (
           LiteralExpr [STRING] [sum_price]
           :
-          Variable [ Name=sum ]
+          Variable [ Name=$sum ]
         )
       ]
       ]
-      FROM [        Variable [ Name=x ]
+      FROM [        Variable [ Name=$x ]
         AS
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
       ]
       Groupby
-        Variable [ Name=od ]
+        Variable [ Name=$od ]
         :=
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=order_date
         ]
-        With
-        Variable [ Name=i ]
-        Variable [ Name=x ]
-        Variable [ Name=nation_key ]
+        GROUP AS
+        Variable [ Name=#3 ]
+        (
+        Variable [ Name=$i ]
+         AS i
+        Variable [ Name=$x ]
+         AS x
+        Variable [ Name=$nation_key ]
+         AS nation_key
+        Variable [ Name=#2 ]
+         AS #2
+        )
 
-      LetVariable [ Name=sum ]
+      Let Variable [ Name=$sum ]
         :=
         FunctionCall tpch.sum@1[
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
               Field=sum_price
             ]
             ]
-            FROM [              Variable [ Name=i ]
+            FROM [              Variable [ Name=$i ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
             ]
           )
         ]
       Orderby
-        Variable [ Name=sum ]
+        Variable [ Name=$sum ]
         DESC
 
       Limit
@@ -73,12 +81,12 @@
       (
         LiteralExpr [STRING] [nation_key]
         :
-        Variable [ Name=nation_key ]
+        Variable [ Name=$nation_key ]
       )
       (
         LiteralExpr [STRING] [order_date]
         :
-        Variable [ Name=orderdate ]
+        Variable [ Name=$orderdate ]
       )
       (
         LiteralExpr [STRING] [sum_price]
@@ -87,13 +95,13 @@
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_totalprice
             ]
             ]
-            FROM [              Variable [ Name=orders ]
+            FROM [              Variable [ Name=$orders ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
             ]
           )
         ]
@@ -104,75 +112,85 @@
         LiteralExpr [STRING] [Nation]
       ]
       AS
-      Variable [ Name=n ]
+      Variable [ Name=$n ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Customer]
       ]
       AS
-      Variable [ Name=customer ]
+      Variable [ Name=$customer ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=orders ]
+      Variable [ Name=$orders ]
     ]
     Where
       OperatorExpr [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=orders ]
+            Variable [ Name=$orders ]
             Field=o_custkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_custkey
           ]
         ]
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=customer ]
+            Variable [ Name=$customer ]
             Field=c_nationkey
           ]
           =
           FieldAccessor [
-            Variable [ Name=n ]
+            Variable [ Name=$n ]
             Field=n_nationkey
           ]
         ]
       ]
     Groupby
-      Variable [ Name=orderdate ]
+      Variable [ Name=$orderdate ]
       :=
       FieldAccessor [
-        Variable [ Name=orders ]
+        Variable [ Name=$orders ]
         Field=o_orderdate
       ]
-      Variable [ Name=nation_key ]
+      Variable [ Name=$nation_key ]
       :=
       FieldAccessor [
-        Variable [ Name=n ]
+        Variable [ Name=$n ]
         Field=n_nationkey
       ]
-      With
-      Variable [ Name=orders ]
-      Variable [ Name=n ]
-      Variable [ Name=customer ]
+      GROUP AS
+      Variable [ Name=#1 ]
+      (
+      Variable [ Name=$orders ]
+       AS orders
+      Variable [ Name=$customer ]
+       AS customer
+      Variable [ Name=$n ]
+       AS n
+      )
 
   )
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Groupby
-  Variable [ Name=nation_key ]
+  Variable [ Name=$nation_key ]
   :=
   FieldAccessor [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     Field=nation_key
   ]
-  With
-  Variable [ Name=x ]
+  GROUP AS
+  Variable [ Name=#2 ]
+  (
+  Variable [ Name=$x ]
+   AS x
+  )
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue786/query-issue786.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue786/query-issue786.3.ast
index dcd0269..4cd1b1f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue786/query-issue786.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue786/query-issue786.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [nation_key]
     :
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_nationkey
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_name
     ]
   )
@@ -27,12 +27,12 @@
         (
           LiteralExpr [STRING] [order_date]
           :
-          Variable [ Name=orderdate ]
+          Variable [ Name=$orderdate ]
         )
         (
           LiteralExpr [STRING] [sum_price]
           :
-          Variable [ Name=sum ]
+          Variable [ Name=$sum ]
         )
       ]
       ]
@@ -40,71 +40,78 @@
           LiteralExpr [STRING] [Orders]
         ]
         AS
-        Variable [ Name=orders ]
+        Variable [ Name=$orders ]
 ,
         FunctionCall Metadata.dataset@1[
           LiteralExpr [STRING] [Customer]
         ]
         AS
-        Variable [ Name=customer ]
+        Variable [ Name=$customer ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=orders ]
+              Variable [ Name=$orders ]
               Field=o_custkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=customer ]
+              Variable [ Name=$customer ]
               Field=c_custkey
             ]
           ]
           and
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=customer ]
+              Variable [ Name=$customer ]
               Field=c_nationkey
             ]
             =
             FieldAccessor [
-              Variable [ Name=nation ]
+              Variable [ Name=$nation ]
               Field=n_nationkey
             ]
           ]
         ]
       Groupby
-        Variable [ Name=orderdate ]
+        Variable [ Name=$orderdate ]
         :=
         FieldAccessor [
-          Variable [ Name=orders ]
+          Variable [ Name=$orders ]
           Field=o_orderdate
         ]
-        With
-        Variable [ Name=orders ]
-        Variable [ Name=customer ]
-        Variable [ Name=nation ]
-        Variable [ Name=sn ]
+        GROUP AS
+        Variable [ Name=#1 ]
+        (
+        Variable [ Name=$customer ]
+         AS customer
+        Variable [ Name=$orders ]
+         AS orders
+        Variable [ Name=$sn ]
+         AS sn
+        Variable [ Name=$nation ]
+         AS nation
+        )
 
-      LetVariable [ Name=sum ]
+      Let Variable [ Name=$sum ]
         :=
         FunctionCall tpch.sum@1[
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
               Field=o_totalprice
             ]
             ]
-            FROM [              Variable [ Name=orders ]
+            FROM [              Variable [ Name=$orders ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
             ]
           )
         ]
       Orderby
-        Variable [ Name=sum ]
+        Variable [ Name=$sum ]
         DESC
 
       Limit
@@ -117,23 +124,23 @@
     LiteralExpr [STRING] [Nation]
   ]
   AS
-  Variable [ Name=nation ]
+  Variable [ Name=$nation ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [SelectedNation]
   ]
   AS
-  Variable [ Name=sn ]
+  Variable [ Name=$sn ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=nation ]
+      Variable [ Name=$nation ]
       Field=n_nationkey
     ]
     =
     FieldAccessor [
-      Variable [ Name=sn ]
+      Variable [ Name=$sn ]
       Field=sn_nationkey
     ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810-2/query-issue810-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810-2/query-issue810-2.3.ast
index 089c6df..09ab092 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810-2/query-issue810-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810-2/query-issue810-2.3.ast
@@ -5,25 +5,25 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [count_cheaps]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=cheaps ]
+      Variable [ Name=$cheaps ]
     ]
   )
   (
     LiteralExpr [STRING] [total_charges]
     :
     FunctionCall tpch.sum@1[
-      Variable [ Name=charges ]
+      Variable [ Name=$charges ]
     ]
   )
 ]
@@ -32,60 +32,64 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipdate
     ]
     <=
     LiteralExpr [STRING] [1998-09-02]
   ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
-LetVariable [ Name=cheaps ]
+Let Variable [ Name=$cheaps ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=m ]
+          Variable [ Name=$m ]
           Field=l_discount
         ]
         >
         LiteralExpr [DOUBLE] [0.05]
       ]
   )
-LetVariable [ Name=charges ]
+Let Variable [ Name=$charges ]
   :=
   (
     SELECT ELEMENT [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=l_extendedprice
       ]
       *
@@ -93,7 +97,7 @@
         LiteralExpr [LONG] [1]
         -
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=l_discount
         ]
       ]
@@ -102,20 +106,20 @@
         LiteralExpr [LONG] [1]
         +
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=l_tax
         ]
       ]
     ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
     ]
   )
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810-3/query-issue810-3.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810-3/query-issue810-3.3.ast
index acfa243..2e01301 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810-3/query-issue810-3.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810-3/query-issue810-3.3.ast
@@ -5,39 +5,39 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [count_cheaps]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=cheaps ]
+      Variable [ Name=$cheaps ]
     ]
   )
   (
     LiteralExpr [STRING] [avg_expensive_discounts]
     :
     FunctionCall tpch.avg@1[
-      Variable [ Name=expensives ]
+      Variable [ Name=$expensives ]
     ]
   )
   (
     LiteralExpr [STRING] [sum_disc_prices]
     :
     FunctionCall tpch.sum@1[
-      Variable [ Name=disc_prices ]
+      Variable [ Name=$disc_prices ]
     ]
   )
   (
     LiteralExpr [STRING] [total_charges]
     :
     FunctionCall tpch.sum@1[
-      Variable [ Name=charges ]
+      Variable [ Name=$charges ]
     ]
   )
 ]
@@ -46,83 +46,87 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipdate
     ]
     <=
     LiteralExpr [STRING] [1998-09-02]
   ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
-LetVariable [ Name=expensives ]
+Let Variable [ Name=$expensives ]
   :=
   (
     SELECT ELEMENT [
     FieldAccessor [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       Field=l_discount
     ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         <=
         LiteralExpr [DOUBLE] [0.05]
       ]
   )
-LetVariable [ Name=cheaps ]
+Let Variable [ Name=$cheaps ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         >
         LiteralExpr [DOUBLE] [0.05]
       ]
   )
-LetVariable [ Name=charges ]
+Let Variable [ Name=$charges ]
   :=
   (
     SELECT ELEMENT [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=l_extendedprice
       ]
       *
@@ -130,7 +134,7 @@
         LiteralExpr [LONG] [1]
         -
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
       ]
@@ -139,24 +143,24 @@
         LiteralExpr [LONG] [1]
         +
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_tax
         ]
       ]
     ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
   )
-LetVariable [ Name=disc_prices ]
+Let Variable [ Name=$disc_prices ]
   :=
   (
     SELECT ELEMENT [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         Field=l_extendedprice
       ]
       *
@@ -164,20 +168,20 @@
         LiteralExpr [LONG] [1]
         -
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
       ]
     ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
     ]
   )
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810/query-issue810.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810/query-issue810.3.ast
index 1b42b9f..430ea72 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810/query-issue810.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue810/query-issue810.3.ast
@@ -5,25 +5,25 @@
   (
     LiteralExpr [STRING] [l_returnflag]
     :
-    Variable [ Name=l_returnflag ]
+    Variable [ Name=$l_returnflag ]
   )
   (
     LiteralExpr [STRING] [l_linestatus]
     :
-    Variable [ Name=l_linestatus ]
+    Variable [ Name=$l_linestatus ]
   )
   (
     LiteralExpr [STRING] [count_cheaps]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=cheap ]
+      Variable [ Name=$cheap ]
     ]
   )
   (
     LiteralExpr [STRING] [count_expensives]
     :
     FunctionCall tpch.count@1[
-      Variable [ Name=expensive ]
+      Variable [ Name=$expensive ]
     ]
   )
 ]
@@ -32,67 +32,71 @@
     LiteralExpr [STRING] [LineItem]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=l_shipdate
     ]
     <=
     LiteralExpr [STRING] [1998-09-02]
   ]
 Groupby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_returnflag
   ]
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   :=
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  With
-  Variable [ Name=l ]
+  GROUP AS
+  Variable [ Name=#1 ]
+  (
+  Variable [ Name=$l ]
+   AS l
+  )
 
-LetVariable [ Name=cheap ]
+Let Variable [ Name=$cheap ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=m ]
+    Variable [ Name=$m ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=m ]
+      Variable [ Name=$m ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=m ]
+          Variable [ Name=$m ]
           Field=l_discount
         ]
         >
         LiteralExpr [DOUBLE] [0.05]
       ]
   )
-LetVariable [ Name=expensive ]
+Let Variable [ Name=$expensive ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     ]
-    FROM [      Variable [ Name=l ]
+    FROM [      Variable [ Name=$l ]
       AS
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=a ]
+          Variable [ Name=$a ]
           Field=l_discount
         ]
         <=
@@ -100,8 +104,8 @@
       ]
   )
 Orderby
-  Variable [ Name=l_returnflag ]
+  Variable [ Name=$l_returnflag ]
   ASC
-  Variable [ Name=l_linestatus ]
+  Variable [ Name=$l_linestatus ]
   ASC
 
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue827-2/query-issue827-2.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue827-2/query-issue827-2.3.ast
index 54fa4ec..ad296a8 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue827-2/query-issue827-2.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue827-2/query-issue827-2.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
@@ -16,12 +16,12 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_shipdate
             ]
             <=
@@ -37,7 +37,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
@@ -45,7 +45,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -58,7 +58,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -66,7 +66,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -76,7 +76,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -89,7 +89,7 @@
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -97,7 +97,7 @@
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -106,7 +106,7 @@
             LiteralExpr [LONG] [1]
             +
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_tax
             ]
           ]
@@ -116,7 +116,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -128,7 +128,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_quantity
         ]
         ]
@@ -136,12 +136,12 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_shipdate
             ]
             <=
@@ -157,7 +157,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_extendedprice
         ]
         ]
@@ -165,7 +165,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -177,7 +177,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
         ]
@@ -185,7 +185,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
       )
     ]
@@ -196,13 +196,13 @@
     FunctionCall tpch.count@1[
       (
         SELECT ELEMENT [
-        Variable [ Name=l ]
+        Variable [ Name=$l ]
         ]
         FROM [          FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue827/query-issue827.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue827/query-issue827.3.ast
index 1772697..8c3f767 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue827/query-issue827.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/query-issue827/query-issue827.3.ast
@@ -8,7 +8,7 @@
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_quantity
         ]
         ]
@@ -16,7 +16,7 @@
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
         ]
       )
     ]
@@ -27,12 +27,12 @@
     FunctionCall tpch.sum@1[
       (
         SELECT ELEMENT [
-        Variable [ Name=e ]
+        Variable [ Name=$e ]
         ]
         FROM [          (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_extendedprice
             ]
             ]
@@ -40,11 +40,11 @@
                 LiteralExpr [STRING] [LineItem]
               ]
               AS
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
             ]
           )
           AS
-          Variable [ Name=e ]
+          Variable [ Name=$e ]
         ]
       )
     ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/opentype_orderby_01/opentype_orderby_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/opentype_orderby_01/opentype_orderby_01.3.ast
index 7c249a9..6e865d00 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/opentype_orderby_01/opentype_orderby_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/opentype_orderby_01/opentype_orderby_01.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -24,16 +24,16 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_01/promotion_closedtype_field_vs_closedtype_field_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_01/promotion_closedtype_field_vs_closedtype_field_01.3.ast
index 6629906..f9aa2ab 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_01/promotion_closedtype_field_vs_closedtype_field_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_01/promotion_closedtype_field_vs_closedtype_field_01.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dept.did]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=did
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [emp.worksince]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [dept.dsince]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dsince
     ]
   )
@@ -40,44 +40,44 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
     =
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dsince
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=worksince
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=dsince
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_02/promotion_closedtype_field_vs_closedtype_field_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_02/promotion_closedtype_field_vs_closedtype_field_02.3.ast
index 0c15385..074b476 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_02/promotion_closedtype_field_vs_closedtype_field_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_02/promotion_closedtype_field_vs_closedtype_field_02.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dept.did]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=did
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [emp.worksince]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
   )
@@ -31,7 +31,7 @@
     :
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=dept ]
+        Variable [ Name=$dept ]
         Field=bossidint32
       ]
       +
@@ -44,24 +44,24 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
     =
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=dept ]
+        Variable [ Name=$dept ]
         Field=bossidint32
       ]
       +
@@ -70,22 +70,22 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=worksince
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=bossidint32
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_03/promotion_closedtype_field_vs_closedtype_field_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_03/promotion_closedtype_field_vs_closedtype_field_03.3.ast
index 2dd04ce..51d0ae9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_03/promotion_closedtype_field_vs_closedtype_field_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_03/promotion_closedtype_field_vs_closedtype_field_03.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dept.did]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=did
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [emp.age]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [dept.bossid]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=bossid
     ]
   )
@@ -40,44 +40,44 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=bossid
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=age
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=bossid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_04/promotion_closedtype_field_vs_closedtype_field_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_04/promotion_closedtype_field_vs_closedtype_field_04.3.ast
index 74eecbe..544d403 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_04/promotion_closedtype_field_vs_closedtype_field_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_04/promotion_closedtype_field_vs_closedtype_field_04.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dept.did]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=did
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [emp.age]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [dept.bossidint32]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=bossidint32
     ]
   )
@@ -40,44 +40,44 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=bossidint32
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=age
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=bossidint32
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_05/promotion_closedtype_field_vs_closedtype_field_05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_05/promotion_closedtype_field_vs_closedtype_field_05.3.ast
index b585f88..3c1440a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_05/promotion_closedtype_field_vs_closedtype_field_05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_closedtype_field_05/promotion_closedtype_field_vs_closedtype_field_05.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dept.did]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=did
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [emp.empno]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=empno
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [dept.dno]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dno
     ]
   )
@@ -40,44 +40,44 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=empno
     ]
     =
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dno
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=empno
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=dno
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_01/promotion_closedtype_field_vs_constant_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_01/promotion_closedtype_field_vs_constant_01.3.ast
index 02b5f0e..3965471 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_01/promotion_closedtype_field_vs_constant_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_01/promotion_closedtype_field_vs_constant_01.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.age]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=age
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_02/promotion_closedtype_field_vs_constant_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_02/promotion_closedtype_field_vs_constant_02.3.ast
index f51b604..b4551ab 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_02/promotion_closedtype_field_vs_constant_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_02/promotion_closedtype_field_vs_constant_02.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.age]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=age
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_03/promotion_closedtype_field_vs_constant_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_03/promotion_closedtype_field_vs_constant_03.3.ast
index e5ebaf1..0cf8281 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_03/promotion_closedtype_field_vs_constant_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_03/promotion_closedtype_field_vs_constant_03.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.age]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=age
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_04/promotion_closedtype_field_vs_constant_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_04/promotion_closedtype_field_vs_constant_04.3.ast
index 777b12c..7f644e6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_04/promotion_closedtype_field_vs_constant_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_04/promotion_closedtype_field_vs_constant_04.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.age]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=age
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_05/promotion_closedtype_field_vs_constant_05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_05/promotion_closedtype_field_vs_constant_05.3.ast
index c2ec21c..aa1e0d3 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_05/promotion_closedtype_field_vs_constant_05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_05/promotion_closedtype_field_vs_constant_05.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.age]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=age
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_06/promotion_closedtype_field_vs_constant_06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_06/promotion_closedtype_field_vs_constant_06.3.ast
index 777b12c..7f644e6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_06/promotion_closedtype_field_vs_constant_06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_06/promotion_closedtype_field_vs_constant_06.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.age]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=age
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=age
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_07/promotion_closedtype_field_vs_constant_07.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_07/promotion_closedtype_field_vs_constant_07.3.ast
index 214e38e..5594115 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_07/promotion_closedtype_field_vs_constant_07.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_07/promotion_closedtype_field_vs_constant_07.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.worksince]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=worksince
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_08/promotion_closedtype_field_vs_constant_08.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_08/promotion_closedtype_field_vs_constant_08.3.ast
index 7ee46ca..eaaaa6e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_08/promotion_closedtype_field_vs_constant_08.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_08/promotion_closedtype_field_vs_constant_08.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.worksince]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=worksince
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_09/promotion_closedtype_field_vs_constant_09.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_09/promotion_closedtype_field_vs_constant_09.3.ast
index 22722fb..fe2fdfb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_09/promotion_closedtype_field_vs_constant_09.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_09/promotion_closedtype_field_vs_constant_09.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.worksince]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=worksince
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_10/promotion_closedtype_field_vs_constant_10.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_10/promotion_closedtype_field_vs_constant_10.3.ast
index 5086dda..c346569 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_10/promotion_closedtype_field_vs_constant_10.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_10/promotion_closedtype_field_vs_constant_10.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.worksince]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=worksince
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_11/promotion_closedtype_field_vs_constant_11.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_11/promotion_closedtype_field_vs_constant_11.3.ast
index 07a5b65..4b743fe 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_11/promotion_closedtype_field_vs_constant_11.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_constant_11/promotion_closedtype_field_vs_constant_11.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.worksince]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=worksince
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=worksince
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_01/promotion_closedtype_field_vs_opentype_field_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_01/promotion_closedtype_field_vs_opentype_field_01.3.ast
index 27559d3..13d89f7 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_01/promotion_closedtype_field_vs_opentype_field_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_01/promotion_closedtype_field_vs_opentype_field_01.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dept.did]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=did
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [dept.bossid]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=bossid
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [emp.suprvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -40,39 +40,39 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=bossid
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_02/promotion_closedtype_field_vs_opentype_field_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_02/promotion_closedtype_field_vs_opentype_field_02.3.ast
index 9f9c288..ff2e1cd 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_02/promotion_closedtype_field_vs_opentype_field_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_02/promotion_closedtype_field_vs_opentype_field_02.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dept.did]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=did
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [dept.floor]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=floor
     ]
   )
@@ -40,44 +40,44 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=floor
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=floor
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_03/promotion_closedtype_field_vs_opentype_field_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_03/promotion_closedtype_field_vs_opentype_field_03.3.ast
index 44fbf52..2cce29f 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_03/promotion_closedtype_field_vs_opentype_field_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_03/promotion_closedtype_field_vs_opentype_field_03.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dept.did]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=did
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [emp.empno]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=empno
     ]
   )
@@ -30,7 +30,7 @@
     LiteralExpr [STRING] [dept.dmgrid]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dmgrid
     ]
   )
@@ -40,44 +40,44 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=empno
     ]
     =
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dmgrid
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=empno
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=dmgrid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_04/promotion_closedtype_field_vs_opentype_field_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_04/promotion_closedtype_field_vs_opentype_field_04.3.ast
index 1fe8d41..94c4097 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_04/promotion_closedtype_field_vs_opentype_field_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_closedtype_field_vs_opentype_field_04/promotion_closedtype_field_vs_opentype_field_04.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [dept.did]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=did
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [dept.dmgrid]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dmgrid
     ]
   )
@@ -32,44 +32,44 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
     =
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dmgrid
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=dmgrid
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=dept ]
+    Variable [ Name=$dept ]
     Field=did
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_01/promotion_opentype_field_vs_constant_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_01/promotion_opentype_field_vs_constant_01.3.ast
index 8009cba..b0faed9 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_01/promotion_opentype_field_vs_constant_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_01/promotion_opentype_field_vs_constant_01.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_02/promotion_opentype_field_vs_constant_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_02/promotion_opentype_field_vs_constant_02.3.ast
index de2723f..8b3dd65 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_02/promotion_opentype_field_vs_constant_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_02/promotion_opentype_field_vs_constant_02.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_03/promotion_opentype_field_vs_constant_03.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_03/promotion_opentype_field_vs_constant_03.3.ast
index 1890f69..6e5db45 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_03/promotion_opentype_field_vs_constant_03.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_03/promotion_opentype_field_vs_constant_03.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_04/promotion_opentype_field_vs_constant_04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_04/promotion_opentype_field_vs_constant_04.3.ast
index 48c2353..d2e4c76 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_04/promotion_opentype_field_vs_constant_04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_04/promotion_opentype_field_vs_constant_04.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_05/promotion_opentype_field_vs_constant_05.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_05/promotion_opentype_field_vs_constant_05.3.ast
index ad390f5..c2788a6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_05/promotion_opentype_field_vs_constant_05.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_05/promotion_opentype_field_vs_constant_05.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_06/promotion_opentype_field_vs_constant_06.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_06/promotion_opentype_field_vs_constant_06.3.ast
index 9e86eb4..bdb3906 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_06/promotion_opentype_field_vs_constant_06.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_06/promotion_opentype_field_vs_constant_06.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_07/promotion_opentype_field_vs_constant_07.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_07/promotion_opentype_field_vs_constant_07.3.ast
index 49d1656..8f5fc41 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_07/promotion_opentype_field_vs_constant_07.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_07/promotion_opentype_field_vs_constant_07.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
@@ -37,12 +37,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_08/promotion_opentype_field_vs_constant_08.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_08/promotion_opentype_field_vs_constant_08.3.ast
index e0398c8..972ced0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_08/promotion_opentype_field_vs_constant_08.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_constant_08/promotion_opentype_field_vs_constant_08.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.supvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -24,12 +24,12 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
@@ -39,12 +39,12 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=supvrid
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_opentype_field_01/promotion_opentype_field_vs_opentype_field_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_opentype_field_01/promotion_opentype_field_vs_opentype_field_01.3.ast
index ca35d9a..719ef23 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_opentype_field_01/promotion_opentype_field_vs_opentype_field_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_opentype_field_01/promotion_opentype_field_vs_opentype_field_01.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.suprvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [dept.dmgrid2]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dmgrid2
     ]
   )
@@ -32,29 +32,29 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
     =
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dmgrid2
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_opentype_field_02/promotion_opentype_field_vs_opentype_field_02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_opentype_field_02/promotion_opentype_field_vs_opentype_field_02.3.ast
index f639cd0..e011d74 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_opentype_field_02/promotion_opentype_field_vs_opentype_field_02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/promotion_opentype_field_vs_opentype_field_02/promotion_opentype_field_vs_opentype_field_02.3.ast
@@ -6,7 +6,7 @@
     LiteralExpr [STRING] [emp.id]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=id
     ]
   )
@@ -14,7 +14,7 @@
     LiteralExpr [STRING] [emp.suprvrid]
     :
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   )
@@ -22,7 +22,7 @@
     LiteralExpr [STRING] [dept.dmgrid2]
     :
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dmgrid2
     ]
   )
@@ -32,29 +32,29 @@
     LiteralExpr [STRING] [empDataset]
   ]
   AS
-  Variable [ Name=emp ]
+  Variable [ Name=$emp ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [deptDataset]
   ]
   AS
-  Variable [ Name=dept ]
+  Variable [ Name=$dept ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=dept ]
+      Variable [ Name=$dept ]
       Field=dmgrid2
     ]
     =
     FieldAccessor [
-      Variable [ Name=emp ]
+      Variable [ Name=$emp ]
       Field=supvrid
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=emp ]
+    Variable [ Name=$emp ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/type_promotion_0/type_promotion_0.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/type_promotion_0/type_promotion_0.3.ast
index b7ae27c..1652835 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/type_promotion_0/type_promotion_0.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/type_promotion_0/type_promotion_0.3.ast
@@ -1,11 +1,11 @@
 DataverseUse TestVerse
 Query:
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Int64Test]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/type_promotion_1/type_promotion_1.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/type_promotion_1/type_promotion_1.3.ast
index 4c16b66..0c83f61 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/type_promotion_1/type_promotion_1.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/types/type_promotion_1/type_promotion_1.3.ast
@@ -1,11 +1,11 @@
 DataverseUse TestDataverse
 Query:
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TestSet]
   ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/invoke-private-function/invoke-private-function.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/invoke-private-function/invoke-private-function.3.ast
index 5b72053..4d168c2 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/invoke-private-function/invoke-private-function.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/invoke-private-function/invoke-private-function.3.ast
@@ -1,10 +1,10 @@
 DataverseUse test
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   OrderedListConstructor [
   ]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -13,7 +13,7 @@
     LiteralExpr [STRING] [def]
     LiteralExpr [STRING] [efg]
   ]
-LetVariable [ Name=c ]
+Let Variable [ Name=$c ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -24,7 +24,7 @@
     LiteralExpr [STRING] [hij]
     LiteralExpr [STRING] [ijk]
   ]
-LetVariable [ Name=d ]
+Let Variable [ Name=$d ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -38,7 +38,7 @@
     LiteralExpr [STRING] [ijk]
     LiteralExpr [STRING] [jkl]
   ]
-LetVariable [ Name=e ]
+Let Variable [ Name=$e ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [efg]
@@ -49,7 +49,7 @@
     LiteralExpr [STRING] [ijk]
     LiteralExpr [STRING] [bcd]
   ]
-LetVariable [ Name=f ]
+Let Variable [ Name=$f ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -63,7 +63,7 @@
     LiteralExpr [STRING] [jkl]
     LiteralExpr [STRING] [cde]
   ]
-LetVariable [ Name=g ]
+Let Variable [ Name=$g ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [Efg]
@@ -74,7 +74,7 @@
     LiteralExpr [STRING] [IjK]
     LiteralExpr [STRING] [BCD]
   ]
-LetVariable [ Name=h ]
+Let Variable [ Name=$h ]
   :=
   OrderedListConstructor [
     LiteralExpr [STRING] [abc]
@@ -88,46 +88,46 @@
     LiteralExpr [STRING] [jkl]
     LiteralExpr [STRING] [cde]
   ]
-LetVariable [ Name=results ]
+Let Variable [ Name=$results ]
   :=
   OrderedListConstructor [
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=a ]
-      Variable [ Name=b ]
+      Variable [ Name=$a ]
+      Variable [ Name=$b ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=b ]
-      Variable [ Name=a ]
+      Variable [ Name=$b ]
+      Variable [ Name=$a ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=c ]
-      Variable [ Name=d ]
+      Variable [ Name=$c ]
+      Variable [ Name=$d ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=d ]
-      Variable [ Name=c ]
+      Variable [ Name=$d ]
+      Variable [ Name=$c ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=e ]
-      Variable [ Name=f ]
+      Variable [ Name=$e ]
+      Variable [ Name=$f ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=f ]
-      Variable [ Name=e ]
+      Variable [ Name=$f ]
+      Variable [ Name=$e ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=g ]
-      Variable [ Name=h ]
+      Variable [ Name=$g ]
+      Variable [ Name=$h ]
     ]
     FunctionCall test.similarity-jaccard@2[
-      Variable [ Name=h ]
-      Variable [ Name=g ]
+      Variable [ Name=$h ]
+      Variable [ Name=$g ]
     ]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=results ]
+FROM [  Variable [ Name=$results ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue201/query-issue201.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue201/query-issue201.3.ast
index 0aa55c7..c19b7e0 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue201/query-issue201.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue201/query-issue201.3.ast
@@ -1,15 +1,15 @@
 Set import-private-functions=true
 Query:
-LetVariable [ Name=x ]
+Let Variable [ Name=$x ]
   :=
   FunctionCall null.range@2[
     LiteralExpr [LONG] [1]
     LiteralExpr [LONG] [100]
   ]
 SELECT ELEMENT [
-Variable [ Name=i ]
+Variable [ Name=$i ]
 ]
-FROM [  Variable [ Name=x ]
+FROM [  Variable [ Name=$x ]
   AS
-  Variable [ Name=i ]
+  Variable [ Name=$i ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue244/query-issue244.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue244/query-issue244.3.ast
index b14b434..39d4a9d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue244/query-issue244.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue244/query-issue244.3.ast
@@ -1,17 +1,17 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [t2]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=id
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.1.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.1.ast
index e69de29..916a59e 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.1.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.1.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.2.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.2.ast
index c30763f..e69de29 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.2.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.2.ast
@@ -1,5 +0,0 @@
-Query:
-SELECT ELEMENT [
-FunctionCall null.printName@0[
-]
-]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.3.ast
index e69de29..eaa0e22 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.3.ast
@@ -0,0 +1,6 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+FunctionCall test.printName@0[
+]
+]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.4.ast
index 2e23f79..e69de29 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.4.ast
@@ -1,15 +0,0 @@
-Query:
-SELECT ELEMENT [
-Variable [ Name=l ]
-]
-FROM [  FunctionCall Metadata.dataset@1[
-    LiteralExpr [STRING] [Metadata.Function]
-  ]
-  AS
-  Variable [ Name=l ]
-]
-Query:
-SELECT ELEMENT [
-FunctionCall null.printName@0[
-]
-]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.5.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.5.ast
index e69de29..eaa0e22 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.5.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue455/query-issue455.5.ast
@@ -0,0 +1,6 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+FunctionCall test.printName@0[
+]
+]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue489/query-issue489.2.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue489/query-issue489.2.ast
index 7a053bd..beae2d4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue489/query-issue489.2.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue489/query-issue489.2.ast
@@ -3,18 +3,18 @@
 FunctionCall null.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Metadata.Function]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=DataverseName
         ]
         =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue489/query-issue489.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue489/query-issue489.4.ast
index 7a053bd..beae2d4 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue489/query-issue489.4.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/query-issue489/query-issue489.4.ast
@@ -3,18 +3,18 @@
 FunctionCall null.count@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Metadata.Function]
       ]
       AS
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=x ]
+          Variable [ Name=$x ]
           Field=DataverseName
         ]
         =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf01/udf01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf01/udf01.3.ast
index 7c29aef..4d96d9d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf01/udf01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf01/udf01.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FunctionCall test.echo@1[
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 ]
 FROM [  OrderedListConstructor [
@@ -18,5 +18,5 @@
     LiteralExpr [LONG] [10]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf02/udf02.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf02/udf02.3.ast
index 2909914..c5d0ad6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf02/udf02.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf02/udf02.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FunctionCall test.getFirst@1[
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 ]
 FROM [  OrderedListConstructor [
@@ -16,5 +16,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf04/udf04.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf04/udf04.3.ast
index de11c09..eb3db35 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf04/udf04.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf04/udf04.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FunctionCall test.echo@1[
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 ]
 FROM [  OrderedListConstructor [
@@ -59,5 +59,5 @@
     ]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf09/udf09.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf09/udf09.3.ast
index fffc5fe..21264bc 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf09/udf09.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf09/udf09.3.ast
@@ -4,17 +4,17 @@
 FunctionCall test.readDataset@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
     ]
     FROM [      FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [test.t1]
       ]
       AS
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
     ]
     Orderby
       FieldAccessor [
-        Variable [ Name=a ]
+        Variable [ Name=$a ]
         Field=id
       ]
       ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf11/udf11.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf11/udf11.3.ast
index 91115be..a7fad06 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf11/udf11.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf11/udf11.3.ast
@@ -1,10 +1,10 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  FunctionCall test.OList@0[
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf19/udf19.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf19/udf19.3.ast
index 3867fbf..5d459e1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf19/udf19.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf19/udf19.3.ast
@@ -2,7 +2,7 @@
 Query:
 SELECT ELEMENT [
 FunctionCall test.area@1[
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 ]
 FROM [  OrderedListConstructor [
@@ -14,12 +14,12 @@
     LiteralExpr [LONG] [12]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.area@1[
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
     ]
     >
     LiteralExpr [LONG] [100]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf20/udf20.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf20/udf20.3.ast
index e12af84..badfd49 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf20/udf20.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf20/udf20.3.ast
@@ -5,13 +5,13 @@
   (
     LiteralExpr [STRING] [radius]
     :
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   )
   (
     LiteralExpr [STRING] [area]
     :
     FunctionCall test.area@1[
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
     ]
   )
 ]
@@ -25,12 +25,12 @@
     LiteralExpr [LONG] [12]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Where
   OperatorExpr [
     FunctionCall test.area@1[
-      Variable [ Name=a ]
+      Variable [ Name=$a ]
     ]
     >
     LiteralExpr [LONG] [100]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf21/udf21.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf21/udf21.3.ast
index 2feced9..d88293a 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf21/udf21.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf21/udf21.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=a ]
+Variable [ Name=$a ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [10]
@@ -29,9 +29,9 @@
     LiteralExpr [LONG] [75]
   ]
   AS
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 Where
   FunctionCall test.isOdd@1[
-    Variable [ Name=a ]
+    Variable [ Name=$a ]
   ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf23/udf23.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf23/udf23.3.ast
index 418a454..dac2422 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf23/udf23.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf23/udf23.3.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Metadata.Dataset]
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=l ]
+      Variable [ Name=$l ]
       Field=DataverseName
     ]
     =
@@ -20,7 +20,7 @@
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
     Field=DatasetName
   ]
   ASC
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf27/udf27.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf27/udf27.3.ast
index 8023b42..88d3231 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf27/udf27.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf27/udf27.3.ast
@@ -1,7 +1,7 @@
 DataverseUse test
 Query:
 QuantifiedExpression SOME [
-  [Variable [ Name=i ]
+  [Variable [ Name=$i ]
   In
     OrderedListConstructor [
       LiteralExpr [LONG] [100]
@@ -10,7 +10,7 @@
   ]
   Satifies [
     OperatorExpr [
-      Variable [ Name=i ]
+      Variable [ Name=$i ]
       <
       FunctionCall test.f1@0[
       ]
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf28/udf28.2.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf28/udf28.2.ast
index b04f125..343f76b 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf28/udf28.2.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf28/udf28.2.ast
@@ -1,18 +1,18 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Metadata.Function]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=x ]
+      Variable [ Name=$x ]
       Field=DataverseName
     ]
     =
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/writers/print_01/print_01.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/writers/print_01/print_01.3.ast
index ba3aeaa..bdd0649 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/writers/print_01/print_01.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/writers/print_01/print_01.3.ast
@@ -1,12 +1,12 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [STRING] [foo]
     LiteralExpr [STRING] [bar]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
diff --git a/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 8357e3e..c343570 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -1310,7 +1310,7 @@
         <test-case FilePath="custord">
             <compilation-unit name="join_q_07">
                 <output-dir compare="Text">join_q_06</output-dir>
-                 <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Could not resolve type for function-call: asterix:scan-collection, Args:[%0->$$8],please check whether the used variables has been defined!</expected-error>
+                 <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Could not find dataset c in dataverse test</expected-error>
             </compilation-unit>
         </test-case>
         <test-case FilePath="custord">
@@ -2253,6 +2253,58 @@
             </compilation-unit>
         </test-case>
     </test-group> -->
+    <test-group name="group-by">
+        <test-case FilePath="group-by">
+            <compilation-unit name="core-01">
+                <output-dir compare="Text">core-01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="group-by">
+            <compilation-unit name="core-02">
+                <output-dir compare="Text">core-02</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="group-by">
+            <compilation-unit name="core-03">
+                <output-dir compare="Text">core-03</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="group-by">
+            <compilation-unit name="core-04">
+                <output-dir compare="Text">core-04</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="group-by">
+            <compilation-unit name="core-05">
+                <output-dir compare="Text">core-05</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="group-by">
+            <compilation-unit name="sugar-01">
+                <output-dir compare="Text">core-01</output-dir>
+            </compilation-unit>
+         </test-case>
+         <test-case FilePath="group-by">
+            <compilation-unit name="sugar-02">
+                <output-dir compare="Text">core-02</output-dir>
+            </compilation-unit>
+         </test-case>
+         <test-case FilePath="group-by">
+            <compilation-unit name="sugar-03">
+                <output-dir compare="Text">core-03</output-dir>
+            </compilation-unit>
+         </test-case>
+         <test-case FilePath="group-by">
+            <compilation-unit name="sugar-04">
+                <output-dir compare="Text">core-04</output-dir>
+            </compilation-unit>
+         </test-case>
+         <test-case FilePath="group-by">
+            <compilation-unit name="sugar-05">
+                <output-dir compare="Text">core-05</output-dir>
+            </compilation-unit>
+         </test-case>
+    </test-group>
     <test-group name="index-join">
         <test-case FilePath="index-join">
             <compilation-unit name="btree-index-nested-loop-join">
@@ -5270,6 +5322,193 @@
             </compilation-unit>
         </test-case>
     </test-group>
+    <test-group name="tpch-sql">
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="distinct_by">
+                <output-dir compare="Text">distinct_by</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="group_no_agg">
+                <output-dir compare="Text">group_no_agg</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="nest_aggregate">
+                <output-dir compare="Text">nest_aggregate</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="nest_aggregate2">
+                <output-dir compare="Text">nest_aggregate2</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="query-issue638">
+                <output-dir compare="Text">query-issue638</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="query-issue785">
+                <output-dir compare="Text">query-issue785</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="query-issue785-2">
+                <output-dir compare="Text">query-issue785-2</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="query-issue786">
+                <output-dir compare="Text">query-issue786</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="query-issue601">
+                <output-dir compare="Text">query-issue601</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q10_returned_item">
+                <output-dir compare="Text">q10_returned_item</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q10_returned_item_int64">
+                <output-dir compare="Text">q10_returned_item_int64</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q11_important_stock">
+                <output-dir compare="Text">q11_important_stock</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q12_shipping">
+                <output-dir compare="Text">q12_shipping</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q13_customer_distribution">
+                <output-dir compare="Text">q13_customer_distribution</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q14_promotion_effect">
+                <output-dir compare="Text">q14_promotion_effect</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q15_top_supplier">
+                <output-dir compare="Text">q15_top_supplier</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q16_parts_supplier_relationship">
+                <output-dir compare="Text">q16_parts_supplier_relationship</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q17_small_quantity_order_revenue">
+                <output-dir compare="Text">q17_small_quantity_order_revenue</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q17_large_gby_variant">
+                <output-dir compare="Text">q17_large_gby_variant</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q18_large_volume_customer">
+                <output-dir compare="Text">q18_large_volume_customer</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q19_discounted_revenue">
+                <output-dir compare="Text">q19_discounted_revenue</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q01_pricing_summary_report_nt">
+                <output-dir compare="Text">q01_pricing_summary_report_nt</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q20_potential_part_promotion">
+                <output-dir compare="Text">q20_potential_part_promotion</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q21_suppliers_who_kept_orders_waiting">
+                <output-dir compare="Text">q21_suppliers_who_kept_orders_waiting</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q22_global_sales_opportunity">
+                <output-dir compare="Text">q22_global_sales_opportunity</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q02_minimum_cost_supplier">
+                <output-dir compare="Text">q02_minimum_cost_supplier</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q03_shipping_priority_nt">
+                <output-dir compare="Text">q03_shipping_priority_nt</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q04_order_priority">
+                <output-dir compare="Text">q04_order_priority</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q05_local_supplier_volume">
+                <output-dir compare="Text">q05_local_supplier_volume</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q06_forecast_revenue_change">
+                <output-dir compare="Text">q06_forecast_revenue_change</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q07_volume_shipping">
+                <output-dir compare="Text">q07_volume_shipping</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q08_national_market_share">
+                <output-dir compare="Text">q08_national_market_share</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="q09_product_type_profit_nt">
+                <output-dir compare="Text">q09_product_type_profit_nt</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="query-issue562">
+                <output-dir compare="Text">query-issue562</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="query-issue810">
+                <output-dir compare="Text">query-issue810</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="query-issue810-2">
+                <output-dir compare="Text">query-issue810-2</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-sql">
+            <compilation-unit name="query-issue810-3">
+                <output-dir compare="Text">query-issue810-3</output-dir>
+            </compilation-unit>
+        </test-case>
+    </test-group>
     <test-group name="tpch-with-index">
         <test-case FilePath="tpch-with-index">
             <compilation-unit name="distinct_by">
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java
index 1c8c517..50e0ae2 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java
@@ -18,29 +18,40 @@
  */
 package org.apache.asterix.lang.common.clause;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.lang.common.base.Clause;
+import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
 import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
+import org.apache.hyracks.algebricks.common.utils.Pair;
 
 public class GroupbyClause implements Clause {
 
     private List<GbyVariableExpressionPair> gbyPairList;
     private List<GbyVariableExpressionPair> decorPairList;
     private List<VariableExpr> withVarList;
+    private VariableExpr groupVar;
+    private List<Pair<Expression, Identifier>> groupFieldList = new ArrayList<Pair<Expression, Identifier>>();
     private boolean hashGroupByHint;
 
     public GroupbyClause() {
     }
 
     public GroupbyClause(List<GbyVariableExpressionPair> gbyPairList, List<GbyVariableExpressionPair> decorPairList,
-            List<VariableExpr> withVarList, boolean hashGroupByHint) {
+            List<VariableExpr> withVarList, VariableExpr groupVarExpr,
+            List<Pair<Expression, Identifier>> groupFieldList, boolean hashGroupByHint) {
         this.gbyPairList = gbyPairList;
-        this.setDecorPairList(decorPairList);
+        this.decorPairList = decorPairList;
         this.withVarList = withVarList;
+        this.groupVar = groupVarExpr;
+        if (groupFieldList != null) {
+            this.groupFieldList = groupFieldList;
+        }
         this.hashGroupByHint = hashGroupByHint;
     }
 
@@ -60,6 +71,22 @@
         this.withVarList = withVarList;
     }
 
+    public VariableExpr getGroupVar() {
+        return groupVar;
+    }
+
+    public void setGroupVar(VariableExpr groupVarExpr) {
+        this.groupVar = groupVarExpr;
+    }
+
+    public List<Pair<Expression, Identifier>> getGroupFieldList() {
+        return groupFieldList;
+    }
+
+    public void setGroupFieldList(List<Pair<Expression, Identifier>> groupFieldList) {
+        this.groupFieldList = groupFieldList;
+    }
+
     @Override
     public ClauseType getClauseType() {
         return ClauseType.GROUP_BY_CLAUSE;
@@ -93,4 +120,12 @@
     public boolean hasWithList() {
         return withVarList != null && withVarList.size() > 0;
     }
+
+    public boolean hasGroupVar() {
+        return groupVar != null;
+    }
+
+    public boolean hasGroupFieldList() {
+        return groupFieldList != null && groupFieldList.size() > 0;
+    }
 }
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/context/FunctionSignatures.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/context/FunctionSignatures.java
index 18cdc70..376ab94 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/context/FunctionSignatures.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/context/FunctionSignatures.java
@@ -40,6 +40,10 @@
         }
     }
 
+    public void addAll(FunctionSignatures functionSignatures) {
+        functionMap.putAll(functionSignatures.functionMap);
+    }
+
     public void put(FunctionSignature fd, boolean varargs) {
         FunctionExpressionMap func = functionMap.get(fd);
         if (func == null) {
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/context/Scope.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/context/Scope.java
index 32bd1f2..595fb11 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/context/Scope.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/context/Scope.java
@@ -19,8 +19,10 @@
 package org.apache.asterix.lang.common.context;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.lang.common.base.Expression;
@@ -93,11 +95,11 @@
      *
      * @param ident
      */
-    public void removeSymbolExpressionMapping(VariableExpr ident) {
+    public Expression removeSymbolExpressionMapping(VariableExpr ident) {
         if (ident == null) {
-            return;
+            return null;
         }
-        varExprMap.remove(ident.getVar().getValue());
+        return varExprMap.remove(ident.getVar().getValue());
     }
 
     /**
@@ -151,6 +153,20 @@
     }
 
     /**
+     * Merge yet-another Scope instance into the current Scope instance.
+     *
+     * @param scope
+     *            the other Scope instance.
+     */
+    public void merge(Scope scope) {
+        symbols.putAll(scope.symbols);
+        if (functionSignatures != null && scope.functionSignatures != null) {
+            functionSignatures.addAll(scope.functionSignatures);
+        }
+        varExprMap.putAll(scope.varExprMap);
+    }
+
+    /**
      * Retrieve all the visible symbols in the current scope.
      *
      * @return an iterator of visible symbols.
@@ -196,4 +212,16 @@
 
         };
     }
+
+    public Set<VariableExpr> getLiveVariables() {
+        Set<VariableExpr> vars = new HashSet<VariableExpr>();
+        Iterator<Identifier> identifierIterator = liveSymbols();
+        while (identifierIterator.hasNext()) {
+            Identifier identifier = identifierIterator.next();
+            if (identifier instanceof VarIdentifier) {
+                vars.add(new VariableExpr((VarIdentifier) identifier));
+            }
+        }
+        return vars;
+    }
 }
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
index e93810e..9eeb6f8 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
@@ -74,6 +74,11 @@
     }
 
     @Override
+    public int hashCode() {
+        return var.hashCode();
+    }
+
+    @Override
     public boolean equals(Object obj) {
         if (!(obj instanceof VariableExpr)) {
             return false;
@@ -81,4 +86,9 @@
         VariableExpr expr = (VariableExpr) obj;
         return var.equals(expr.getVar());
     }
+
+    @Override
+    public String toString() {
+        return var.getValue();
+    }
 }
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/parser/ScopeChecker.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/parser/ScopeChecker.java
index 2645f3b..6ab82c1 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/parser/ScopeChecker.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/parser/ScopeChecker.java
@@ -95,6 +95,10 @@
         scopeStack.push(scope);
     }
 
+    public final void pushExistingScope(Scope scope) {
+        scopeStack.push(scope);
+    }
+
     /**
      * Remove current scope
      *
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/rewrites/LangRewritingContext.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/rewrites/LangRewritingContext.java
index 832ef3c..d8d77ae2 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/rewrites/LangRewritingContext.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/rewrites/LangRewritingContext.java
@@ -61,7 +61,8 @@
 
     public VarIdentifier newVariable() {
         int id = newId();
-        return new VarIdentifier("@@" + id, id);
+        // Prefixes system-generated variables with "#".
+        return new VarIdentifier("#" + id, id);
     }
 
     private int newId() {
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java
index fcbae1b..ebe266e 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java
@@ -48,6 +48,7 @@
 import org.apache.asterix.lang.common.rewrites.VariableSubstitutionEnvironment;
 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.QuantifiedPair;
 import org.apache.asterix.lang.common.struct.VarIdentifier;
 import org.apache.asterix.lang.common.util.VariableCloneAndSubstitutionUtil;
@@ -83,14 +84,31 @@
         List<GbyVariableExpressionPair> newDecorList = gc.hasDecorList() ? VariableCloneAndSubstitutionUtil
                 .substInVarExprPair(context, gc.getDecorPairList(), env, newSubs, this)
                 : new ArrayList<GbyVariableExpressionPair>();
+
+        VariableExpr newGroupVar = null;
+        if (gc.hasGroupVar()) {
+            newGroupVar = generateNewVariable(context, gc.getGroupVar());
+        }
         List<VariableExpr> wList = new LinkedList<VariableExpr>();
         if (gc.hasWithList()) {
             for (VariableExpr w : gc.getWithVarList()) {
                 VarIdentifier newVar = context.getRewrittenVar(w.getVar().getId());
-                wList.add(new VariableExpr(newVar));
+                if (newVar == null) {
+                    throw new AsterixException("Could not find a rewritten variable identifier for " + w);
+                }
+                VariableExpr newWithVar = new VariableExpr(newVar);
+                wList.add(newWithVar);
             }
         }
-        GroupbyClause newGroup = new GroupbyClause(newGbyList, newDecorList, wList, gc.hasHashGroupByHint());
+        List<Pair<Expression, Identifier>> newGroupFieldList = new ArrayList<>();
+        if (gc.hasGroupFieldList()) {
+            for (Pair<Expression, Identifier> varId : gc.getGroupFieldList()) {
+                Expression newExpr = (Expression) varId.first.accept(this, env).first;
+                newGroupFieldList.add(new Pair<Expression, Identifier>(newExpr, varId.second));
+            }
+        }
+        GroupbyClause newGroup = new GroupbyClause(newGbyList, newDecorList, wList, newGroupVar, newGroupFieldList,
+                gc.hasHashGroupByHint());
         return new Pair<ILangExpression, VariableSubstitutionEnvironment>(newGroup, newSubs);
     }
 
@@ -103,7 +121,8 @@
         for (QuantifiedPair t : oldPairs) {
             VariableExpr newVar = generateNewVariable(context, t.getVarExpr());
             newSubs = VariableCloneAndSubstitutionUtil.eliminateSubstFromList(newVar, newSubs);
-            Pair<ILangExpression, VariableSubstitutionEnvironment> p1 = t.getExpr().accept(this, newSubs);
+            Pair<ILangExpression, VariableSubstitutionEnvironment> p1 = visitUnnesBindingExpression(t.getExpr(),
+                    newSubs);
             QuantifiedPair t2 = new QuantifiedPair(newVar, (Expression) p1.first);
             newPairs.add(t2);
         }
@@ -276,7 +295,7 @@
     }
 
     // Replace a variable expression if the variable is to-be substituted.
-    public Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env) {
+    protected Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env) {
         if (env.constainsOldVar(expr)) {
             return env.findSubstituion(expr);
         } else {
@@ -305,4 +324,19 @@
         return newVarExpr;
     }
 
+    /**
+     * Visits an expression that is used for unnest binding.
+     *
+     * @param expr,
+     *            the expression to consider.
+     * @param env,
+     *            the variable substitution environment.
+     * @return a pair of an ILangExpression and a variable substitution environment.
+     * @throws AsterixException
+     */
+    protected Pair<ILangExpression, VariableSubstitutionEnvironment> visitUnnesBindingExpression(Expression expr,
+            VariableSubstitutionEnvironment env) throws AsterixException {
+        return expr.accept(this, env);
+    }
+
 }
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
index f365d2b..c635403 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
@@ -204,7 +204,7 @@
 
     @Override
     public Void visit(LetClause lc, Integer step) throws AsterixException {
-        out.print(skip(step) + "Let");
+        out.print(skip(step) + "Let ");
         lc.getVarExpr().accept(this, 0);
         out.println(skip(step + 1) + ":=");
         lc.getBindingExpr().accept(this, step + 1);
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/Projection.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/Projection.java
index bfb5abf..6ca9b71 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/Projection.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/Projection.java
@@ -61,6 +61,10 @@
         return name;
     }
 
+    public void setName(String name) {
+        this.name = name;
+    }
+
     public boolean hasName() {
         return name != null;
     }
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/parser/FunctionParser.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/parser/FunctionParser.java
index 5e5f524..a1ce60d 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/parser/FunctionParser.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/parser/FunctionParser.java
@@ -20,7 +20,6 @@
 package org.apache.asterix.lang.sqlpp.parser;
 
 import java.io.StringReader;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.common.exceptions.AsterixException;
@@ -29,6 +28,7 @@
 import org.apache.asterix.lang.common.base.Statement;
 import org.apache.asterix.lang.common.statement.FunctionDecl;
 import org.apache.asterix.lang.common.struct.VarIdentifier;
+import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
 import org.apache.asterix.metadata.entities.Function;
 
 public class FunctionParser {
@@ -42,16 +42,14 @@
     public FunctionDecl getFunctionDecl(Function function) throws AsterixException {
         String functionBody = function.getFunctionBody();
         List<String> params = function.getParams();
-        List<VarIdentifier> varIdentifiers = new ArrayList<VarIdentifier>();
 
         StringBuilder builder = new StringBuilder();
         builder.append(" use " + function.getDataverseName() + ";");
         builder.append(" declare function " + function.getName().split("@")[0]);
         builder.append("(");
         for (String param : params) {
-            VarIdentifier varId = new VarIdentifier(param);
-            varIdentifiers.add(varId);
-            builder.append(param);
+            VarIdentifier varId = SqlppVariableUtil.toUserDefinedVariableName(param);
+            builder.append(varId);
             builder.append(",");
         }
         if (params.size() > 0) {
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
index cba592a..1f119ae 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
@@ -37,6 +37,9 @@
         // Inlines column aliases.
         inlineColumnAlias();
 
+        // Group-by core/sugar rewrites.
+        rewriteGroupBys();
+
         // Generates ids for variables (considering scopes) but DOES NOT replace unbounded variable access with the dataset function.
         // An unbounded variable within a function could be a bounded variable in the top-level query.
         variableCheckAndRewrite(false);
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
index 3143214..a2c84ba 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
@@ -50,6 +50,7 @@
 import org.apache.asterix.lang.sqlpp.parser.SqlppParserFactory;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 import org.apache.asterix.lang.sqlpp.visitor.InlineColumnAliasVisitor;
+import org.apache.asterix.lang.sqlpp.visitor.SqlppGroupByVisitor;
 import org.apache.asterix.lang.sqlpp.visitor.SqlppInlineUdfsVisitor;
 import org.apache.asterix.lang.sqlpp.visitor.VariableCheckAndRewriteVisitor;
 import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
@@ -85,6 +86,9 @@
         // Inlines column aliases.
         inlineColumnAlias();
 
+        // Group-by core/sugar rewrites.
+        rewriteGroupBys();
+
         // Generate ids for variables (considering scopes) and replace global variable access with the dataset function.
         variableCheckAndRewrite(true);
 
@@ -103,7 +107,7 @@
             return;
         }
         // Inline column aliases.
-        InlineColumnAliasVisitor inlineColumnAliasVisitor = new InlineColumnAliasVisitor();
+        InlineColumnAliasVisitor inlineColumnAliasVisitor = new InlineColumnAliasVisitor(context);
         inlineColumnAliasVisitor.visit(topExpr, false);
     }
 
@@ -112,10 +116,18 @@
             return;
         }
         VariableCheckAndRewriteVisitor variableCheckAndRewriteVisitor = new VariableCheckAndRewriteVisitor(context,
-                overwrite);
+                overwrite, metadataProvider);
         variableCheckAndRewriteVisitor.visit(topExpr, null);
     }
 
+    protected void rewriteGroupBys() throws AsterixException {
+        if (topExpr == null) {
+            return;
+        }
+        SqlppGroupByVisitor groupByVisitor = new SqlppGroupByVisitor(context, metadataProvider);
+        groupByVisitor.visit(topExpr, null);
+    }
+
     protected void inlineDeclaredUdfs() throws AsterixException {
         if (topExpr == null) {
             return;
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java
new file mode 100644
index 0000000..0f8488a
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.lang.sqlpp.util;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.ILangExpression;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
+import org.apache.asterix.lang.sqlpp.visitor.SqlppGroupBySugarVisitor;
+import org.apache.asterix.lang.sqlpp.visitor.UsedVariableVisitor;
+
+public class SqlppRewriteUtil {
+
+    // Applying sugar rewriting for group-by.
+    public static Expression rewriteExpressionUsingGroupVariable(VariableExpr groupVar,
+            Collection<VariableExpr> targetVarList, ILangExpression expr, LangRewritingContext context)
+                    throws AsterixException {
+        SqlppGroupBySugarVisitor visitor = new SqlppGroupBySugarVisitor(context, null, groupVar, targetVarList);
+        return expr.accept(visitor, null);
+    }
+
+    public static Set<VariableExpr> getUsedVariable(Expression expr) throws AsterixException {
+        Set<VariableExpr> vars = new HashSet<>();
+        UsedVariableVisitor visitor = new UsedVariableVisitor();
+        expr.accept(visitor, vars);
+        return vars;
+    }
+
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java
new file mode 100644
index 0000000..8a63aa5
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.lang.sqlpp.util;
+
+import org.apache.asterix.lang.common.struct.VarIdentifier;
+
+public class SqlppVariableUtil {
+
+    private static String USER_VAR_PREFIX = "$";
+
+    public static VarIdentifier toUserDefinedVariableName(VarIdentifier var) {
+        String varName = var.getValue();
+        return toUserDefinedVariableName(varName);
+    }
+
+    public static VarIdentifier toUserDefinedVariableName(String varName) {
+        if (varName.startsWith(USER_VAR_PREFIX)) {
+            return new VarIdentifier(varName.substring(1));
+        }
+        return new VarIdentifier(varName);
+    }
+
+    public static String toInternalVariableName(String varName) {
+        return USER_VAR_PREFIX + varName;
+    }
+
+    public static VarIdentifier toInternalVariableIdentifier(String idName) {
+        return new VarIdentifier(USER_VAR_PREFIX + idName);
+    }
+
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/InlineColumnAliasVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/InlineColumnAliasVisitor.java
index bafac89..98c74b4 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/InlineColumnAliasVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/InlineColumnAliasVisitor.java
@@ -19,7 +19,10 @@
 package org.apache.asterix.lang.sqlpp.visitor;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.lang.common.base.Expression;
@@ -44,11 +47,11 @@
 import org.apache.asterix.lang.common.expression.UnaryExpr;
 import org.apache.asterix.lang.common.expression.VariableExpr;
 import org.apache.asterix.lang.common.parser.ScopeChecker;
+import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
 import org.apache.asterix.lang.common.rewrites.VariableSubstitutionEnvironment;
 import org.apache.asterix.lang.common.statement.FunctionDecl;
 import org.apache.asterix.lang.common.statement.Query;
 import org.apache.asterix.lang.common.struct.QuantifiedPair;
-import org.apache.asterix.lang.common.struct.VarIdentifier;
 import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
 import org.apache.asterix.lang.sqlpp.clause.FromClause;
 import org.apache.asterix.lang.sqlpp.clause.FromTerm;
@@ -65,11 +68,17 @@
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 import org.apache.asterix.lang.sqlpp.util.SqlppVariableSubstitutionUtil;
+import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
 import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
 
 public class InlineColumnAliasVisitor extends AbstractSqlppQueryExpressionVisitor<Void, Boolean> {
 
     private final ScopeChecker scopeChecker = new ScopeChecker();
+    private final LangRewritingContext context;
+
+    public InlineColumnAliasVisitor(LangRewritingContext context) {
+        this.context = context;
+    }
 
     @Override
     public Void visit(WhereClause whereClause, Boolean arg) throws AsterixException {
@@ -126,8 +135,16 @@
     @Override
     public Void visit(Projection projection, Boolean arg) throws AsterixException {
         projection.getExpression().accept(this, arg);
-        scopeChecker.getCurrentScope().addSymbolExpressionMappingToScope(
-                new VariableExpr(new VarIdentifier(projection.getName())), projection.getExpression());
+        VariableExpr columnAlias = new VariableExpr(SqlppVariableUtil.toInternalVariableIdentifier(projection.getName()));
+        VariableSubstitutionEnvironment env = scopeChecker.getCurrentScope().getVarSubstitutionEnvironment();
+        Expression gbyKey = env.findSubstituion(columnAlias);
+        if (arg) {
+            scopeChecker.getCurrentScope().addSymbolExpressionMappingToScope(columnAlias, projection.getExpression());
+        } else {
+            if (gbyKey != null) {
+                projection.setExpression(gbyKey);
+            }
+        }
         return null;
     }
 
@@ -135,7 +152,7 @@
     public Void visit(SelectBlock selectBlock, Boolean arg) throws AsterixException {
         // Traverses the select block in the order of "select", "group-by",
         // "group-by" lets and "having".
-        selectBlock.getSelectClause().accept(this, arg);
+        selectBlock.getSelectClause().accept(this, true);
 
         if (selectBlock.hasFromClause()) {
             selectBlock.getFromClause().accept(this, arg);
@@ -156,6 +173,9 @@
         if (selectBlock.hasHavingClause()) {
             selectBlock.getHavingClause().accept(this, arg);
         }
+
+        // Visit select clause again to overwrite projection expressions if the group-by clause is rewritten.
+        selectBlock.getSelectClause().accept(this, false);
         return null;
     }
 
@@ -172,7 +192,12 @@
 
     @Override
     public Void visit(SelectElement selectElement, Boolean arg) throws AsterixException {
-        selectElement.getExpression().accept(this, true);
+        Expression expr = selectElement.getExpression();
+        expr.accept(this, arg);
+        if (expr.getKind() == Kind.RECORD_CONSTRUCTOR_EXPRESSION) {
+            // To be consistent with SelectRegular.
+            mapForRecordConstructor(arg, (RecordConstructor) expr);
+        }
         return null;
     }
 
@@ -251,15 +276,28 @@
     @Override
     public Void visit(GroupbyClause gc, Boolean arg) throws AsterixException {
         VariableSubstitutionEnvironment env = scopeChecker.getCurrentScope().getVarSubstitutionEnvironment();
+        Map<VariableExpr, VariableExpr> oldGbyExprsToNewGbyVarMap = new HashMap<>();
         for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
-            Expression newExpr = (Expression) SqlppVariableSubstitutionUtil.substituteVariableWithoutContext(gbyVarExpr.getExpr(),
+            Expression oldGbyExpr = gbyVarExpr.getExpr();
+            Expression newExpr = (Expression) SqlppVariableSubstitutionUtil.substituteVariableWithoutContext(oldGbyExpr,
                     env);
             newExpr.accept(this, arg);
             gbyVarExpr.setExpr(newExpr);
+            if (gbyVarExpr.getVar() == null) {
+                gbyVarExpr.setVar(new VariableExpr(context.newVariable()));
+            }
+            if (oldGbyExpr.getKind() == Kind.VARIABLE_EXPRESSION) {
+                VariableExpr oldGbyVarExpr = (VariableExpr) oldGbyExpr;
+                if (env.findSubstituion(oldGbyVarExpr) != null) {
+                    // Re-mapping that needs to be added.
+                    oldGbyExprsToNewGbyVarMap.put(oldGbyVarExpr, gbyVarExpr.getVar());
+                }
+            }
         }
-        for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
-            // A group-by variable will override the alias to substitute.
-            scopeChecker.getCurrentScope().removeSymbolExpressionMapping(gbyVarExpr.getVar());
+        for (Entry<VariableExpr, VariableExpr> entry : oldGbyExprsToNewGbyVarMap.entrySet()) {
+            // The group-by key variable will override the alias to substitute.
+            scopeChecker.getCurrentScope().removeSymbolExpressionMapping(entry.getKey());
+            scopeChecker.getCurrentScope().addSymbolExpressionMappingToScope(entry.getKey(), entry.getValue());
         }
         return null;
     }
@@ -310,19 +348,34 @@
     @Override
     public Void visit(RecordConstructor rc, Boolean rewrite) throws AsterixException {
         for (FieldBinding binding : rc.getFbList()) {
-            Expression leftExpr = binding.getLeftExpr();
-            leftExpr.accept(this, false);
+            binding.getLeftExpr().accept(this, false);
             binding.getRightExpr().accept(this, false);
-            if (rewrite && leftExpr.getKind() == Kind.LITERAL_EXPRESSION) {
+        }
+        return null;
+    }
+
+    private void mapForRecordConstructor(Boolean initPhase, RecordConstructor rc) {
+        for (FieldBinding binding : rc.getFbList()) {
+            Expression leftExpr = binding.getLeftExpr();
+            if (leftExpr.getKind() == Kind.LITERAL_EXPRESSION) {
                 LiteralExpr literalExpr = (LiteralExpr) leftExpr;
                 if (literalExpr.getValue().getLiteralType() == Literal.Type.STRING) {
                     String fieldName = literalExpr.getValue().getStringValue();
-                    scopeChecker.getCurrentScope().addSymbolExpressionMappingToScope(
-                            new VariableExpr(new VarIdentifier(fieldName)), binding.getRightExpr());
+                    VariableExpr columnAlias = new VariableExpr(SqlppVariableUtil.toInternalVariableIdentifier(fieldName));
+                    VariableSubstitutionEnvironment env = scopeChecker.getCurrentScope()
+                            .getVarSubstitutionEnvironment();
+                    if (initPhase) {
+                        scopeChecker.getCurrentScope().addSymbolExpressionMappingToScope(columnAlias,
+                                binding.getRightExpr());
+                    } else {
+                        Expression gbyKey = env.findSubstituion(columnAlias);
+                        if (gbyKey != null) {
+                            binding.setRightExpr(gbyKey);
+                        }
+                    }
                 }
             }
         }
-        return null;
     }
 
     @Override
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
index 06b5027..df32b01 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
@@ -21,7 +21,11 @@
 import java.io.PrintWriter;
 
 import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
 import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.lang.common.visitor.QueryPrintVisitor;
 import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
 import org.apache.asterix.lang.sqlpp.clause.FromClause;
@@ -39,6 +43,7 @@
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
+import org.apache.hyracks.algebricks.common.utils.Pair;
 
 public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVisitor<Void, Integer> {
 
@@ -237,4 +242,30 @@
         return null;
     }
 
+    @Override
+    public Void visit(GroupbyClause gc, Integer step) throws AsterixException {
+        out.println(skip(step) + "Groupby");
+        for (GbyVariableExpressionPair pair : gc.getGbyPairList()) {
+            if (pair.getVar() != null) {
+                pair.getVar().accept(this, step + 1);
+                out.println(skip(step + 1) + ":=");
+            }
+            pair.getExpr().accept(this, step + 1);
+        }
+        if (gc.hasGroupVar()) {
+            out.println(skip(step + 1) + "GROUP AS");
+            gc.getGroupVar().accept(this, step + 1);
+            if (gc.hasGroupFieldList()) {
+                out.println(skip(step + 1) + "(");
+                for (Pair<Expression, Identifier> field : gc.getGroupFieldList()) {
+                    field.first.accept(this, step + 1);
+                    out.println(skip(step + 1) + " AS " + field.second);
+                }
+                out.println(skip(step + 1) + ")");
+            }
+        }
+        out.println();
+        return null;
+    }
+
 }
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppCloneAndSubstituteVariablesVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppCloneAndSubstituteVariablesVisitor.java
index 9fd9970..62581c8 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppCloneAndSubstituteVariablesVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppCloneAndSubstituteVariablesVisitor.java
@@ -85,7 +85,7 @@
         VariableExpr newLeftVar = generateNewVariable(context, leftVar);
         VariableExpr newLeftPosVar = fromTerm.hasPositionalVariable()
                 ? generateNewVariable(context, fromTerm.getPositionalVariable()) : null;
-        Expression newLeftExpr = (Expression) fromTerm.getLeftExpression().accept(this, env).first;
+        Expression newLeftExpr = (Expression) visitUnnesBindingExpression(fromTerm.getLeftExpression(), env).first;
         List<AbstractBinaryCorrelateClause> newCorrelateClauses = new ArrayList<AbstractBinaryCorrelateClause>();
 
         VariableSubstitutionEnvironment currentEnv = new VariableSubstitutionEnvironment(env);
@@ -120,7 +120,7 @@
                 ? generateNewVariable(context, joinClause.getPositionalVariable()) : null;
 
         // Visits the right expression.
-        Expression newRightExpr = (Expression) joinClause.getRightExpression().accept(this, env).first;
+        Expression newRightExpr = (Expression) visitUnnesBindingExpression(joinClause.getRightExpression(), env).first;
 
         // Visits the condition.
         VariableSubstitutionEnvironment currentEnv = new VariableSubstitutionEnvironment(env);
@@ -170,7 +170,7 @@
                 ? generateNewVariable(context, unnestClause.getPositionalVariable()) : null;
 
         // Visits the right expression.
-        Expression rightExpr = (Expression) unnestClause.getRightExpression().accept(this, env).first;
+        Expression rightExpr = (Expression) visitUnnesBindingExpression(unnestClause.getRightExpression(), env).first;
 
         // Visits the condition.
         VariableSubstitutionEnvironment currentEnv = new VariableSubstitutionEnvironment(env);
@@ -187,7 +187,8 @@
     @Override
     public Pair<ILangExpression, VariableSubstitutionEnvironment> visit(Projection projection,
             VariableSubstitutionEnvironment env) throws AsterixException {
-        Projection newProjection = (Projection) projection.getExpression().accept(this, env).first;
+        Projection newProjection = new Projection((Expression) projection.getExpression().accept(this, env).first,
+                projection.getName(), projection.star(), projection.exprStar());
         return new Pair<ILangExpression, VariableSubstitutionEnvironment>(newProjection, env);
     }
 
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupBySugarVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupBySugarVisitor.java
new file mode 100644
index 0000000..5506256
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupBySugarVisitor.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.lang.sqlpp.visitor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.functions.FunctionConstants;
+import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.Expression.Kind;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
+import org.apache.asterix.lang.common.util.FunctionUtil;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.clause.SelectClause;
+import org.apache.asterix.lang.sqlpp.clause.SelectElement;
+import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.struct.SetOperationInput;
+import org.apache.asterix.lang.sqlpp.util.SqlppRewriteUtil;
+import org.apache.asterix.lang.sqlpp.util.SqlppVariableSubstitutionUtil;
+import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo;
+
+/**
+ * An AST pre-processor to rewrite group-by sugar queries.
+ */
+public class SqlppGroupBySugarVisitor extends VariableCheckAndRewriteVisitor {
+
+    private final Expression groupVar;
+    private final Collection<VariableExpr> targetVars;
+
+    public SqlppGroupBySugarVisitor(LangRewritingContext context, AqlMetadataProvider metadataProvider,
+            Expression groupVar, Collection<VariableExpr> targetVars) {
+        super(context, false, metadataProvider);
+        this.groupVar = groupVar;
+        this.targetVars = targetVars;
+    }
+
+    @Override
+    public Expression visit(CallExpr callExpr, Expression arg) throws AsterixException {
+        List<Expression> newExprList = new ArrayList<Expression>();
+        boolean aggregate = isAggregateFunction(callExpr.getFunctionSignature());
+        for (Expression expr : callExpr.getExprList()) {
+            Expression newExpr = aggregate ? wrapAggregationArgument(expr) : expr;
+            newExprList.add(newExpr.accept(this, arg));
+        }
+        callExpr.setExprList(newExprList);
+        return callExpr;
+    }
+
+    private boolean isAggregateFunction(FunctionSignature signature) throws AsterixException {
+        IFunctionInfo finfo = FunctionUtil.getFunctionInfo(
+                new FunctionIdentifier(FunctionConstants.ASTERIX_NS, signature.getName(), signature.getArity()));
+        if (finfo == null) {
+            return false;
+        }
+        return AsterixBuiltinFunctions.getAggregateFunction(finfo.getFunctionIdentifier()) != null;
+    }
+
+    private Expression wrapAggregationArgument(Expression expr) throws AsterixException {
+        if (expr.getKind() == Kind.SELECT_EXPRESSION) {
+            return expr;
+        }
+        Set<VariableExpr> definedVars = scopeChecker.getCurrentScope().getLiveVariables();
+        Set<VariableExpr> vars = new HashSet<>(targetVars);
+        vars.remove(definedVars); // Exclude re-defined local variables.
+        Set<VariableExpr> usedVars = SqlppRewriteUtil.getUsedVariable(expr);
+        if (!vars.containsAll(usedVars)) {
+            return expr;
+        }
+        VariableExpr var = new VariableExpr(context.newVariable());
+        FromTerm fromTerm = new FromTerm(groupVar, var, null, null);
+        FromClause fromClause = new FromClause(Collections.singletonList(fromTerm));
+
+        // Select clause.
+        SelectElement selectElement = new SelectElement(expr);
+        SelectClause selectClause = new SelectClause(selectElement, null, false);
+
+        // Construct the select expression.
+        SelectBlock selectBlock = new SelectBlock(selectClause, fromClause, null, null, null, null, null);
+        SelectSetOperation selectSetOperation = new SelectSetOperation(new SetOperationInput(selectBlock, null), null);
+        SelectExpression selectExpression = new SelectExpression(null, selectSetOperation, null, null, false);
+        selectExpression.setSubquery(true);
+
+        // replace variable expressions with field access
+        Map<VariableExpr, Expression> varExprMap = new HashMap<>();
+        for (VariableExpr usedVar : usedVars) {
+            varExprMap.put(usedVar,
+                    new FieldAccessor(var, SqlppVariableUtil.toUserDefinedVariableName(usedVar.getVar())));
+        }
+        selectElement.setExpression(
+                (Expression) SqlppVariableSubstitutionUtil.substituteVariableWithoutContext(expr, varExprMap));
+        return selectExpression;
+    }
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupByVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupByVisitor.java
new file mode 100644
index 0000000..ecbdecd
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupByVisitor.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.lang.sqlpp.visitor;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.context.Scope;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.struct.VarIdentifier;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.util.SqlppRewriteUtil;
+import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.hyracks.algebricks.common.utils.Pair;
+
+/**
+ * A pre-processor that adds the group variable as well as its group field
+ * list into the AST. It will also invoke SQL group-by aggregation sugar rewritings.
+ */
+public class SqlppGroupByVisitor extends VariableCheckAndRewriteVisitor {
+
+    public SqlppGroupByVisitor(LangRewritingContext context, AqlMetadataProvider metadataProvider) {
+        super(context, false, metadataProvider);
+    }
+
+    @Override
+    public Expression visit(SelectBlock selectBlock, Expression arg) throws AsterixException {
+        // Traverses the select block in the order of "from", "let"s, "where",
+        // "group by", "let"s, "having" and "select".
+        if (selectBlock.hasFromClause()) {
+            selectBlock.getFromClause().accept(this, arg);
+        }
+        if (selectBlock.hasLetClauses()) {
+            List<LetClause> letList = selectBlock.getLetList();
+            for (LetClause letClause : letList) {
+                letClause.accept(this, arg);
+            }
+        }
+        if (selectBlock.hasWhereClause()) {
+            selectBlock.getWhereClause().accept(this, arg);
+        }
+        if (selectBlock.hasGroupbyClause()) {
+            selectBlock.getGroupbyClause().accept(this, arg);
+            Set<VariableExpr> withVarSet = new HashSet<>(selectBlock.getGroupbyClause().getWithVarList());
+            withVarSet.remove(selectBlock.getGroupbyClause().getGroupVar());
+            //selectBlock.getGroupbyClause().getWithVarList()
+            //        .retainAll(Collections.singleton(selectBlock.getGroupbyClause().getGroupVar()));
+            if (selectBlock.hasLetClausesAfterGroupby()) {
+                List<LetClause> letListAfterGby = selectBlock.getLetListAfterGroupby();
+                for (LetClause letClauseAfterGby : letListAfterGby) {
+                    // Rewrites each let clause after the group-by.
+                    SqlppRewriteUtil.rewriteExpressionUsingGroupVariable(selectBlock.getGroupbyClause().getGroupVar(),
+                            withVarSet, letClauseAfterGby, context);
+                    letClauseAfterGby.accept(this, arg);
+                }
+            }
+            if (selectBlock.hasHavingClause()) {
+                // Rewrites the having clause.
+                SqlppRewriteUtil.rewriteExpressionUsingGroupVariable(selectBlock.getGroupbyClause().getGroupVar(),
+                        withVarSet, selectBlock.getHavingClause(), context);
+                selectBlock.getHavingClause().accept(this, arg);
+            }
+            // Rewrites the select clause.
+            SqlppRewriteUtil.rewriteExpressionUsingGroupVariable(selectBlock.getGroupbyClause().getGroupVar(),
+                    withVarSet, selectBlock.getSelectClause(), context);
+
+            SelectExpression parentSelectExpression = (SelectExpression) arg;
+            if (parentSelectExpression.hasOrderby()) {
+                // Rewrites the order-by clause.
+                SqlppRewriteUtil.rewriteExpressionUsingGroupVariable(selectBlock.getGroupbyClause().getGroupVar(),
+                        withVarSet, parentSelectExpression.getOrderbyClause(), context);
+            }
+            if (parentSelectExpression.hasLimit()) {
+                // Rewrites the limit clause.
+                SqlppRewriteUtil.rewriteExpressionUsingGroupVariable(selectBlock.getGroupbyClause().getGroupVar(),
+                        withVarSet, parentSelectExpression.getLimitClause(), context);
+            }
+        }
+        selectBlock.getSelectClause().accept(this, arg);
+        return null;
+    }
+
+    @Override
+    public Expression visit(GroupbyClause gc, Expression arg) throws AsterixException {
+        Scope newScope = scopeChecker.extendCurrentScopeNoPush(true);
+        // Puts all group-by variables into the symbol set of the new scope.
+        for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
+            gbyVarExpr.setExpr(gbyVarExpr.getExpr().accept(this, arg));
+            VariableExpr gbyVar = gbyVarExpr.getVar();
+            if (gbyVar != null) {
+                newScope.addNewVarSymbolToScope(gbyVarExpr.getVar().getVar());
+            }
+        }
+        // Puts all live variables into withVarList.
+        List<VariableExpr> withVarList = new ArrayList<VariableExpr>();
+        Iterator<Identifier> varIterator = scopeChecker.getCurrentScope().liveSymbols();
+        while (varIterator.hasNext()) {
+            Identifier ident = varIterator.next();
+            VariableExpr varExpr = new VariableExpr();
+            if (ident instanceof VarIdentifier) {
+                varExpr.setIsNewVar(false);
+                varExpr.setVar((VarIdentifier) ident);
+                withVarList.add(varExpr);
+                newScope.addNewVarSymbolToScope((VarIdentifier) ident);
+            }
+        }
+
+        // Sets the field list for the group variable.
+        List<Pair<Expression, Identifier>> groupFieldList = new ArrayList<>();
+        if (!gc.hasGroupFieldList()) {
+            for (VariableExpr varExpr : withVarList) {
+                Pair<Expression, Identifier> varIdPair = new Pair<>(new VariableExpr(varExpr.getVar()),
+                        SqlppVariableUtil.toUserDefinedVariableName(varExpr.getVar()));
+                groupFieldList.add(varIdPair);
+            }
+            gc.setGroupFieldList(groupFieldList);
+        } else {
+            // Check the scopes of group field variables.
+            for (Pair<Expression, Identifier> groupField : gc.getGroupFieldList()) {
+                Expression newVar = groupField.first.accept(this, arg);
+                groupFieldList.add(new Pair<>(newVar, groupField.second));
+            }
+        }
+        gc.setGroupFieldList(groupFieldList);
+
+        // Sets the group variable.
+        if (!gc.hasGroupVar()) {
+            VariableExpr groupVar = new VariableExpr(context.newVariable());
+            gc.setGroupVar(groupVar);
+        }
+        newScope.addNewVarSymbolToScope(gc.getGroupVar().getVar());
+
+        // Adds the group variable into the "with" (i.e., re-binding) variable list.
+        VariableExpr gbyVarRef = new VariableExpr(gc.getGroupVar().getVar());
+        gbyVarRef.setIsNewVar(false);
+        withVarList.add(gbyVarRef);
+        gc.setWithVarList(withVarList);
+
+        scopeChecker.replaceCurrentScope(newScope);
+        return null;
+    }
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java
index 0624484..a9aff55 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java
@@ -30,7 +30,7 @@
     }
 
     @Override
-    public Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env) {
+    protected Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env) {
         if (env.constainsOldVar(expr)) {
             return env.findSubstituion(expr);
         }
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/UsedVariableVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/UsedVariableVisitor.java
new file mode 100644
index 0000000..877f722
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/UsedVariableVisitor.java
@@ -0,0 +1,362 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.lang.sqlpp.visitor;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+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.QuantifiedPair;
+import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.clause.HavingClause;
+import org.apache.asterix.lang.sqlpp.clause.JoinClause;
+import org.apache.asterix.lang.sqlpp.clause.NestClause;
+import org.apache.asterix.lang.sqlpp.clause.Projection;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.clause.SelectClause;
+import org.apache.asterix.lang.sqlpp.clause.SelectElement;
+import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
+import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
+import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
+import org.apache.hyracks.algebricks.common.utils.Pair;
+
+public class UsedVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Void, Collection<VariableExpr>> {
+
+    @Override
+    public Void visit(FromClause fromClause, Collection<VariableExpr> usedVars) throws AsterixException {
+        for (FromTerm fromTerm : fromClause.getFromTerms()) {
+            fromTerm.accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(FromTerm fromTerm, Collection<VariableExpr> usedVars) throws AsterixException {
+        // Visit the left expression of a from term.
+        fromTerm.getLeftExpression().accept(this, usedVars);
+
+        // Visits join/unnest/nest clauses.
+        for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
+            correlateClause.accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(JoinClause joinClause, Collection<VariableExpr> usedVars) throws AsterixException {
+        // NOTE: the two join branches cannot be correlated, instead of checking
+        // the correlation here,
+        // we defer the check to the query optimizer.
+        joinClause.getRightExpression().accept(this, usedVars);
+
+        // The condition expression can refer to the just registered variables
+        // for the right branch.
+        joinClause.getConditionExpression().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(NestClause nestClause, Collection<VariableExpr> usedVars) throws AsterixException {
+        // NOTE: the two branches of a NEST cannot be correlated, instead of
+        // checking the correlation here, we defer the check to the query
+        // optimizer.
+        nestClause.getRightExpression().accept(this, usedVars);
+
+        // The condition expression can refer to the just registered variables
+        // for the right branch.
+        nestClause.getConditionExpression().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(UnnestClause unnestClause, Collection<VariableExpr> usedVars) throws AsterixException {
+        unnestClause.getRightExpression().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(Projection projection, Collection<VariableExpr> usedVars) throws AsterixException {
+        projection.getExpression().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(SelectBlock selectBlock, Collection<VariableExpr> usedVars) throws AsterixException {
+        // Traverses the select block in the order of "from", "let"s, "where",
+        // "group by", "let"s, "having" and "select".
+        if (selectBlock.hasFromClause()) {
+            selectBlock.getFromClause().accept(this, usedVars);
+        }
+        if (selectBlock.hasLetClauses()) {
+            List<LetClause> letList = selectBlock.getLetList();
+            for (LetClause letClause : letList) {
+                letClause.accept(this, usedVars);
+            }
+        }
+        if (selectBlock.hasWhereClause()) {
+            selectBlock.getWhereClause().accept(this, usedVars);
+        }
+        if (selectBlock.hasGroupbyClause()) {
+            selectBlock.getGroupbyClause().accept(this, usedVars);
+            if (selectBlock.hasLetClausesAfterGroupby()) {
+                List<LetClause> letListAfterGby = selectBlock.getLetListAfterGroupby();
+                for (LetClause letClauseAfterGby : letListAfterGby) {
+                    letClauseAfterGby.accept(this, usedVars);
+                }
+            }
+            if (selectBlock.hasHavingClause()) {
+                selectBlock.getHavingClause().accept(this, usedVars);
+            }
+        }
+        selectBlock.getSelectClause().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(SelectClause selectClause, Collection<VariableExpr> usedVars) throws AsterixException {
+        if (selectClause.selectElement()) {
+            selectClause.getSelectElement().accept(this, usedVars);
+        }
+        if (selectClause.selectRegular()) {
+            selectClause.getSelectRegular().accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(SelectElement selectElement, Collection<VariableExpr> usedVars) throws AsterixException {
+        selectElement.getExpression().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(SelectRegular selectRegular, Collection<VariableExpr> usedVars) throws AsterixException {
+        for (Projection projection : selectRegular.getProjections()) {
+            projection.accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(SelectSetOperation selectSetOperation, Collection<VariableExpr> usedVars)
+            throws AsterixException {
+        selectSetOperation.getLeftInput().accept(this, usedVars);
+        for (SetOperationRight right : selectSetOperation.getRightInputs()) {
+            right.getSetOperationRightInput().accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(HavingClause havingClause, Collection<VariableExpr> usedVars) throws AsterixException {
+        havingClause.getFilterExpression().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(Query q, Collection<VariableExpr> usedVars) throws AsterixException {
+        q.getBody().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(FunctionDecl fd, Collection<VariableExpr> usedVars) throws AsterixException {
+        fd.getFuncBody().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(WhereClause whereClause, Collection<VariableExpr> usedVars) throws AsterixException {
+        whereClause.getWhereExpr().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(OrderbyClause oc, Collection<VariableExpr> usedVars) throws AsterixException {
+        for (Expression orderExpr : oc.getOrderbyList()) {
+            orderExpr.accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(GroupbyClause gc, Collection<VariableExpr> usedVars) throws AsterixException {
+        // Puts all group-by variables into the symbol set of the new scope.
+        for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
+            gbyVarExpr.getExpr().accept(this, usedVars);
+        }
+        for (GbyVariableExpressionPair decorVarExpr : gc.getDecorPairList()) {
+            decorVarExpr.getExpr().accept(this, usedVars);
+        }
+        if (gc.hasGroupFieldList()) {
+            for (Pair<Expression, Identifier> groupField : gc.getGroupFieldList()) {
+                groupField.first.accept(this, usedVars);
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(LimitClause limitClause, Collection<VariableExpr> usedVars) throws AsterixException {
+        limitClause.getLimitExpr().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(LetClause letClause, Collection<VariableExpr> usedVars) throws AsterixException {
+        letClause.getBindingExpr().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(SelectExpression selectExpression, Collection<VariableExpr> usedVars) throws AsterixException {
+        // visit let list
+        if (selectExpression.hasLetClauses()) {
+            for (LetClause letClause : selectExpression.getLetList()) {
+                letClause.accept(this, usedVars);
+            }
+        }
+
+        // visit the main select.
+        selectExpression.getSelectSetOperation().accept(this, usedVars);
+
+        // visit order by
+        if (selectExpression.hasOrderby()) {
+            for (Expression orderExpr : selectExpression.getOrderbyClause().getOrderbyList()) {
+                orderExpr.accept(this, usedVars);
+            }
+        }
+
+        // visit limit
+        if (selectExpression.hasLimit()) {
+            selectExpression.getLimitClause().accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(LiteralExpr l, Collection<VariableExpr> usedVars) throws AsterixException {
+        return null;
+    }
+
+    @Override
+    public Void visit(ListConstructor lc, Collection<VariableExpr> usedVars) throws AsterixException {
+        for (Expression expr : lc.getExprList()) {
+            expr.accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(RecordConstructor rc, Collection<VariableExpr> usedVars) throws AsterixException {
+        for (FieldBinding binding : rc.getFbList()) {
+            binding.getLeftExpr().accept(this, usedVars);
+            binding.getRightExpr().accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(OperatorExpr operatorExpr, Collection<VariableExpr> usedVars) throws AsterixException {
+        for (Expression expr : operatorExpr.getExprList()) {
+            expr.accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(IfExpr ifExpr, Collection<VariableExpr> usedVars) throws AsterixException {
+        ifExpr.getCondExpr().accept(this, usedVars);
+        ifExpr.getThenExpr().accept(this, usedVars);
+        ifExpr.getElseExpr().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(QuantifiedExpression qe, Collection<VariableExpr> usedVars) throws AsterixException {
+        for (QuantifiedPair pair : qe.getQuantifiedList()) {
+            pair.getExpr().accept(this, usedVars);
+        }
+        qe.getSatisfiesExpr().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(CallExpr callExpr, Collection<VariableExpr> usedVars) throws AsterixException {
+        for (Expression expr : callExpr.getExprList()) {
+            expr.accept(this, usedVars);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(VariableExpr varExpr, Collection<VariableExpr> usedVars) throws AsterixException {
+        usedVars.add(varExpr);
+        return null;
+    }
+
+    @Override
+    public Void visit(UnaryExpr u, Collection<VariableExpr> usedVars) throws AsterixException {
+        u.getExpr().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(FieldAccessor fa, Collection<VariableExpr> usedVars) throws AsterixException {
+        fa.getExpr().accept(this, usedVars);
+        return null;
+    }
+
+    @Override
+    public Void visit(IndexAccessor ia, Collection<VariableExpr> usedVars) throws AsterixException {
+        ia.getExpr().accept(this, usedVars);
+        if (ia.getIndexExpr() != null) {
+            ia.getIndexExpr();
+        }
+        return null;
+    }
+
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/VariableCheckAndRewriteVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/VariableCheckAndRewriteVisitor.java
index f9cf99f..f4456a4 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/VariableCheckAndRewriteVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/VariableCheckAndRewriteVisitor.java
@@ -19,7 +19,6 @@
 package org.apache.asterix.lang.sqlpp.visitor;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.asterix.common.config.MetadataConstants;
@@ -68,15 +67,17 @@
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
-import org.apache.asterix.lang.sqlpp.util.SqlppFormatPrintUtil;
+import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
 import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
 import org.apache.hyracks.algebricks.core.algebra.base.Counter;
 
-public class VariableCheckAndRewriteVisitor extends AbstractSqlppQueryExpressionVisitor<Expression, Void> {
+public class VariableCheckAndRewriteVisitor extends AbstractSqlppQueryExpressionVisitor<Expression, Expression> {
 
-    private final ScopeChecker scopeChecker = new ScopeChecker();
-    private final LangRewritingContext context;
-    private final boolean overwrite;
+    protected final ScopeChecker scopeChecker = new ScopeChecker();
+    protected final LangRewritingContext context;
+    protected final boolean overwrite;
+    protected final AqlMetadataProvider metadataProvider;
 
     /**
      * @param context,
@@ -86,14 +87,16 @@
      *            This flag can only be true for rewriting a top-level query.
      *            It should be false for rewriting the body expression of a user-defined function.
      */
-    public VariableCheckAndRewriteVisitor(LangRewritingContext context, boolean overwrite) {
+    public VariableCheckAndRewriteVisitor(LangRewritingContext context, boolean overwrite,
+            AqlMetadataProvider metadataProvider) {
         this.context = context;
         scopeChecker.setVarCounter(new Counter(context.getVarCounter()));
         this.overwrite = overwrite;
+        this.metadataProvider = metadataProvider;
     }
 
     @Override
-    public Expression visit(FromClause fromClause, Void arg) throws AsterixException {
+    public Expression visit(FromClause fromClause, Expression arg) throws AsterixException {
         scopeChecker.extendCurrentScope();
         for (FromTerm fromTerm : fromClause.getFromTerms()) {
             fromTerm.accept(this, arg);
@@ -102,7 +105,8 @@
     }
 
     @Override
-    public Expression visit(FromTerm fromTerm, Void arg) throws AsterixException {
+    public Expression visit(FromTerm fromTerm, Expression arg) throws AsterixException {
+        scopeChecker.createNewScope();
         // Visit the left expression of a from term.
         fromTerm.setLeftExpression(fromTerm.getLeftExpression().accept(this, arg));
 
@@ -115,7 +119,6 @@
             VariableExpr posVar = fromTerm.getPositionalVariable();
             scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
         }
-
         // Visits join/unnest/nest clauses.
         for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
             correlateClause.accept(this, arg);
@@ -124,7 +127,10 @@
     }
 
     @Override
-    public Expression visit(JoinClause joinClause, Void arg) throws AsterixException {
+    public Expression visit(JoinClause joinClause, Expression arg) throws AsterixException {
+        Scope backupScope = scopeChecker.removeCurrentScope();
+        Scope parentScope = scopeChecker.getCurrentScope();
+        scopeChecker.createNewScope();
         // NOTE: the two join branches cannot be correlated, instead of checking
         // the correlation here,
         // we defer the check to the query optimizer.
@@ -140,6 +146,11 @@
             scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
         }
 
+        Scope rightScope = scopeChecker.removeCurrentScope();
+        Scope mergedScope = new Scope(scopeChecker, parentScope);
+        mergedScope.merge(backupScope);
+        mergedScope.merge(rightScope);
+        scopeChecker.pushExistingScope(mergedScope);
         // The condition expression can refer to the just registered variables
         // for the right branch.
         joinClause.setConditionExpression(joinClause.getConditionExpression().accept(this, arg));
@@ -147,7 +158,7 @@
     }
 
     @Override
-    public Expression visit(NestClause nestClause, Void arg) throws AsterixException {
+    public Expression visit(NestClause nestClause, Expression arg) throws AsterixException {
         // NOTE: the two branches of a NEST cannot be correlated, instead of
         // checking the correlation here, we defer the check to the query
         // optimizer.
@@ -170,7 +181,7 @@
     }
 
     @Override
-    public Expression visit(UnnestClause unnestClause, Void arg) throws AsterixException {
+    public Expression visit(UnnestClause unnestClause, Expression arg) throws AsterixException {
         unnestClause.setRightExpression(unnestClause.getRightExpression().accept(this, arg));
 
         // register the data item variable
@@ -186,13 +197,13 @@
     }
 
     @Override
-    public Expression visit(Projection projection, Void arg) throws AsterixException {
+    public Expression visit(Projection projection, Expression arg) throws AsterixException {
         projection.setExpression(projection.getExpression().accept(this, arg));
         return null;
     }
 
     @Override
-    public Expression visit(SelectBlock selectBlock, Void arg) throws AsterixException {
+    public Expression visit(SelectBlock selectBlock, Expression arg) throws AsterixException {
         // Traverses the select block in the order of "from", "let"s, "where",
         // "group by", "let"s, "having" and "select".
         if (selectBlock.hasFromClause()) {
@@ -209,22 +220,23 @@
         }
         if (selectBlock.hasGroupbyClause()) {
             selectBlock.getGroupbyClause().accept(this, arg);
-        }
-        if (selectBlock.hasLetClausesAfterGroupby()) {
-            List<LetClause> letListAfterGby = selectBlock.getLetListAfterGroupby();
-            for (LetClause letClauseAfterGby : letListAfterGby) {
-                letClauseAfterGby.accept(this, arg);
+            if (selectBlock.hasLetClausesAfterGroupby()) {
+                List<LetClause> letListAfterGby = selectBlock.getLetListAfterGroupby();
+                for (LetClause letClauseAfterGby : letListAfterGby) {
+                    letClauseAfterGby.accept(this, arg);
+                }
             }
-        }
-        if (selectBlock.hasHavingClause()) {
-            selectBlock.getHavingClause().accept(this, arg);
+            if (selectBlock.hasHavingClause()) {
+                // Rewrites the having clause.
+                selectBlock.getHavingClause().accept(this, arg);
+            }
         }
         selectBlock.getSelectClause().accept(this, arg);
         return null;
     }
 
     @Override
-    public Expression visit(SelectClause selectClause, Void arg) throws AsterixException {
+    public Expression visit(SelectClause selectClause, Expression arg) throws AsterixException {
         if (selectClause.selectElement()) {
             selectClause.getSelectElement().accept(this, arg);
         }
@@ -235,13 +247,13 @@
     }
 
     @Override
-    public Expression visit(SelectElement selectElement, Void arg) throws AsterixException {
+    public Expression visit(SelectElement selectElement, Expression arg) throws AsterixException {
         selectElement.setExpression(selectElement.getExpression().accept(this, arg));
         return null;
     }
 
     @Override
-    public Expression visit(SelectRegular selectRegular, Void arg) throws AsterixException {
+    public Expression visit(SelectRegular selectRegular, Expression arg) throws AsterixException {
         for (Projection projection : selectRegular.getProjections()) {
             projection.accept(this, arg);
         }
@@ -249,7 +261,7 @@
     }
 
     @Override
-    public Expression visit(SelectSetOperation selectSetOperation, Void arg) throws AsterixException {
+    public Expression visit(SelectSetOperation selectSetOperation, Expression arg) throws AsterixException {
         selectSetOperation.getLeftInput().accept(this, arg);
         for (SetOperationRight right : selectSetOperation.getRightInputs()) {
             scopeChecker.createNewScope();
@@ -259,13 +271,13 @@
     }
 
     @Override
-    public Expression visit(HavingClause havingClause, Void arg) throws AsterixException {
+    public Expression visit(HavingClause havingClause, Expression arg) throws AsterixException {
         havingClause.setFilterExpression(havingClause.getFilterExpression().accept(this, arg));
         return null;
     }
 
     @Override
-    public Expression visit(Query q, Void arg) throws AsterixException {
+    public Expression visit(Query q, Expression arg) throws AsterixException {
         q.setBody(q.getBody().accept(this, arg));
         q.setVarCounter(scopeChecker.getVarCounter());
         context.setVarCounter(scopeChecker.getVarCounter());
@@ -273,7 +285,7 @@
     }
 
     @Override
-    public Expression visit(FunctionDecl fd, Void arg) throws AsterixException {
+    public Expression visit(FunctionDecl fd, Expression arg) throws AsterixException {
         scopeChecker.createNewScope();
         fd.setFuncBody(fd.getFuncBody().accept(this, arg));
         scopeChecker.removeCurrentScope();
@@ -281,13 +293,13 @@
     }
 
     @Override
-    public Expression visit(WhereClause whereClause, Void arg) throws AsterixException {
+    public Expression visit(WhereClause whereClause, Expression arg) throws AsterixException {
         whereClause.setWhereExpr(whereClause.getWhereExpr().accept(this, arg));
         return null;
     }
 
     @Override
-    public Expression visit(OrderbyClause oc, Void arg) throws AsterixException {
+    public Expression visit(OrderbyClause oc, Expression arg) throws AsterixException {
         List<Expression> newOrderbyList = new ArrayList<Expression>();
         for (Expression orderExpr : oc.getOrderbyList()) {
             newOrderbyList.add(orderExpr.accept(this, arg));
@@ -297,7 +309,7 @@
     }
 
     @Override
-    public Expression visit(GroupbyClause gc, Void arg) throws AsterixException {
+    public Expression visit(GroupbyClause gc, Expression arg) throws AsterixException {
         Scope newScope = scopeChecker.extendCurrentScopeNoPush(true);
         // Puts all group-by variables into the symbol set of the new scope.
         for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
@@ -307,26 +319,15 @@
                 newScope.addNewVarSymbolToScope(gbyVarExpr.getVar().getVar());
             }
         }
-        // Puts all live variables into withVarList.
-        List<VariableExpr> withVarList = new ArrayList<VariableExpr>();
-        Iterator<Identifier> varIterator = scopeChecker.getCurrentScope().liveSymbols();
-        while (varIterator.hasNext()) {
-            Identifier ident = varIterator.next();
-            VariableExpr varExpr = new VariableExpr();
-            if (ident instanceof VarIdentifier) {
-                varExpr.setIsNewVar(false);
-                varExpr.setVar((VarIdentifier) ident);
-                withVarList.add(varExpr);
-                newScope.addNewVarSymbolToScope((VarIdentifier) ident);
-            }
+        for (VariableExpr withVar : gc.getWithVarList()) {
+            newScope.addNewVarSymbolToScope(withVar.getVar());
         }
-        gc.setWithVarList(withVarList);
         scopeChecker.replaceCurrentScope(newScope);
         return null;
     }
 
     @Override
-    public Expression visit(LimitClause limitClause, Void arg) throws AsterixException {
+    public Expression visit(LimitClause limitClause, Expression arg) throws AsterixException {
         scopeChecker.pushForbiddenScope(scopeChecker.getCurrentScope());
         limitClause.setLimitExpr(limitClause.getLimitExpr().accept(this, arg));
         scopeChecker.popForbiddenScope();
@@ -334,7 +335,7 @@
     }
 
     @Override
-    public Expression visit(LetClause letClause, Void arg) throws AsterixException {
+    public Expression visit(LetClause letClause, Expression arg) throws AsterixException {
         scopeChecker.extendCurrentScope();
         letClause.setBindingExpr(letClause.getBindingExpr().accept(this, arg));
         scopeChecker.getCurrentScope().addNewVarSymbolToScope(letClause.getVarExpr().getVar());
@@ -342,7 +343,7 @@
     }
 
     @Override
-    public Expression visit(SelectExpression selectExpression, Void arg) throws AsterixException {
+    public Expression visit(SelectExpression selectExpression, Expression arg) throws AsterixException {
         Scope scopeBeforeSelectExpression = scopeChecker.getCurrentScope();
         scopeChecker.createNewScope();
 
@@ -354,13 +355,11 @@
         }
 
         // visit the main select.
-        selectExpression.getSelectSetOperation().accept(this, arg);
+        selectExpression.getSelectSetOperation().accept(this, selectExpression);
 
         // visit order by
         if (selectExpression.hasOrderby()) {
-            for (Expression orderExpr : selectExpression.getOrderbyClause().getOrderbyList()) {
-                orderExpr.accept(this, arg);
-            }
+            selectExpression.getOrderbyClause().accept(this, arg);
         }
 
         // visit limit
@@ -376,12 +375,12 @@
     }
 
     @Override
-    public Expression visit(LiteralExpr l, Void arg) throws AsterixException {
+    public Expression visit(LiteralExpr l, Expression arg) throws AsterixException {
         return l;
     }
 
     @Override
-    public Expression visit(ListConstructor lc, Void arg) throws AsterixException {
+    public Expression visit(ListConstructor lc, Expression arg) throws AsterixException {
         List<Expression> newExprList = new ArrayList<Expression>();
         for (Expression expr : lc.getExprList()) {
             newExprList.add(expr.accept(this, arg));
@@ -391,7 +390,7 @@
     }
 
     @Override
-    public Expression visit(RecordConstructor rc, Void arg) throws AsterixException {
+    public Expression visit(RecordConstructor rc, Expression arg) throws AsterixException {
         for (FieldBinding binding : rc.getFbList()) {
             binding.setLeftExpr(binding.getLeftExpr().accept(this, arg));
             binding.setRightExpr(binding.getRightExpr().accept(this, arg));
@@ -400,7 +399,7 @@
     }
 
     @Override
-    public Expression visit(OperatorExpr operatorExpr, Void arg) throws AsterixException {
+    public Expression visit(OperatorExpr operatorExpr, Expression arg) throws AsterixException {
         List<Expression> newExprList = new ArrayList<Expression>();
         for (Expression expr : operatorExpr.getExprList()) {
             newExprList.add(expr.accept(this, arg));
@@ -410,7 +409,7 @@
     }
 
     @Override
-    public Expression visit(IfExpr ifExpr, Void arg) throws AsterixException {
+    public Expression visit(IfExpr ifExpr, Expression arg) throws AsterixException {
         ifExpr.setCondExpr(ifExpr.getCondExpr().accept(this, arg));
         ifExpr.setThenExpr(ifExpr.getThenExpr().accept(this, arg));
         ifExpr.setElseExpr(ifExpr.getElseExpr().accept(this, arg));
@@ -418,7 +417,7 @@
     }
 
     @Override
-    public Expression visit(QuantifiedExpression qe, Void arg) throws AsterixException {
+    public Expression visit(QuantifiedExpression qe, Expression arg) throws AsterixException {
         scopeChecker.createNewScope();
         for (QuantifiedPair pair : qe.getQuantifiedList()) {
             scopeChecker.getCurrentScope().addNewVarSymbolToScope(pair.getVarExpr().getVar());
@@ -430,7 +429,7 @@
     }
 
     @Override
-    public Expression visit(CallExpr callExpr, Void arg) throws AsterixException {
+    public Expression visit(CallExpr callExpr, Expression arg) throws AsterixException {
         List<Expression> newExprList = new ArrayList<Expression>();
         for (Expression expr : callExpr.getExprList()) {
             newExprList.add(expr.accept(this, arg));
@@ -440,7 +439,7 @@
     }
 
     @Override
-    public Expression visit(VariableExpr varExpr, Void arg) throws AsterixException {
+    public Expression visit(VariableExpr varExpr, Expression arg) throws AsterixException {
         String varName = varExpr.getVar().getValue();
         if (scopeChecker.isInForbiddenScopes(varName)) {
             throw new AsterixException(
@@ -454,19 +453,19 @@
     }
 
     @Override
-    public Expression visit(UnaryExpr u, Void arg) throws AsterixException {
+    public Expression visit(UnaryExpr u, Expression arg) throws AsterixException {
         u.setExpr(u.getExpr().accept(this, arg));
         return u;
     }
 
     @Override
-    public Expression visit(FieldAccessor fa, Void arg) throws AsterixException {
+    public Expression visit(FieldAccessor fa, Expression arg) throws AsterixException {
         fa.setExpr(fa.getExpr().accept(this, arg));
         return fa;
     }
 
     @Override
-    public Expression visit(IndexAccessor ia, Void arg) throws AsterixException {
+    public Expression visit(IndexAccessor ia, Expression arg) throws AsterixException {
         ia.setExpr(ia.getExpr().accept(this, arg));
         if (ia.getIndexExpr() != null) {
             ia.setIndexExpr(ia.getIndexExpr());
@@ -490,7 +489,7 @@
     }
 
     // Rewrites for global variable (e.g., dataset) references.
-    private Expression datasetRewrite(Expression expr) throws AsterixException {
+    private Expression datasetRewrite(VariableExpr expr) throws AsterixException {
         if (!overwrite) {
             return expr;
         }
@@ -498,7 +497,9 @@
         String dataverse = MetadataConstants.METADATA_DATAVERSE_NAME;
         FunctionSignature signature = new FunctionSignature(dataverse, funcName, 1);
         List<Expression> argList = new ArrayList<Expression>();
-        argList.add(new LiteralExpr(new StringLiteral(SqlppFormatPrintUtil.toString(expr))));
+        //Ignore the parser-generated prefix "$" for a dataset.
+        String dataset = SqlppVariableUtil.toUserDefinedVariableName(expr.getVar()).getValue();
+        argList.add(new LiteralExpr(new StringLiteral(dataset)));
         return new CallExpr(signature, argList);
     }
 }
diff --git a/asterix-lang-sqlpp/src/main/javacc/SQLPP.html b/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
index ebe7926..bbecc21 100644
--- a/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
+++ b/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
@@ -863,7 +863,7 @@
 <TR>
 <TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod93">GroupbyClause</A></TD>
 <TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
-<TD ALIGN=LEFT VALIGN=BASELINE>&lt;GROUP&gt; &lt;BY&gt; ( <A HREF="#prod43">Expression</A> ( ( &lt;AS&gt; )? <A HREF="#prod49">Variable</A> )? ( &lt;COMMA&gt; <A HREF="#prod43">Expression</A> ( ( &lt;AS&gt; )? <A HREF="#prod49">Variable</A> )? )* )</TD>
+<TD ALIGN=LEFT VALIGN=BASELINE>&lt;GROUP&gt; &lt;BY&gt; ( <A HREF="#prod43">Expression</A> ( ( &lt;AS&gt; )? <A HREF="#prod49">Variable</A> )? ( &lt;COMMA&gt; <A HREF="#prod43">Expression</A> ( ( &lt;AS&gt; )? <A HREF="#prod49">Variable</A> )? )* ) ( &lt;GROUP&gt; &lt;AS&gt; <A HREF="#prod49">Variable</A> ( &lt;LEFTPAREN&gt; <A HREF="#prod75">VariableRef</A> &lt;AS&gt; <A HREF="#prod18">Identifier</A> ( &lt;COMMA&gt; <A HREF="#prod75">VariableRef</A> &lt;AS&gt; <A HREF="#prod18">Identifier</A> )* &lt;RIGHTPAREN&gt; )? )?</TD>
 </TR>
 <TR>
 <TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod94">HavingClause</A></TD>
diff --git a/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index 38b4429..3c81cff 100644
--- a/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -141,6 +141,7 @@
 import org.apache.asterix.lang.sqlpp.optype.SetOpType;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationInput;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
+import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
 import org.apache.hyracks.algebricks.common.utils.Pair;
 import org.apache.hyracks.algebricks.common.utils.Triple;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionAnnotation;
@@ -757,14 +758,12 @@
 {
   <LEFTPAREN> (<IDENTIFIER>
     {
-      var = new VarIdentifier();
-      var.setValue(token.image);
+      var = SqlppVariableUtil.toInternalVariableIdentifier(token.image);
       paramList.add(var);
     }
   (<COMMA> <IDENTIFIER>
     {
-      var = new VarIdentifier();
-      var.setValue(token.image);
+      var = SqlppVariableUtil.toInternalVariableIdentifier(token.image);
       paramList.add(var);
     }
   )*)? <RIGHTPAREN>
@@ -1598,7 +1597,7 @@
           op.addOperand(operand);
         op.setCurrentop(true);
         }
-      op.addOperator(token.image);
+      op.addOperator(token.image.toLowerCase());
     }
 
     operand = AndExpr()
@@ -1629,7 +1628,7 @@
           op.addOperand(operand);
         op.setCurrentop(true);
         }
-      op.addOperator(token.image);
+      op.addOperator(token.image.toLowerCase());
     }
 
     operand = RelExpr()
@@ -1925,17 +1924,18 @@
     { String id = null; }
     (<IDENTIFIER> { id = token.image; } | id = QuotedString())
     {
+     id = SqlppVariableUtil.toInternalVariableName(id); // Prefix user-defined variables with "$"
      Identifier ident = lookupSymbol(id);
      if (isInForbiddenScopes(id)) {
        throw new ParseException("Inside limit clauses, it is disallowed to reference a variable having the same name as any variable bound in the same scope as the limit clause.");
      }
      if(ident != null) { // exist such ident
-       varExp.setIsNewVar(false);
        varExp.setVar((VarIdentifier)ident);
      } else {
        varExp.setVar(var);
+       varExp.setIsNewVar(false);
+       var.setValue(id);
      }
-     var.setValue(id);
      return varExp;
     }
 }
@@ -1950,6 +1950,7 @@
     { String id = null; }
     (<IDENTIFIER> { id = token.image; } | id = QuotedString())
     {
+     id = SqlppVariableUtil.toInternalVariableName(id); // prefix user-defined variables with "$".
      Identifier ident = lookupSymbol(id);
      if(ident != null) { // exist such ident
        varExp.setIsNewVar(false);
@@ -2498,6 +2499,9 @@
     Expression expr = null;
     VariableExpr decorVar = null;
     Expression decorExpr = null;
+
+    VariableExpr groupVar = null;
+    List<Pair<Expression, Identifier>> groupFieldList = new ArrayList<Pair<Expression, Identifier>>();
 }
 {
       {
@@ -2531,10 +2535,32 @@
          }
         )*
     )
+    (<GROUP> <AS> groupVar = Variable()
+      ( LOOKAHEAD(1)
+        {
+            VariableExpr fieldVarExpr = null;
+            String fieldIdentifierStr = null;
+        }
+        <LEFTPAREN>
+               fieldVarExpr = VariableRef() <AS> fieldIdentifierStr = Identifier()
+               {
+                   groupFieldList.add(new Pair<Expression, Identifier>(fieldVarExpr, new Identifier(fieldIdentifierStr)));
+               }
+        (<COMMA>
+               fieldVarExpr = VariableRef() <AS> fieldIdentifierStr = Identifier()
+               {
+                   groupFieldList.add(new Pair<Expression, Identifier>(fieldVarExpr, new Identifier(fieldIdentifierStr)));
+               }
+        )*
+        <RIGHTPAREN>
+      )?
+    )?
     {
       gbc.setGbyPairList(vePairList);
       gbc.setDecorPairList(new ArrayList<GbyVariableExpressionPair>());
       gbc.setWithVarList(new ArrayList<VariableExpr>());
+      gbc.setGroupVar(groupVar);
+      gbc.setGroupFieldList(groupFieldList);
       replaceCurrentScope(newScope);
       return gbc;
     }