asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [06/51] [partial] incubator-asterixdb git commit: ASTERIXDB-1226: implement SQL++ core group-by semantics and syntatic sugars.
Date Mon, 28 Mar 2016 20:18:33 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/interval_functions/interval_functions.3.ast
----------------------------------------------------------------------
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 @@ LetVariable [ Name=itv1 ]
       LiteralExpr [STRING] [2010-12-21]
     ]
   ]
-LetVariable [ Name=itv2 ]
+Let Variable [ Name=$itv2 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.date@1[
@@ -20,7 +20,7 @@ LetVariable [ Name=itv2 ]
       LiteralExpr [STRING] [2012-10-21]
     ]
   ]
-LetVariable [ Name=itv3 ]
+Let Variable [ Name=$itv3 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.date@1[
@@ -30,31 +30,31 @@ LetVariable [ Name=itv3 ]
       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 @@ LetVariable [ Name=itv4 ]
       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 @@ LetVariable [ Name=itv5 ]
       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 @@ LetVariable [ Name=itv6 ]
       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 @@ LetVariable [ Name=itv7 ]
       LiteralExpr [STRING] [20:29:20]
     ]
   ]
-LetVariable [ Name=itv8 ]
+Let Variable [ Name=$itv8 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.time@1[
@@ -128,7 +128,7 @@ LetVariable [ Name=itv8 ]
       LiteralExpr [STRING] [22:19:49]
     ]
   ]
-LetVariable [ Name=itv9 ]
+Let Variable [ Name=$itv9 ]
   :=
   FunctionCall test.interval@2[
     FunctionCall test.time@1[
@@ -138,43 +138,43 @@ LetVariable [ Name=itv9 ]
       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 @@ LetVariable [ Name=itv10 ]
       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 @@ LetVariable [ Name=itv10 ]
       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 @@ LetVariable [ Name=itv11 ]
       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 @@ LetVariable [ Name=itv12 ]
       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 @@ LetVariable [ Name=itv11 ]
       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 @@ RecordConstructor [
   (
     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
+]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     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 @@ FROM [  (
       (
         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 @@ FROM [  (
         ]
       ]
       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
     ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     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 @@ RecordConstructor [
         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 @@ FROM [  (
         :
         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 @@ FROM [  (
         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 @@ FROM [  (
     ]
   ]
   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
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [timebin]
     :
-    Variable [ Name=bin ]
+    Variable [ Name=$bin ]
   )
   (
     LiteralExpr [STRING] [subgroups]
@@ -16,13 +16,24 @@ RecordConstructor [
         (
           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 @@ RecordConstructor [
           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 @@ FROM [  FunctionCall multitask.overlap-bins@3[
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             Field=time
           ]
           ]
@@ -86,7 +113,7 @@ FROM [  FunctionCall multitask.overlap-bins@3[
               LiteralExpr [STRING] [logs]
             ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -95,14 +122,14 @@ FROM [  FunctionCall multitask.overlap-bins@3[
           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 @@ FROM [  FunctionCall multitask.overlap-bins@3[
               LiteralExpr [STRING] [logs]
             ]
             AS
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
           ]
         )
       ]
@@ -128,11 +155,11 @@ FROM [  FunctionCall multitask.overlap-bins@3[
     ]
   ]
   AS
-  Variable [ Name=bin ]
+  Variable [ Name=$bin ]
 ]
 Orderby
   FunctionCall multitask.get-interval-start@1[
-    Variable [ Name=bin ]
+    Variable [ Name=$bin ]
   ]
   ASC
 

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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1329.24.ast
----------------------------------------------------------------------
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 @@ DataverseUse TinySocial
 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 @@ FROM [  FunctionCall Metadata.dataset@1[
     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 @@ Where
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=in-response-to
       ]
       <
@@ -66,18 +66,18 @@ Where
   ]
 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]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.ast
----------------------------------------------------------------------
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 @@ FunctionCall TinySocial.avg@1[
     SELECT ELEMENT [
     FunctionCall TinySocial.string-length@1[
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=message
       ]
     ]
@@ -15,13 +15,13 @@ FunctionCall TinySocial.avg@1[
         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 @@ FunctionCall TinySocial.avg@1[
         and
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=message ]
+            Variable [ Name=$message ]
             Field=in-response-to
           ]
           <

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.10.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=message-text
     ]
   )
@@ -20,7 +20,7 @@ RecordConstructor [
           LiteralExpr [STRING] [msgtxt]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
         )
@@ -30,17 +30,17 @@ RecordConstructor [
           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 @@ RecordConstructor [
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=message-text
         ]
         ASC
@@ -62,11 +62,11 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=message-text
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.11.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=id
     ]
   )
@@ -16,7 +16,7 @@ RecordConstructor [
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=name
     ]
   )
@@ -30,7 +30,7 @@ RecordConstructor [
           LiteralExpr [STRING] [twitter-screenname]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=screen-name
           ]
         )
@@ -38,7 +38,7 @@ RecordConstructor [
           LiteralExpr [STRING] [twitter-name]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=name
           ]
         )
@@ -48,23 +48,23 @@ RecordConstructor [
           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 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=fbu ]
+  Variable [ Name=$fbu ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.12.ast
----------------------------------------------------------------------
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 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.13.ast
----------------------------------------------------------------------
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 @@ Where
       FunctionCall TinySocial.not@1[
         FunctionCall TinySocial.is-null@1[
           FieldAccessor [
-            Variable [ Name=e ]
+            Variable [ Name=$e ]
             Field=end-date
           ]
         ]
@@ -31,7 +31,7 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.14.ast
----------------------------------------------------------------------
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 @@ SELECT ELEMENT [
 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 ]
     ]
   )
 ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     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 @@ FROM [  FunctionCall Metadata.dataset@1[
     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
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     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 @@ FROM [  FunctionCall Metadata.dataset@1[
     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
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=uid ]
+    Variable [ Name=$uid ]
   )
   (
     LiteralExpr [STRING] [count]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
 ]
 ]
@@ -18,30 +18,45 @@ FROM [  FunctionCall Metadata.dataset@1[
     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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.18.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [tweet]
     :
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
   )
   (
     LiteralExpr [STRING] [similar-tweets]
@@ -15,7 +15,7 @@ RecordConstructor [
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=referred-topics
       ]
       ]
@@ -23,37 +23,37 @@ RecordConstructor [
           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 @@ 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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.20.ast
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.22.ast
----------------------------------------------------------------------
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 @@ SELECT ELEMENT [
 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
         ]
         =

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.4.ast
----------------------------------------------------------------------
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
     ]
     =

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.5.ast
----------------------------------------------------------------------
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 @@ Where
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=id
       ]
       <=
@@ -31,7 +31,7 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.6.ast
----------------------------------------------------------------------
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 @@ Where
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=user ]
+        Variable [ Name=$user ]
         Field=user-since
       ]
       <=
@@ -35,7 +35,7 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.7.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@ RecordConstructor [
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
   )
@@ -24,34 +24,34 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=message ]
+  Variable [ Name=$message ]
 ]
 Where
   OperatorExpr [
     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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.8.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -14,7 +14,7 @@ RecordConstructor [
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=message ]
+      Variable [ Name=$message ]
       Field=message
     ]
   )
@@ -24,34 +24,34 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookMessages]
   ]
   AS
-  Variable [ Name=message ]
+  Variable [ Name=$message ]
 ]
 Where
   OperatorExpr [
     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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.9.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [uname]
     :
     FieldAccessor [
-      Variable [ Name=user ]
+      Variable [ Name=$user ]
       Field=name
     ]
   )
@@ -16,7 +16,7 @@ RecordConstructor [
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=message
       ]
       ]
@@ -24,23 +24,23 @@ RecordConstructor [
           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 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=user ]
+  Variable [ Name=$user ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=user ]
+    Variable [ Name=$user ]
     Field=name
   ]
   ASC

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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.10.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [message]
     :
     FieldAccessor [
-      Variable [ Name=t ]
+      Variable [ Name=$t ]
       Field=message-text
     ]
   )
@@ -20,7 +20,7 @@ RecordConstructor [
           LiteralExpr [STRING] [msgtxt]
           :
           FieldAccessor [
-            Variable [ Name=t2 ]
+            Variable [ Name=$t2 ]
             Field=message-text
           ]
         )
@@ -30,17 +30,17 @@ RecordConstructor [
           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 @@ RecordConstructor [
         ]
       Orderby
         FieldAccessor [
-          Variable [ Name=t2 ]
+          Variable [ Name=$t2 ]
           Field=message-text
         ]
         ASC
@@ -62,11 +62,11 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [TweetMessages]
   ]
   AS
-  Variable [ Name=t ]
+  Variable [ Name=$t ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
     Field=message-text
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.11.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
     LiteralExpr [STRING] [id]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=id
     ]
   )
@@ -16,7 +16,7 @@ RecordConstructor [
     LiteralExpr [STRING] [name]
     :
     FieldAccessor [
-      Variable [ Name=fbu ]
+      Variable [ Name=$fbu ]
       Field=name
     ]
   )
@@ -30,7 +30,7 @@ RecordConstructor [
           LiteralExpr [STRING] [twitter-screenname]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=screen-name
           ]
         )
@@ -38,7 +38,7 @@ RecordConstructor [
           LiteralExpr [STRING] [twitter-name]
           :
           FieldAccessor [
-            Variable [ Name=tu ]
+            Variable [ Name=$tu ]
             Field=name
           ]
         )
@@ -48,23 +48,23 @@ RecordConstructor [
           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 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [FacebookUsers]
   ]
   AS
-  Variable [ Name=fbu ]
+  Variable [ Name=$fbu ]
 ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.12.ast
----------------------------------------------------------------------
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 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.13.ast
----------------------------------------------------------------------
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 @@ Where
       FunctionCall TinySocial.not@1[
         FunctionCall TinySocial.is-null@1[
           FieldAccessor [
-            Variable [ Name=e ]
+            Variable [ Name=$e ]
             Field=end-date
           ]
         ]
@@ -31,7 +31,7 @@ Where
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=fbu ]
+    Variable [ Name=$fbu ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.14.ast
----------------------------------------------------------------------
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 @@ SELECT ELEMENT [
 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 ]
     ]
   )
 ]

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

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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [user]
     :
-    Variable [ Name=uid ]
+    Variable [ Name=$uid ]
   )
   (
     LiteralExpr [STRING] [count]
     :
-    Variable [ Name=c ]
+    Variable [ Name=$c ]
   )
 ]
 ]
@@ -18,30 +18,45 @@ FROM [  FunctionCall Metadata.dataset@1[
     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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.18.ast
----------------------------------------------------------------------
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 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [tweet]
     :
-    Variable [ Name=t ]
+    Variable [ Name=$t ]
   )
   (
     LiteralExpr [STRING] [similar-tweets]
@@ -15,7 +15,7 @@ RecordConstructor [
     (
       SELECT ELEMENT [
       FieldAccessor [
-        Variable [ Name=t2 ]
+        Variable [ Name=$t2 ]
         Field=referred-topics
       ]
       ]
@@ -23,37 +23,37 @@ RecordConstructor [
           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 @@ 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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.20.ast
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.22.ast
----------------------------------------------------------------------
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 @@ SELECT ELEMENT [
 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
         ]
         =

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.24.ast
----------------------------------------------------------------------
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 @@ DataverseUse TinySocial
 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 @@ FROM [  FunctionCall Metadata.dataset@1[
     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 @@ Where
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=message ]
+        Variable [ Name=$message ]
         Field=in-response-to
       ]
       <
@@ -66,18 +66,18 @@ Where
   ]
 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]



Mime
View raw message