asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [35/51] [partial] incubator-asterixdb git commit: ASTERIXDB-1226: implement SQL++ core group-by semantics and syntatic sugars.
Date Mon, 28 Mar 2016 20:19:02 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_01.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@ RecordConstructor [
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,13 +39,13 @@ FROM [  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_custkey
       ]
       =
@@ -54,7 +54,7 @@ Where
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_totalprice
       ]
       >
@@ -63,7 +63,7 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-conjunctive_02.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@ RecordConstructor [
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -37,7 +37,7 @@ RecordConstructor [
     LiteralExpr [STRING] [o_totalprice]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_totalprice
     ]
   )
@@ -47,13 +47,13 @@ FROM [  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_custkey
       ]
       =
@@ -62,7 +62,7 @@ Where
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=o ]
+        Variable [ Name=$o ]
         Field=o_totalprice
       ]
       >
@@ -71,7 +71,7 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search-open.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@ RecordConstructor [
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,12 +39,12 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
     =

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-index-search.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@ RecordConstructor [
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,12 +39,12 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
     =

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search-open.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@ RecordConstructor [
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,12 +39,12 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
     =

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/prim-idx-search.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [o_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
   )
@@ -29,7 +29,7 @@ RecordConstructor [
     LiteralExpr [STRING] [o_custkey]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_custkey
     ]
   )
@@ -39,12 +39,12 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderkey
     ]
     =

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/pull_select_above_eq_join.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [uid]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=uid
     ]
   )
@@ -35,7 +35,7 @@ RecordConstructor [
     LiteralExpr [STRING] [vid]
     :
     FieldAccessor [
-      Variable [ Name=visitor ]
+      Variable [ Name=$visitor ]
       Field=vid
     ]
   )
@@ -45,36 +45,36 @@ FROM [  FunctionCall Metadata.dataset@1[
     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
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push-project-through-group.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     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 @@ FROM [  FunctionCall Metadata.dataset@1[
     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 @@ LetVariable [ Name=matches ]
         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
         ]
       ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/push_limit.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [price]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_totalprice
     ]
   )
@@ -29,7 +29,7 @@ RecordConstructor [
     LiteralExpr [STRING] [date]
     :
     FieldAccessor [
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
       Field=o_orderdate
     ]
   )
@@ -39,12 +39,12 @@ FROM [  FunctionCall Metadata.dataset@1[
     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 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=o ]
+    Variable [ Name=$o ]
     Field=o_orderkey
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     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 @@ RecordConstructor [
       (
         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 @@ RecordConstructor [
       (
         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 @@ RecordConstructor [
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -86,15 +86,15 @@ RecordConstructor [
             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 @@ RecordConstructor [
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=l_extendedprice
           ]
           *
@@ -115,7 +115,7 @@ RecordConstructor [
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               Field=l_discount
             ]
           ]
@@ -124,15 +124,15 @@ RecordConstructor [
             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 @@ RecordConstructor [
       (
         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 @@ RecordConstructor [
       (
         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 @@ RecordConstructor [
       (
         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 @@ RecordConstructor [
     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 @@ FROM [  FunctionCall Metadata.dataset@1[
     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
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     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 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Orders]
   ]
   AS
-  Variable [ Name=o ]
+  Variable [ Name=$o ]
 ,
   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 @@ Where
       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 @@ Where
     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 @@ Where
       and
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
           Field=l_shipdate
         ]
         >
@@ -149,37 +149,43 @@ Where
     ]
   ]
 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 @@ LetVariable [ Name=revenue ]
           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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     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 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Customers]
   ]
   AS
-  Variable [ Name=c ]
+  Variable [ Name=$c ]
 ,
   (
     SELECT ELEMENT [
@@ -105,7 +105,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=n_name
         ]
       )
@@ -113,7 +113,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_extendedprice
         ]
       )
@@ -121,7 +121,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_discount
         ]
       )
@@ -129,7 +129,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [s_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=s_nationkey
         ]
       )
@@ -137,7 +137,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [o_custkey]
         :
         FieldAccessor [
-          Variable [ Name=o ]
+          Variable [ Name=$o ]
           Field=o_custkey
         ]
       )
@@ -147,7 +147,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Orders]
       ]
       AS
-      Variable [ Name=o ]
+      Variable [ Name=$o ]
 ,
       (
         SELECT ELEMENT [
@@ -156,7 +156,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=n_name
             ]
           )
@@ -164,7 +164,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_extendedprice
             ]
           )
@@ -172,7 +172,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_discount
             ]
           )
@@ -180,7 +180,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_orderkey
             ]
           )
@@ -188,7 +188,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [s_nationkey]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=s_nationkey
             ]
           )
@@ -198,7 +198,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItems]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
 ,
           (
             SELECT ELEMENT [
@@ -207,7 +207,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=n1 ]
+                  Variable [ Name=$n1 ]
                   Field=n_name
                 ]
               )
@@ -215,7 +215,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -223,7 +223,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [s_nationkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_nationkey
                 ]
               )
@@ -233,7 +233,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Suppliers]
               ]
               AS
-              Variable [ Name=s ]
+              Variable [ Name=$s ]
 ,
               (
                 SELECT ELEMENT [
@@ -242,7 +242,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [n_name]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_name
                     ]
                   )
@@ -250,7 +250,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [n_nationkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=n ]
+                      Variable [ Name=$n ]
                       Field=n_nationkey
                     ]
                   )
@@ -260,31 +260,31 @@ FROM [  FunctionCall Metadata.dataset@1[
                     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 @@ FROM [  FunctionCall Metadata.dataset@1[
                   ]
               )
               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 @@ FROM [  FunctionCall Metadata.dataset@1[
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=o ]
+            Variable [ Name=$o ]
             Field=o_orderdate
           ]
           <
@@ -361,53 +361,58 @@ FROM [  FunctionCall Metadata.dataset@1[
       ]
   )
   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 @@ LetVariable [ Name=revenue ]
           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
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q08_group_by.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [o_orderdate]
     :
     FieldAccessor [
-      Variable [ Name=lnrcop ]
+      Variable [ Name=$lnrcop ]
       Field=o_orderdate
     ]
   )
@@ -105,7 +105,7 @@ RecordConstructor [
     LiteralExpr [STRING] [l_discount]
     :
     FieldAccessor [
-      Variable [ Name=lnrcop ]
+      Variable [ Name=$lnrcop ]
       Field=l_discount
     ]
   )
@@ -113,7 +113,7 @@ RecordConstructor [
     LiteralExpr [STRING] [l_extendedprice]
     :
     FieldAccessor [
-      Variable [ Name=lnrcop ]
+      Variable [ Name=$lnrcop ]
       Field=l_extendedprice
     ]
   )
@@ -121,7 +121,7 @@ RecordConstructor [
     LiteralExpr [STRING] [l_suppkey]
     :
     FieldAccessor [
-      Variable [ Name=lnrcop ]
+      Variable [ Name=$lnrcop ]
       Field=l_suppkey
     ]
   )
@@ -129,7 +129,7 @@ RecordConstructor [
     LiteralExpr [STRING] [s_nationkey]
     :
     FieldAccessor [
-      Variable [ Name=s ]
+      Variable [ Name=$s ]
       Field=s_nationkey
     ]
   )
@@ -139,7 +139,7 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Supplier]
   ]
   AS
-  Variable [ Name=s ]
+  Variable [ Name=$s ]
 ,
   (
     SELECT ELEMENT [
@@ -148,7 +148,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [o_orderdate]
         :
         FieldAccessor [
-          Variable [ Name=lnrco ]
+          Variable [ Name=$lnrco ]
           Field=o_orderdate
         ]
       )
@@ -156,7 +156,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=lnrco ]
+          Variable [ Name=$lnrco ]
           Field=l_discount
         ]
       )
@@ -164,7 +164,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=lnrco ]
+          Variable [ Name=$lnrco ]
           Field=l_extendedprice
         ]
       )
@@ -172,7 +172,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_suppkey]
         :
         FieldAccessor [
-          Variable [ Name=lnrco ]
+          Variable [ Name=$lnrco ]
           Field=l_suppkey
         ]
       )
@@ -185,7 +185,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [o_orderdate]
             :
             FieldAccessor [
-              Variable [ Name=nrco ]
+              Variable [ Name=$nrco ]
               Field=o_orderdate
             ]
           )
@@ -193,7 +193,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_partkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_partkey
             ]
           )
@@ -201,7 +201,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_discount
             ]
           )
@@ -209,7 +209,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_extendedprice
             ]
           )
@@ -217,7 +217,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
           )
@@ -227,7 +227,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [LineItem]
           ]
           AS
-          Variable [ Name=l ]
+          Variable [ Name=$l ]
 ,
           (
             SELECT ELEMENT [
@@ -236,7 +236,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [o_orderdate]
                 :
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderdate
                 ]
               )
@@ -244,7 +244,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [o_orderkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=o ]
+                  Variable [ Name=$o ]
                   Field=o_orderkey
                 ]
               )
@@ -254,7 +254,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [Orders]
               ]
               AS
-              Variable [ Name=o ]
+              Variable [ Name=$o ]
 ,
               (
                 SELECT ELEMENT [
@@ -263,7 +263,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [c_custkey]
                     :
                     FieldAccessor [
-                      Variable [ Name=c ]
+                      Variable [ Name=$c ]
                       Field=c_custkey
                     ]
                   )
@@ -273,7 +273,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [Customer]
                   ]
                   AS
-                  Variable [ Name=c ]
+                  Variable [ Name=$c ]
 ,
                   (
                     SELECT ELEMENT [
@@ -282,7 +282,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                         LiteralExpr [STRING] [n_nationkey]
                         :
                         FieldAccessor [
-                          Variable [ Name=n1 ]
+                          Variable [ Name=$n1 ]
                           Field=n_nationkey
                         ]
                       )
@@ -292,31 +292,31 @@ FROM [  FunctionCall Metadata.dataset@1[
                         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 @@ FROM [  FunctionCall Metadata.dataset@1[
                       ]
                   )
                   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 @@ FROM [  FunctionCall Metadata.dataset@1[
             and
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=nrco ]
+                Variable [ Name=$nrco ]
                 Field=o_orderdate
               ]
               <=
@@ -393,31 +393,31 @@ FROM [  FunctionCall Metadata.dataset@1[
           ]
       )
       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 @@ FROM [  FunctionCall Metadata.dataset@1[
       ]
   )
   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
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q09_group_by.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [l_extendedprice]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=l_extendedprice
     ]
   )
@@ -115,7 +115,7 @@ RecordConstructor [
     LiteralExpr [STRING] [l_discount]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=l_discount
     ]
   )
@@ -123,7 +123,7 @@ RecordConstructor [
     LiteralExpr [STRING] [l_quantity]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=l_quantity
     ]
   )
@@ -131,7 +131,7 @@ RecordConstructor [
     LiteralExpr [STRING] [l_orderkey]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=l_orderkey
     ]
   )
@@ -139,7 +139,7 @@ RecordConstructor [
     LiteralExpr [STRING] [n_name]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=n_name
     ]
   )
@@ -147,7 +147,7 @@ RecordConstructor [
     LiteralExpr [STRING] [ps_supplycost]
     :
     FieldAccessor [
-      Variable [ Name=l2 ]
+      Variable [ Name=$l2 ]
       Field=ps_supplycost
     ]
   )
@@ -157,7 +157,7 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [Part]
   ]
   AS
-  Variable [ Name=p ]
+  Variable [ Name=$p ]
 ,
   (
     SELECT ELEMENT [
@@ -166,7 +166,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_extendedprice]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_extendedprice
         ]
       )
@@ -174,7 +174,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_discount]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_discount
         ]
       )
@@ -182,7 +182,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_quantity]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_quantity
         ]
       )
@@ -190,7 +190,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_partkey]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_partkey
         ]
       )
@@ -198,7 +198,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [l_orderkey]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=l_orderkey
         ]
       )
@@ -206,7 +206,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=l1 ]
+          Variable [ Name=$l1 ]
           Field=n_name
         ]
       )
@@ -214,7 +214,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [ps_supplycost]
         :
         FieldAccessor [
-          Variable [ Name=ps ]
+          Variable [ Name=$ps ]
           Field=ps_supplycost
         ]
       )
@@ -224,7 +224,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [Partsupp]
       ]
       AS
-      Variable [ Name=ps ]
+      Variable [ Name=$ps ]
 ,
       (
         SELECT ELEMENT [
@@ -233,7 +233,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_suppkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_suppkey
             ]
           )
@@ -241,7 +241,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_extendedprice]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_extendedprice
             ]
           )
@@ -249,7 +249,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_discount]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_discount
             ]
           )
@@ -257,7 +257,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_quantity]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_quantity
             ]
           )
@@ -265,7 +265,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_partkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_partkey
             ]
           )
@@ -273,7 +273,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [l_orderkey]
             :
             FieldAccessor [
-              Variable [ Name=l ]
+              Variable [ Name=$l ]
               Field=l_orderkey
             ]
           )
@@ -281,7 +281,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [n_name]
             :
             FieldAccessor [
-              Variable [ Name=s1 ]
+              Variable [ Name=$s1 ]
               Field=n_name
             ]
           )
@@ -294,7 +294,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [s_suppkey]
                 :
                 FieldAccessor [
-                  Variable [ Name=s ]
+                  Variable [ Name=$s ]
                   Field=s_suppkey
                 ]
               )
@@ -302,7 +302,7 @@ FROM [  FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [n_name]
                 :
                 FieldAccessor [
-                  Variable [ Name=n ]
+                  Variable [ Name=$n ]
                   Field=n_name
                 ]
               )
@@ -312,87 +312,87 @@ FROM [  FunctionCall Metadata.dataset@1[
                 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 @@ Where
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=p ]
+        Variable [ Name=$p ]
         Field=p_partkey
       ]
       =
       FieldAccessor [
-        Variable [ Name=l2 ]
+        Variable [ Name=$l2 ]
         Field=l_partkey
       ]
     ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q1.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -42,20 +42,20 @@ FROM [  FunctionCall Metadata.dataset@1[
     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]
       ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
----------------------------------------------------------------------
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 @@ 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 ]
   )
 ]
 ]
@@ -55,47 +55,64 @@ FROM [  FunctionCall Metadata.dataset@1[
     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 @@ LetVariable [ Name=by_chapter ]
       (
         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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     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
+  )
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
----------------------------------------------------------------------
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 @@ FunctionDecl q22_customer_tmp([]) {
         LiteralExpr [STRING] [c_acctbal]
         :
         FieldAccessor [
-          Variable [ Name=c ]
+          Variable [ Name=$c ]
           Field=c_acctbal
         ]
       )
@@ -62,26 +62,26 @@ FunctionDecl q22_customer_tmp([]) {
         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 @@ FunctionDecl q22_customer_tmp([]) {
     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 @@ FunctionDecl q22_customer_tmp([]) {
 }
 
 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 @@ LetVariable [ Name=avg ]
           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 @@ LetVariable [ Name=avg ]
         OperatorExpr [
           OperatorExpr [
             FieldAccessor [
-              Variable [ Name=c ]
+              Variable [ Name=$c ]
               Field=c_acctbal
             ]
             >
@@ -174,43 +174,43 @@ LetVariable [ Name=avg ]
           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 @@ RecordConstructor [
   (
     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 @@ RecordConstructor [
       (
         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 @@ RecordConstructor [
 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 @@ Where
     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
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     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 @@ FROM [  FunctionCall Metadata.dataset@1[
     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
+  )
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [gid]
     :
-    Variable [ Name=aid ]
+    Variable [ Name=$aid ]
   )
   (
     LiteralExpr [STRING] [avg]
@@ -21,19 +21,19 @@ RecordConstructor [
       (
         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 @@ FROM [  FunctionCall Metadata.dataset@1[
     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
+  )
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
----------------------------------------------------------------------
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 Nation(NationType) partitioned by [[n_nationkey]]
 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 @@ LetVariable [ Name=t ]
         LiteralExpr [STRING] [n_nationkey]
         :
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_nationkey
         ]
       )
@@ -74,7 +74,7 @@ LetVariable [ Name=t ]
         LiteralExpr [STRING] [n_name]
         :
         FieldAccessor [
-          Variable [ Name=nation ]
+          Variable [ Name=$nation ]
           Field=n_name
         ]
       )
@@ -84,28 +84,28 @@ LetVariable [ Name=t ]
         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 @@ LetVariable [ Name=X ]
       (
         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 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [nation_key]
     :
-    Variable [ Name=nation_key ]
+    Variable [ Name=$nation_key ]
   )
   (
     LiteralExpr [STRING] [sum_price]
@@ -222,7 +229,7 @@ RecordConstructor [
           LiteralExpr [STRING] [orderdate]
           :
           FieldAccessor [
-            Variable [ Name=y ]
+            Variable [ Name=$y ]
             Field=order_date
           ]
         )
@@ -230,19 +237,19 @@ RecordConstructor [
           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 @@ RecordConstructor [
   )
 ]
 ]
-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
+  )
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     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 @@ FROM [  FunctionCall Metadata.dataset@1[
     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 @@ LetVariable [ Name=charges ]
         LiteralExpr [LONG] [1]
         -
         FieldAccessor [
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           Field=l_discount
         ]
       ]
@@ -160,24 +164,24 @@ LetVariable [ Name=charges ]
         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 @@ LetVariable [ Name=disc_prices ]
         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
 



Mime
View raw message