asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [3/7] asterixdb git commit: [ASTERIXDB-1753][SQL] Disable auto-plural for group-by.
Date Fri, 30 Jun 2017 23:44:11 GMT
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_03/hdfs_03.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_03/hdfs_03.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_03/hdfs_03.3.ast
index f1ac649..ba6fb25 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_03/hdfs_03.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_03/hdfs_03.3.ast
@@ -11,7 +11,18 @@ RecordConstructor [
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=$token ]
+      (
+        SELECT ELEMENT [
+        FunctionCall Metadata.resolve@-1[
+          LiteralExpr [STRING] [token]
+          Variable [ Name=$g ]
+          Variable [ Name=$tok ]
+        ]
+        ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=$g ]
+        ]
+      )
     ]
   )
 ]
@@ -33,7 +44,7 @@ Groupby
   Variable [ Name=$tok ]
   :=
   Variable [ Name=$token ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     line:=Variable [ Name=$line ]
     token:=Variable [ Name=$token ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.ast
index f1ac649..ba6fb25 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.ast
@@ -11,7 +11,18 @@ RecordConstructor [
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=$token ]
+      (
+        SELECT ELEMENT [
+        FunctionCall Metadata.resolve@-1[
+          LiteralExpr [STRING] [token]
+          Variable [ Name=$g ]
+          Variable [ Name=$tok ]
+        ]
+        ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=$g ]
+        ]
+      )
     ]
   )
 ]
@@ -33,7 +44,7 @@ Groupby
   Variable [ Name=$tok ]
   :=
   Variable [ Name=$token ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     line:=Variable [ Name=$line ]
     token:=Variable [ Name=$token ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.ast
index f1ac649..ba6fb25 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.ast
@@ -11,7 +11,18 @@ RecordConstructor [
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=$token ]
+      (
+        SELECT ELEMENT [
+        FunctionCall Metadata.resolve@-1[
+          LiteralExpr [STRING] [token]
+          Variable [ Name=$g ]
+          Variable [ Name=$tok ]
+        ]
+        ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=$g ]
+        ]
+      )
     ]
   )
 ]
@@ -33,7 +44,7 @@ Groupby
   Variable [ Name=$tok ]
   :=
   Variable [ Name=$token ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     line:=Variable [ Name=$line ]
     token:=Variable [ Name=$token ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.ast
index 259f96d..03f3620 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.ast
@@ -11,7 +11,18 @@ RecordConstructor [
     LiteralExpr [STRING] [count]
     :
     FunctionCall twitter.count@1[
-      Variable [ Name=$token ]
+      (
+        SELECT ELEMENT [
+        FunctionCall Metadata.resolve@-1[
+          LiteralExpr [STRING] [token]
+          Variable [ Name=$g ]
+          Variable [ Name=$tok ]
+        ]
+        ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=$g ]
+        ]
+      )
     ]
   )
 ]
@@ -33,7 +44,7 @@ Groupby
   Variable [ Name=$tok ]
   :=
   Variable [ Name=$token ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     t:=Variable [ Name=$t ]
     token:=Variable [ Name=$token ]
@@ -41,7 +52,18 @@ Groupby
 
 Orderby
   FunctionCall twitter.count@1[
-    Variable [ Name=$token ]
+    (
+      SELECT ELEMENT [
+      FunctionCall Metadata.resolve@-1[
+        LiteralExpr [STRING] [token]
+        Variable [ Name=$g ]
+        Variable [ Name=$tok ]
+      ]
+      ]
+      FROM [        Variable [ Name=$g ]
+        AS Variable [ Name=$g ]
+      ]
+    )
   ]
   DESC
   Variable [ Name=$tok ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
index 035e97e..25b5f82 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
@@ -6,19 +6,13 @@ OrderedListConstructor [
     Variable [ Name=$x ]
     Field=int_m
   ]
-  FunctionCall test.sql-count@1[
+  FunctionCall test.count@1[
     (
       SELECT ELEMENT [
-      FunctionCall Metadata.resolve@-1[
-        LiteralExpr [STRING] [id]
-        Variable [ Name=$int_m ]
-        Variable [ Name=$x ]
-        Variable [ Name=#1 ]
-        Variable [ Name=#2 ]
+      Variable [ Name=$x ]
       ]
-      ]
-      FROM [        Variable [ Name=#1 ]
-        AS Variable [ Name=#2 ]
+      FROM [        Variable [ Name=$g ]
+        AS Variable [ Name=$g ]
       ]
     )
   ]
@@ -42,7 +36,7 @@ Groupby
     Variable [ Name=$x ]
     Field=int_m
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     x:=Variable [ Name=$x ]
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/count-nullable/count-nullable.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/count-nullable/count-nullable.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/count-nullable/count-nullable.3.ast
index 5d1a417..d2e89aa 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/count-nullable/count-nullable.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/semistructured/count-nullable/count-nullable.3.ast
@@ -11,7 +11,18 @@ RecordConstructor [
     LiteralExpr [STRING] [count]
     :
     FunctionCall test.count@1[
-      Variable [ Name=$c ]
+      (
+        SELECT ELEMENT [
+        FunctionCall Metadata.resolve@-1[
+          LiteralExpr [STRING] [c]
+          Variable [ Name=$g ]
+          Variable [ Name=$age ]
+        ]
+        ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=$g ]
+        ]
+      )
     ]
   )
 ]
@@ -28,7 +39,7 @@ Groupby
     Variable [ Name=$c ]
     Field=age
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     c:=Variable [ Name=$c ]
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.ast
index 91e9410..6cdd575 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.ast
@@ -86,7 +86,7 @@ Groupby
     LiteralExpr [DOUBLE] [3.0]
     LiteralExpr [DOUBLE] [3.0]
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     t:=Variable [ Name=$t ]
   )
@@ -94,7 +94,14 @@ Groupby
 Let Variable [ Name=$num ]
   :=
   FunctionCall test.count@1[
-    Variable [ Name=$t ]
+    (
+      SELECT ELEMENT [
+      Variable [ Name=$t ]
+      ]
+      FROM [        Variable [ Name=$g ]
+        AS Variable [ Name=$g ]
+      ]
+    )
   ]
 Orderby
   Variable [ Name=$num ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation/cell-aggregation.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation/cell-aggregation.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation/cell-aggregation.3.ast
index 6f827cf..08850a7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation/cell-aggregation.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/spatial/cell-aggregation/cell-aggregation.3.ast
@@ -37,7 +37,7 @@ Let Variable [ Name=$grid ]
         LiteralExpr [DOUBLE] [5.0]
         LiteralExpr [DOUBLE] [5.0]
       ]
-      GROUP AS Variable [ Name=#1 ]
+      GROUP AS Variable [ Name=$g ]
       (
         o:=Variable [ Name=$o ]
       )
@@ -45,7 +45,18 @@ Let Variable [ Name=$grid ]
     Let Variable [ Name=$num ]
       :=
       FunctionCall test.count@1[
-        Variable [ Name=$o ]
+        (
+          SELECT ELEMENT [
+          FunctionCall Metadata.resolve@-1[
+            LiteralExpr [STRING] [o]
+            Variable [ Name=$g ]
+            Variable [ Name=$c ]
+          ]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
       ]
     Orderby
       Variable [ Name=$num ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
index 815615d..39fb48b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
@@ -16,16 +16,19 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [sum_qty]
     :
-    FunctionCall tpch.sum@1[
+    FunctionCall tpch.sql-sum@1[
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=#2 ]
+            Field=l
+          ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=$l ]
-          AS Variable [ Name=$i ]
+        FROM [          Variable [ Name=#1 ]
+          AS Variable [ Name=#2 ]
         ]
       )
     ]
@@ -33,16 +36,19 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [sum_base_price]
     :
-    FunctionCall tpch.sum@1[
+    FunctionCall tpch.sql-sum@1[
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=#3 ]
+            Field=l
+          ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=$l ]
-          AS Variable [ Name=$i ]
+        FROM [          Variable [ Name=#1 ]
+          AS Variable [ Name=#3 ]
         ]
       )
     ]
@@ -50,12 +56,15 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [sum_disc_price]
     :
-    FunctionCall tpch.sum@1[
+    FunctionCall tpch.sql-sum@1[
       (
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=$i ]
+            FieldAccessor [
+              Variable [ Name=#4 ]
+              Field=l
+            ]
             Field=l_extendedprice
           ]
           *
@@ -63,14 +72,17 @@ RecordConstructor [
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=$i ]
+              FieldAccessor [
+                Variable [ Name=#4 ]
+                Field=l
+              ]
               Field=l_discount
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=$l ]
-          AS Variable [ Name=$i ]
+        FROM [          Variable [ Name=#1 ]
+          AS Variable [ Name=#4 ]
         ]
       )
     ]
@@ -78,12 +90,15 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [sum_charge]
     :
-    FunctionCall tpch.sum@1[
+    FunctionCall tpch.sql-sum@1[
       (
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=$i ]
+            FieldAccessor [
+              Variable [ Name=#5 ]
+              Field=l
+            ]
             Field=l_extendedprice
           ]
           *
@@ -91,7 +106,10 @@ RecordConstructor [
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=$i ]
+              FieldAccessor [
+                Variable [ Name=#5 ]
+                Field=l
+              ]
               Field=l_discount
             ]
           ]
@@ -100,14 +118,17 @@ RecordConstructor [
             LiteralExpr [LONG] [1]
             +
             FieldAccessor [
-              Variable [ Name=$i ]
+              FieldAccessor [
+                Variable [ Name=#5 ]
+                Field=l
+              ]
               Field=l_tax
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=$l ]
-          AS Variable [ Name=$i ]
+        FROM [          Variable [ Name=#1 ]
+          AS Variable [ Name=#5 ]
         ]
       )
     ]
@@ -115,16 +136,19 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [ave_qty]
     :
-    FunctionCall tpch.avg@1[
+    FunctionCall tpch.sql-avg@1[
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=#6 ]
+            Field=l
+          ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=$l ]
-          AS Variable [ Name=$i ]
+        FROM [          Variable [ Name=#1 ]
+          AS Variable [ Name=#6 ]
         ]
       )
     ]
@@ -132,16 +156,19 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [ave_price]
     :
-    FunctionCall tpch.avg@1[
+    FunctionCall tpch.sql-avg@1[
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=#7 ]
+            Field=l
+          ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=$l ]
-          AS Variable [ Name=$i ]
+        FROM [          Variable [ Name=#1 ]
+          AS Variable [ Name=#7 ]
         ]
       )
     ]
@@ -149,16 +176,19 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [ave_disc]
     :
-    FunctionCall tpch.avg@1[
+    FunctionCall tpch.sql-avg@1[
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=#8 ]
+            Field=l
+          ]
           Field=l_discount
         ]
         ]
-        FROM [          Variable [ Name=$l ]
-          AS Variable [ Name=$i ]
+        FROM [          Variable [ Name=#1 ]
+          AS Variable [ Name=#8 ]
         ]
       )
     ]
@@ -166,8 +196,15 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [count_order]
     :
-    FunctionCall tpch.count@1[
-      Variable [ Name=$l ]
+    FunctionCall tpch.sql-count@1[
+      (
+        SELECT ELEMENT [
+        LiteralExpr [LONG] [1]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS Variable [ Name=#9 ]
+        ]
+      )
     ]
   )
 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast
index cf3af4c..155bef0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.ast
@@ -39,7 +39,18 @@ FROM [  (
       (
         LiteralExpr [STRING] [i]
         :
-        Variable [ Name=$i ]
+        (
+          SELECT ELEMENT [
+          FunctionCall Metadata.resolve@-1[
+            LiteralExpr [STRING] [i]
+            Variable [ Name=$g ]
+            Variable [ Name=$bin ]
+          ]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
       )
     ]
     ]
@@ -86,7 +97,7 @@ FROM [  (
       Variable [ Name=$bin ]
       :=
       Variable [ Name=$j ]
-      GROUP AS Variable [ Name=#1 ]
+      GROUP AS Variable [ Name=$g ]
       (
         i:=Variable [ Name=$i ]
         j:=Variable [ Name=$j ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast
index 7d10b8d..bebf050 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.ast
@@ -13,13 +13,17 @@ RecordConstructor [
     FunctionCall test.sql-count@1[
       (
         SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=i2
-        ]
+        (
+          SELECT ELEMENT [
+          LiteralExpr [LONG] [1]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
         ]
-        FROM [          Variable [ Name=#1 ]
-          AS Variable [ Name=#2 ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=#1 ]
         ]
       )
     ]
@@ -35,15 +39,18 @@ RecordConstructor [
             FunctionCall test.get-overlapping-interval@2[
               Variable [ Name=$bin ]
               FieldAccessor [
-                Variable [ Name=$i3 ]
+                FieldAccessor [
+                  Variable [ Name=$g ]
+                  Field=i2
+                ]
                 Field=interval
               ]
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=$i2 ]
-          AS Variable [ Name=$i3 ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=$g ]
         ]
       )
     ]
@@ -102,7 +109,7 @@ Groupby
   Variable [ Name=$bin ]
   :=
   Variable [ Name=$j ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     i2:=Variable [ Name=$i2 ]
     j:=Variable [ Name=$j ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast
index c65459c..a21a8c7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.15.ast
@@ -13,10 +13,7 @@ RecordConstructor [
     FunctionCall TinySocial.sql-count@1[
       (
         SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=t
-        ]
+        LiteralExpr [LONG] [1]
         ]
         FROM [          Variable [ Name=#1 ]
           AS Variable [ Name=#2 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast
index c65459c..a21a8c7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.16.ast
@@ -13,10 +13,7 @@ RecordConstructor [
     FunctionCall TinySocial.sql-count@1[
       (
         SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=t
-        ]
+        LiteralExpr [LONG] [1]
         ]
         FROM [          Variable [ Name=#1 ]
           AS Variable [ Name=#2 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast
index 31e278b..c5a07ba 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.17.ast
@@ -39,10 +39,7 @@ Let Variable [ Name=$c ]
   FunctionCall TinySocial.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#2 ]
-        Field=t
-      ]
+      LiteralExpr [LONG] [1]
       ]
       FROM [        Variable [ Name=#1 ]
         AS Variable [ Name=#2 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.23.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.23.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.23.ast
index 73652a0..1c36b20 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.23.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.23.ast
@@ -6,13 +6,10 @@ hour
 FunctionCall TinySocial.sql-count@1[
   (
     SELECT ELEMENT [
-    FieldAccessor [
-      Variable [ Name=#4 ]
-      Field=t
-    ]
+    LiteralExpr [LONG] [1]
     ]
-    FROM [      Variable [ Name=#1 ]
-      AS Variable [ Name=#4 ]
+    FROM [      Variable [ Name=$g ]
+      AS Variable [ Name=#3 ]
     ]
   )
 ]
@@ -24,19 +21,16 @@ count
   FunctionCall TinySocial.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#3 ]
-        Field=k
-      ]
+      LiteralExpr [LONG] [1]
       ]
-      FROM [        Variable [ Name=#2 ]
-        AS Variable [ Name=#3 ]
+      FROM [        Variable [ Name=#1 ]
+        AS Variable [ Name=#2 ]
       ]
     )
   ]
   sum
   ]
-  FROM [    Variable [ Name=$t ]
+  FROM [    Variable [ Name=$g ]
     AS Variable [ Name=$k ]
   ]
   Groupby
@@ -44,11 +38,14 @@ count
     :=
     FunctionCall TinySocial.get-minute@1[
       FieldAccessor [
-        Variable [ Name=$k ]
+        FieldAccessor [
+          Variable [ Name=$k ]
+          Field=t
+        ]
         Field=send-time
       ]
     ]
-    GROUP AS Variable [ Name=#2 ]
+    GROUP AS Variable [ Name=#1 ]
     (
       k:=Variable [ Name=$k ]
     )
@@ -74,7 +71,7 @@ Groupby
       Field=send-time
     ]
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     t:=Variable [ Name=$t ]
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.26.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.26.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.26.ast
index f94d3dc..0027ad97 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.26.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.26.ast
@@ -2,7 +2,11 @@ DataverseUse TinySocial
 Query:
 SELECT [
 FieldAccessor [
-  Variable [ Name=$employment ]
+  FunctionCall Metadata.resolve@-1[
+    LiteralExpr [STRING] [employment]
+    Variable [ Name=#1 ]
+    Variable [ Name=$organization-name ]
+  ]
   Field=organization-name
 ]
 organization
@@ -122,7 +126,11 @@ Groupby
 
 Orderby
   FieldAccessor [
-    Variable [ Name=$employment ]
+    FunctionCall Metadata.resolve@-1[
+      LiteralExpr [STRING] [employment]
+      Variable [ Name=#1 ]
+      Variable [ Name=$organization-name ]
+    ]
     Field=organization-name
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.15.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.15.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.15.ast
index c65459c..a21a8c7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.15.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.15.ast
@@ -13,10 +13,7 @@ RecordConstructor [
     FunctionCall TinySocial.sql-count@1[
       (
         SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=t
-        ]
+        LiteralExpr [LONG] [1]
         ]
         FROM [          Variable [ Name=#1 ]
           AS Variable [ Name=#2 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.16.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.16.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.16.ast
index c65459c..a21a8c7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.16.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.16.ast
@@ -13,10 +13,7 @@ RecordConstructor [
     FunctionCall TinySocial.sql-count@1[
       (
         SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=t
-        ]
+        LiteralExpr [LONG] [1]
         ]
         FROM [          Variable [ Name=#1 ]
           AS Variable [ Name=#2 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast
index 31e278b..c5a07ba 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.17.ast
@@ -39,10 +39,7 @@ Let Variable [ Name=$c ]
   FunctionCall TinySocial.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#2 ]
-        Field=t
-      ]
+      LiteralExpr [LONG] [1]
       ]
       FROM [        Variable [ Name=#1 ]
         AS Variable [ Name=#2 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.23.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.23.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.23.ast
index 73652a0..1c36b20 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.23.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.23.ast
@@ -6,13 +6,10 @@ hour
 FunctionCall TinySocial.sql-count@1[
   (
     SELECT ELEMENT [
-    FieldAccessor [
-      Variable [ Name=#4 ]
-      Field=t
-    ]
+    LiteralExpr [LONG] [1]
     ]
-    FROM [      Variable [ Name=#1 ]
-      AS Variable [ Name=#4 ]
+    FROM [      Variable [ Name=$g ]
+      AS Variable [ Name=#3 ]
     ]
   )
 ]
@@ -24,19 +21,16 @@ count
   FunctionCall TinySocial.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#3 ]
-        Field=k
-      ]
+      LiteralExpr [LONG] [1]
       ]
-      FROM [        Variable [ Name=#2 ]
-        AS Variable [ Name=#3 ]
+      FROM [        Variable [ Name=#1 ]
+        AS Variable [ Name=#2 ]
       ]
     )
   ]
   sum
   ]
-  FROM [    Variable [ Name=$t ]
+  FROM [    Variable [ Name=$g ]
     AS Variable [ Name=$k ]
   ]
   Groupby
@@ -44,11 +38,14 @@ count
     :=
     FunctionCall TinySocial.get-minute@1[
       FieldAccessor [
-        Variable [ Name=$k ]
+        FieldAccessor [
+          Variable [ Name=$k ]
+          Field=t
+        ]
         Field=send-time
       ]
     ]
-    GROUP AS Variable [ Name=#2 ]
+    GROUP AS Variable [ Name=#1 ]
     (
       k:=Variable [ Name=$k ]
     )
@@ -74,7 +71,7 @@ Groupby
       Field=send-time
     ]
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     t:=Variable [ Name=$t ]
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
index 64187f1..a665305 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.ast
@@ -1,5 +1,5 @@
 DataverseUse tpch
-Set import-private-functions=true
+Set hash_merge=true
 Query:
 SELECT ELEMENT [
 RecordConstructor [
@@ -20,11 +20,14 @@ RecordConstructor [
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=$i ]
+            Field=l
+          ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$i ]
         ]
       )
@@ -37,11 +40,14 @@ RecordConstructor [
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=$i ]
+            Field=l
+          ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$i ]
         ]
       )
@@ -55,7 +61,10 @@ RecordConstructor [
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=$i ]
+            FieldAccessor [
+              Variable [ Name=$i ]
+              Field=l
+            ]
             Field=l_extendedprice
           ]
           *
@@ -63,13 +72,16 @@ RecordConstructor [
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=$i ]
+              FieldAccessor [
+                Variable [ Name=$i ]
+                Field=l
+              ]
               Field=l_discount
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$i ]
         ]
       )
@@ -83,7 +95,10 @@ RecordConstructor [
         SELECT ELEMENT [
         OperatorExpr [
           FieldAccessor [
-            Variable [ Name=$i ]
+            FieldAccessor [
+              Variable [ Name=$i ]
+              Field=l
+            ]
             Field=l_extendedprice
           ]
           *
@@ -91,7 +106,10 @@ RecordConstructor [
             LiteralExpr [LONG] [1]
             -
             FieldAccessor [
-              Variable [ Name=$i ]
+              FieldAccessor [
+                Variable [ Name=$i ]
+                Field=l
+              ]
               Field=l_discount
             ]
           ]
@@ -100,13 +118,16 @@ RecordConstructor [
             LiteralExpr [LONG] [1]
             +
             FieldAccessor [
-              Variable [ Name=$i ]
+              FieldAccessor [
+                Variable [ Name=$i ]
+                Field=l
+              ]
               Field=l_tax
             ]
           ]
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$i ]
         ]
       )
@@ -119,11 +140,14 @@ RecordConstructor [
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=$i ]
+            Field=l
+          ]
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$i ]
         ]
       )
@@ -136,11 +160,14 @@ RecordConstructor [
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=$i ]
+            Field=l
+          ]
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$i ]
         ]
       )
@@ -153,11 +180,14 @@ RecordConstructor [
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=$i ]
+            Field=l
+          ]
           Field=l_discount
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$i ]
         ]
       )
@@ -166,16 +196,18 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [count_order]
     :
-    FunctionCall tpch.sql-count@1[
+    FunctionCall tpch.count@1[
       (
         SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=l
+        FunctionCall Metadata.resolve@-1[
+          LiteralExpr [STRING] [l]
+          Variable [ Name=$g ]
+          Variable [ Name=$l_linestatus ]
+          Variable [ Name=$l_returnflag ]
         ]
         ]
-        FROM [          Variable [ Name=#1 ]
-          AS Variable [ Name=#2 ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=$g ]
         ]
       )
     ]
@@ -209,7 +241,7 @@ Groupby
     Variable [ Name=$l ]
     Field=l_linestatus
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     l:=Variable [ Name=$l ]
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
index 72ac671..63795d3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
@@ -341,11 +341,14 @@ FunctionDecl tmp2([]) {
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=$i ]
+              FieldAccessor [
+                Variable [ Name=$i ]
+                Field=pssrn
+              ]
               Field=ps_supplycost
             ]
             ]
-            FROM [              Variable [ Name=$pssrn ]
+            FROM [              Variable [ Name=$g ]
               AS Variable [ Name=$i ]
             ]
           )
@@ -605,6 +608,7 @@ FunctionDecl tmp2([]) {
         Variable [ Name=$pssrn ]
         Field=p_partkey
       ]
+      GROUP AS Variable [ Name=$g ]
 
   )
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
index 47d5a97..b99d828 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.ast
@@ -115,7 +115,7 @@ Groupby
     Variable [ Name=$o ]
     Field=o_shippriority
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     c:=Variable [ Name=$c ]
     o:=Variable [ Name=$o ]
@@ -143,7 +143,20 @@ Let Variable [ Name=$revenue ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=$l ]
+      FROM [        (
+          SELECT ELEMENT [
+          FunctionCall Metadata.resolve@-1[
+            LiteralExpr [STRING] [l]
+            Variable [ Name=$o_shippriority ]
+            Variable [ Name=$g ]
+            Variable [ Name=$o_orderdate ]
+            Variable [ Name=$l_orderkey ]
+          ]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
         AS Variable [ Name=$i ]
       ]
     )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.ast
index 6d2ab55..e9a9ccf 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.ast
@@ -42,8 +42,15 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [count]
     :
-    FunctionCall tpch.count@1[
-      Variable [ Name=$o ]
+    FunctionCall tpch.sql-count@1[
+      (
+        SELECT ELEMENT [
+        LiteralExpr [LONG] [1]
+        ]
+        FROM [          Variable [ Name=#1 ]
+          AS Variable [ Name=#2 ]
+        ]
+      )
     ]
   )
 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
index 5ee4bfe..61eb892 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.ast
@@ -297,7 +297,7 @@ Groupby
     Variable [ Name=$o1 ]
     Field=n_name
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     c:=Variable [ Name=$c ]
     o1:=Variable [ Name=$o1 ]
@@ -324,7 +324,18 @@ Let Variable [ Name=$revenue ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=$o1 ]
+      FROM [        (
+          SELECT ELEMENT [
+          FunctionCall Metadata.resolve@-1[
+            LiteralExpr [STRING] [o1]
+            Variable [ Name=$g ]
+            Variable [ Name=$n_name ]
+          ]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
         AS Variable [ Name=$i ]
       ]
     )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.ast
index cc99aab..27f24e5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.ast
@@ -365,7 +365,7 @@ Groupby
   Variable [ Name=$l_year ]
   :=
   Variable [ Name=$l_year0 ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     locs:=Variable [ Name=$locs ]
     t:=Variable [ Name=$t ]
@@ -378,7 +378,10 @@ Let Variable [ Name=$revenue ]
       SELECT ELEMENT [
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=$i ]
+          FieldAccessor [
+            Variable [ Name=$i ]
+            Field=locs
+          ]
           Field=l_extendedprice
         ]
         *
@@ -386,13 +389,16 @@ Let Variable [ Name=$revenue ]
           LiteralExpr [LONG] [1]
           -
           FieldAccessor [
-            Variable [ Name=$i ]
+            FieldAccessor [
+              Variable [ Name=$i ]
+              Field=locs
+            ]
             Field=l_discount
           ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=$locs ]
+      FROM [        Variable [ Name=$g ]
         AS Variable [ Name=$i ]
       ]
     )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.ast
index 1292f1a..e34438b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.ast
@@ -18,14 +18,20 @@ RecordConstructor [
 
           WHEN               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=$i ]
+                  FieldAccessor [
+                    Variable [ Name=$i ]
+                    Field=t
+                  ]
                   Field=s_name
                 ]
                 =
                 LiteralExpr [STRING] [BRAZIL]
               ]
           THEN               FieldAccessor [
-                Variable [ Name=$i ]
+                FieldAccessor [
+                  Variable [ Name=$i ]
+                  Field=t
+                ]
                 Field=revenue
               ]
 
@@ -33,7 +39,7 @@ RecordConstructor [
 
           END
           ]
-          FROM [            Variable [ Name=$t ]
+          FROM [            Variable [ Name=$g ]
             AS Variable [ Name=$i ]
           ]
         )
@@ -43,11 +49,14 @@ RecordConstructor [
         (
           SELECT ELEMENT [
           FieldAccessor [
-            Variable [ Name=$i ]
+            FieldAccessor [
+              Variable [ Name=$i ]
+              Field=t
+            ]
             Field=revenue
           ]
           ]
-          FROM [            Variable [ Name=$t ]
+          FROM [            Variable [ Name=$g ]
             AS Variable [ Name=$i ]
           ]
         )
@@ -469,7 +478,7 @@ Groupby
     Variable [ Name=$t ]
     Field=year
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     t:=Variable [ Name=$t ]
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
index bce73f5..e95c448 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.ast
@@ -19,11 +19,14 @@ RecordConstructor [
       (
         SELECT ELEMENT [
         FieldAccessor [
-          Variable [ Name=$pr ]
+          FieldAccessor [
+            Variable [ Name=$pr ]
+            Field=profit
+          ]
           Field=amount
         ]
         ]
-        FROM [          Variable [ Name=$profit ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$pr ]
         ]
       )
@@ -431,7 +434,7 @@ Groupby
     Variable [ Name=$profit ]
     Field=o_year
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     profit:=Variable [ Name=$profit ]
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.ast
index da3761f..6835f7c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.ast
@@ -328,7 +328,7 @@ Groupby
     Variable [ Name=$locn ]
     Field=c_comment
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     locn:=Variable [ Name=$locn ]
   )
@@ -354,7 +354,24 @@ Let Variable [ Name=$revenue ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=$locn ]
+      FROM [        (
+          SELECT ELEMENT [
+          FunctionCall Metadata.resolve@-1[
+            LiteralExpr [STRING] [locn]
+            Variable [ Name=$c_address ]
+            Variable [ Name=$g ]
+            Variable [ Name=$c_name ]
+            Variable [ Name=$c_phone ]
+            Variable [ Name=$c_acctbal ]
+            Variable [ Name=$n_name ]
+            Variable [ Name=$c_custkey ]
+            Variable [ Name=$c_comment ]
+          ]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
         AS Variable [ Name=$i ]
       ]
     )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.ast
index da3761f..6835f7c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.ast
@@ -328,7 +328,7 @@ Groupby
     Variable [ Name=$locn ]
     Field=c_comment
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     locn:=Variable [ Name=$locn ]
   )
@@ -354,7 +354,24 @@ Let Variable [ Name=$revenue ]
         ]
       ]
       ]
-      FROM [        Variable [ Name=$locn ]
+      FROM [        (
+          SELECT ELEMENT [
+          FunctionCall Metadata.resolve@-1[
+            LiteralExpr [STRING] [locn]
+            Variable [ Name=$c_address ]
+            Variable [ Name=$g ]
+            Variable [ Name=$c_name ]
+            Variable [ Name=$c_phone ]
+            Variable [ Name=$c_acctbal ]
+            Variable [ Name=$n_name ]
+            Variable [ Name=$c_custkey ]
+            Variable [ Name=$c_comment ]
+          ]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
         AS Variable [ Name=$i ]
       ]
     )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.ast
index 8de0c01..a42b74b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.ast
@@ -110,17 +110,23 @@ FROM [  (
             SELECT ELEMENT [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=$i ]
+                FieldAccessor [
+                  Variable [ Name=$i ]
+                  Field=ps
+                ]
                 Field=ps_supplycost
               ]
               *
               FieldAccessor [
-                Variable [ Name=$i ]
+                FieldAccessor [
+                  Variable [ Name=$i ]
+                  Field=ps
+                ]
                 Field=ps_availqty
               ]
             ]
             ]
-            FROM [              Variable [ Name=$ps ]
+            FROM [              Variable [ Name=$g ]
               AS Variable [ Name=$i ]
             ]
           )
@@ -190,7 +196,7 @@ FROM [  (
         Variable [ Name=$ps ]
         Field=ps_partkey
       ]
-      GROUP AS Variable [ Name=#1 ]
+      GROUP AS Variable [ Name=$g ]
       (
         ps:=Variable [ Name=$ps ]
         sn:=Variable [ Name=$sn ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.ast
index edd1cd8..087019a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.ast
@@ -16,7 +16,10 @@ RecordConstructor [
         CASE            OperatorExpr [
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=$i ]
+                  FieldAccessor [
+                    Variable [ Name=$i ]
+                    Field=o
+                  ]
                   Field=o_orderpriority
                 ]
                 =
@@ -25,7 +28,10 @@ RecordConstructor [
               or
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=$i ]
+                  FieldAccessor [
+                    Variable [ Name=$i ]
+                    Field=o
+                  ]
                   Field=o_orderpriority
                 ]
                 =
@@ -43,7 +49,7 @@ RecordConstructor [
 
         END
         ]
-        FROM [          Variable [ Name=$o ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$i ]
         ]
       )
@@ -58,7 +64,10 @@ RecordConstructor [
         CASE            OperatorExpr [
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=$i ]
+                  FieldAccessor [
+                    Variable [ Name=$i ]
+                    Field=o
+                  ]
                   Field=o_orderpriority
                 ]
                 =
@@ -67,7 +76,10 @@ RecordConstructor [
               or
               OperatorExpr [
                 FieldAccessor [
-                  Variable [ Name=$i ]
+                  FieldAccessor [
+                    Variable [ Name=$i ]
+                    Field=o
+                  ]
                   Field=o_orderpriority
                 ]
                 =
@@ -85,7 +97,7 @@ RecordConstructor [
 
         END
         ]
-        FROM [          Variable [ Name=$o ]
+        FROM [          Variable [ Name=$g ]
           AS Variable [ Name=$i ]
         ]
       )
@@ -186,7 +198,7 @@ Groupby
     Variable [ Name=$l ]
     Field=l_shipmode
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     l:=Variable [ Name=$l ]
     o:=Variable [ Name=$o ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
index 4ab59b1..98f7a37 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
@@ -34,7 +34,18 @@ FROM [  (
               Field=o_orderkey_count
             ]
             ]
-            FROM [              Variable [ Name=$co ]
+            FROM [              (
+                SELECT ELEMENT [
+                FunctionCall Metadata.resolve@-1[
+                  LiteralExpr [STRING] [co]
+                  Variable [ Name=$g2 ]
+                  Variable [ Name=$c_custkey ]
+                ]
+                ]
+                FROM [                  Variable [ Name=$g2 ]
+                  AS Variable [ Name=$g2 ]
+                ]
+              )
               AS Variable [ Name=$i ]
             ]
           )
@@ -112,7 +123,7 @@ FROM [  (
         Variable [ Name=$co ]
         Field=c_custkey
       ]
-      GROUP AS Variable [ Name=#1 ]
+      GROUP AS Variable [ Name=$g2 ]
       (
         co:=Variable [ Name=$co ]
       )
@@ -127,7 +138,7 @@ Groupby
     Variable [ Name=$gco ]
     Field=c_count
   ]
-  GROUP AS Variable [ Name=#2 ]
+  GROUP AS Variable [ Name=$g ]
   (
     gco:=Variable [ Name=$gco ]
   )
@@ -137,13 +148,20 @@ Let Variable [ Name=$custdist ]
   FunctionCall tpch.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#3 ]
-        Field=gco
-      ]
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=#1 ]
+          Field=gco
+        ]
+        ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=$g ]
+        ]
+      )
       ]
-      FROM [        Variable [ Name=#2 ]
-        AS Variable [ Name=#3 ]
+      FROM [        Variable [ Name=$g ]
+        AS Variable [ Name=#1 ]
       ]
     )
   ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
index ed68ae8..d108e83 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
@@ -33,14 +33,24 @@ OperatorExpr [
             ]
           ]
 
-      WHEN           LiteralExpr [FALSE]
-      THEN           LiteralExpr [DOUBLE] [0.0]
-
-      ELSE           LiteralExpr [NULL]
+      ELSE           LiteralExpr [DOUBLE] [0.0]
 
       END
       ]
-      FROM [        Variable [ Name=$lp ]
+      FROM [        (
+          SELECT ELEMENT [
+          FunctionCall Metadata.resolve@-1[
+            LiteralExpr [STRING] [lp]
+            Variable [ Name=$g ]
+            Variable [ Name=$l ]
+            Variable [ Name=$p ]
+            Variable [ Name=$t ]
+          ]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
         AS Variable [ Name=$i ]
       ]
     )
@@ -65,7 +75,20 @@ OperatorExpr [
         ]
       ]
       ]
-      FROM [        Variable [ Name=$lp ]
+      FROM [        (
+          SELECT ELEMENT [
+          FunctionCall Metadata.resolve@-1[
+            LiteralExpr [STRING] [lp]
+            Variable [ Name=$g ]
+            Variable [ Name=$l ]
+            Variable [ Name=$p ]
+            Variable [ Name=$t ]
+          ]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
         AS Variable [ Name=$i ]
       ]
     )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.ast
index 0645c36..d4c9bb5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.ast
@@ -16,7 +16,10 @@ FunctionDecl revenue([]) {
             SELECT ELEMENT [
             OperatorExpr [
               FieldAccessor [
-                Variable [ Name=$i ]
+                FieldAccessor [
+                  Variable [ Name=$i ]
+                  Field=l
+                ]
                 Field=l_extendedprice
               ]
               *
@@ -24,13 +27,16 @@ FunctionDecl revenue([]) {
                 LiteralExpr [LONG] [1]
                 -
                 FieldAccessor [
-                  Variable [ Name=$i ]
+                  FieldAccessor [
+                    Variable [ Name=$i ]
+                    Field=l
+                  ]
                   Field=l_discount
                 ]
               ]
             ]
             ]
-            FROM [              Variable [ Name=$l ]
+            FROM [              Variable [ Name=$g ]
               AS Variable [ Name=$i ]
             ]
           )
@@ -68,6 +74,7 @@ FunctionDecl revenue([]) {
         Variable [ Name=$l ]
         Field=l_suppkey
       ]
+      GROUP AS Variable [ Name=$g ]
 
   )
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
index aef4422..c6ea4fa 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
@@ -324,7 +324,7 @@ Groupby
     Variable [ Name=$t2 ]
     Field=p_size
   ]
-  GROUP AS Variable [ Name=#2 ]
+  GROUP AS Variable [ Name=$g ]
   (
     t2:=Variable [ Name=$t2 ]
   )
@@ -339,7 +339,20 @@ Let Variable [ Name=$supplier_cnt ]
         Field=ps_suppkey
       ]
       ]
-      FROM [        Variable [ Name=$t2 ]
+      FROM [        (
+          SELECT ELEMENT [
+          FunctionCall Metadata.resolve@-1[
+            LiteralExpr [STRING] [t2]
+            Variable [ Name=$g ]
+            Variable [ Name=$p_brand ]
+            Variable [ Name=$p_size ]
+            Variable [ Name=$p_type ]
+          ]
+          ]
+          FROM [            Variable [ Name=$g ]
+            AS Variable [ Name=$g ]
+          ]
+        )
         AS Variable [ Name=$i ]
       ]
     )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.ast
index e184f80..11cb25f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.ast
@@ -10,16 +10,17 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [t_count]
     :
-    FunctionCall tpch.sql-count@1[
+    FunctionCall tpch.count@1[
       (
         SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=l
+        FunctionCall Metadata.resolve@-1[
+          LiteralExpr [STRING] [l]
+          Variable [ Name=$g ]
+          Variable [ Name=$l_partkey ]
         ]
         ]
-        FROM [          Variable [ Name=#1 ]
-          AS Variable [ Name=#2 ]
+        FROM [          Variable [ Name=$g ]
+          AS Variable [ Name=$g ]
         ]
       )
     ]
@@ -38,7 +39,18 @@ RecordConstructor [
             Field=l_quantity
           ]
           ]
-          FROM [            Variable [ Name=$l ]
+          FROM [            (
+              SELECT ELEMENT [
+              FunctionCall Metadata.resolve@-1[
+                LiteralExpr [STRING] [l]
+                Variable [ Name=$g ]
+                Variable [ Name=$l_partkey ]
+              ]
+              ]
+              FROM [                Variable [ Name=$g ]
+                AS Variable [ Name=$g ]
+              ]
+            )
             AS Variable [ Name=$i ]
           ]
         )
@@ -56,7 +68,18 @@ RecordConstructor [
           Field=l_suppkey
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$l_partkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$i ]
         ]
       )
@@ -73,7 +96,18 @@ RecordConstructor [
           Field=l_linenumber
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$l_partkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$i ]
         ]
       )
@@ -90,7 +124,18 @@ RecordConstructor [
           Field=l_extendedprice
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$l_partkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$i ]
         ]
       )
@@ -107,7 +152,18 @@ RecordConstructor [
           Field=l_discount
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$l_partkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$i ]
         ]
       )
@@ -124,7 +180,18 @@ RecordConstructor [
           Field=l_tax
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$l_partkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$i ]
         ]
       )
@@ -141,7 +208,18 @@ RecordConstructor [
           Field=l_shipdate
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$l_partkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$i ]
         ]
       )
@@ -158,7 +236,18 @@ RecordConstructor [
           Field=l_commitdate
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$l_partkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$i ]
         ]
       )
@@ -175,7 +264,18 @@ RecordConstructor [
           Field=l_receiptdate
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$l_partkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$i ]
         ]
       )
@@ -192,7 +292,18 @@ RecordConstructor [
           Field=l_comment
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$l_partkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$i ]
         ]
       )
@@ -212,7 +323,7 @@ Groupby
     Variable [ Name=$l ]
     Field=l_partkey
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$g ]
   (
     l:=Variable [ Name=$l ]
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.ast
index b8874cd..8e55967 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.ast
@@ -22,7 +22,14 @@ FunctionDecl tmp([]) {
                 Field=l_quantity
               ]
               ]
-              FROM [                Variable [ Name=$l ]
+              FROM [                (
+                  SELECT ELEMENT [
+                  Variable [ Name=$l ]
+                  ]
+                  FROM [                    Variable [ Name=$g ]
+                    AS Variable [ Name=$g ]
+                  ]
+                )
                 AS Variable [ Name=$i ]
               ]
             )
@@ -41,6 +48,7 @@ FunctionDecl tmp([]) {
         Variable [ Name=$l ]
         Field=l_partkey
       ]
+      GROUP AS Variable [ Name=$g ]
 
   )
 }
@@ -56,7 +64,11 @@ OperatorExpr [
         Field=l_extendedprice
       ]
       ]
-      FROM [        FunctionCall Metadata.dataset@1[
+      FROM [        FunctionCall tpch.tmp@0[
+        ]
+        AS Variable [ Name=$t ]
+,
+        FunctionCall Metadata.dataset@1[
           LiteralExpr [STRING] [LineItem]
         ]
         AS Variable [ Name=$l ]
@@ -65,59 +77,51 @@ OperatorExpr [
           LiteralExpr [STRING] [Part]
         ]
         AS Variable [ Name=$p ]
-,
-        FunctionCall tpch.tmp@0[
-        ]
-        AS Variable [ Name=$t ]
       ]
       Where
         OperatorExpr [
           OperatorExpr [
-            OperatorExpr [
-              FieldAccessor [
-                Variable [ Name=$p ]
-                Field=p_partkey
-              ]
-              =
-              FieldAccessor [
-                Variable [ Name=$l ]
-                Field=l_partkey
-              ]
+            FieldAccessor [
+              Variable [ Name=$p ]
+              Field=p_partkey
             ]
-            and
-            OperatorExpr [
-              FieldAccessor [
-                Variable [ Name=$p ]
-                Field=p_container
-              ]
-              =
-              LiteralExpr [STRING] [MED BOX]
+            =
+            FieldAccessor [
+              Variable [ Name=$l ]
+              Field=l_partkey
             ]
           ]
           and
           OperatorExpr [
-            OperatorExpr [
-              FieldAccessor [
-                Variable [ Name=$l ]
-                Field=l_partkey
-              ]
-              =
-              FieldAccessor [
-                Variable [ Name=$t ]
-                Field=t_partkey
-              ]
+            FieldAccessor [
+              Variable [ Name=$p ]
+              Field=p_container
             ]
-            and
-            OperatorExpr [
-              FieldAccessor [
-                Variable [ Name=$l ]
-                Field=l_quantity
-              ]
-              <
-              FieldAccessor [
-                Variable [ Name=$t ]
-                Field=t_avg_quantity
-              ]
+            =
+            LiteralExpr [STRING] [MED BOX]
+          ]
+          and
+          OperatorExpr [
+            FieldAccessor [
+              Variable [ Name=$l ]
+              Field=l_partkey
+            ]
+            =
+            FieldAccessor [
+              Variable [ Name=$t ]
+              Field=t_partkey
+            ]
+          ]
+          and
+          OperatorExpr [
+            FieldAccessor [
+              Variable [ Name=$l ]
+              Field=l_quantity
+            ]
+            <
+            FieldAccessor [
+              Variable [ Name=$t ]
+              Field=t_avg_quantity
             ]
           ]
         ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.ast
index 1e4ac7b..6bb9429 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.ast
@@ -38,7 +38,22 @@ RecordConstructor [
           Field=l_quantity
         ]
         ]
-        FROM [          Variable [ Name=$l ]
+        FROM [          (
+            SELECT ELEMENT [
+            FunctionCall Metadata.resolve@-1[
+              LiteralExpr [STRING] [l]
+              Variable [ Name=$g ]
+              Variable [ Name=$o_orderdate ]
+              Variable [ Name=$c_name ]
+              Variable [ Name=$o_orderkey ]
+              Variable [ Name=$o_totalprice ]
+              Variable [ Name=$c_custkey ]
+            ]
+            ]
+            FROM [              Variable [ Name=$g ]
+              AS Variable [ Name=$g ]
+            ]
+          )
           AS Variable [ Name=$j ]
         ]
       )
@@ -75,7 +90,20 @@ FROM [  FunctionCall Metadata.dataset@1[
               Field=l_quantity
             ]
             ]
-            FROM [              Variable [ Name=$l ]
+            FROM [              (
+                SELECT ELEMENT [
+                FunctionCall Metadata.resolve@-1[
+                  LiteralExpr [STRING] [l]
+                  Variable [ Name=$o ]
+                  Variable [ Name=$l_orderkey ]
+                  Variable [ Name=$g2 ]
+                  Variable [ Name=$c ]
+                ]
+                ]
+                FROM [                  Variable [ Name=$g2 ]
+                  AS Variable [ Name=$g2 ]
+                ]
+              )
               AS Variable [ Name=$i ]
             ]
           )
@@ -95,7 +123,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         Variable [ Name=$l ]
         Field=l_orderkey
       ]
-      GROUP AS Variable [ Name=#1 ]
+      GROUP AS Variable [ Name=$g2 ]
       (
         l:=Variable [ Name=$l ]
       )
@@ -123,26 +151,24 @@ Where
     ]
     and
     OperatorExpr [
-      OperatorExpr [
-        FieldAccessor [
-          Variable [ Name=$o ]
-          Field=o_orderkey
-        ]
-        =
-        FieldAccessor [
-          Variable [ Name=$t ]
-          Field=l_orderkey
-        ]
+      FieldAccessor [
+        Variable [ Name=$o ]
+        Field=o_orderkey
       ]
-      and
-      OperatorExpr [
-        FieldAccessor [
-          Variable [ Name=$t ]
-          Field=t_sum_quantity
-        ]
-        >
-        LiteralExpr [LONG] [30]
+      =
+      FieldAccessor [
+        Variable [ Name=$t ]
+        Field=l_orderkey
+      ]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$t ]
+        Field=t_sum_quantity
       ]
+      >
+      LiteralExpr [LONG] [30]
     ]
     and
     OperatorExpr [
@@ -152,8 +178,8 @@ Where
       ]
       =
       FieldAccessor [
-        Variable [ Name=$o ]
-        Field=o_orderkey
+        Variable [ Name=$t ]
+        Field=l_orderkey
       ]
     ]
   ]
@@ -188,7 +214,7 @@ Groupby
     Variable [ Name=$o ]
     Field=o_totalprice
   ]
-  GROUP AS Variable [ Name=#2 ]
+  GROUP AS Variable [ Name=$g ]
   (
     c:=Variable [ Name=$c ]
     o:=Variable [ Name=$o ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9c2e9f0e/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
index 9993401..88f61d2 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.ast
@@ -60,7 +60,19 @@ FROM [  (
                     Field=l_quantity
                   ]
                   ]
-                  FROM [                    Variable [ Name=$l ]
+                  FROM [                    (
+                      SELECT ELEMENT [
+                      FunctionCall Metadata.resolve@-1[
+                        LiteralExpr [STRING] [l]
+                        Variable [ Name=$l_suppkey ]
+                        Variable [ Name=$g ]
+                        Variable [ Name=$l_partkey ]
+                      ]
+                      ]
+                      FROM [                        Variable [ Name=$g ]
+                        AS Variable [ Name=$g ]
+                      ]
+                    )
                     AS Variable [ Name=$i ]
                   ]
                 )
@@ -87,7 +99,7 @@ FROM [  (
             Variable [ Name=$l ]
             Field=l_suppkey
           ]
-          GROUP AS Variable [ Name=#1 ]
+          GROUP AS Variable [ Name=$g ]
           (
             l:=Variable [ Name=$l ]
           )


Mime
View raw message