asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [7/8] asterixdb git commit: Clean up GROUP BY and WITH clause.
Date Mon, 15 Aug 2016 15:45:38 GMT
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-2.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-2.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-2.plan
index 28c4ffd..80014c7 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-2.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-2.plan
@@ -4,7 +4,7 @@
       -- ASSIGN  |PARTITIONED|
         -- STREAM_PROJECT  |PARTITIONED|
           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-            -- HYBRID_HASH_JOIN [$$33][$$48]  |PARTITIONED|
+            -- HYBRID_HASH_JOIN [$$34][$$49]  |PARTITIONED|
               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                 -- STREAM_PROJECT  |PARTITIONED|
                   -- ASSIGN  |PARTITIONED|
@@ -12,22 +12,22 @@
                       -- DATASOURCE_SCAN  |PARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                           -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-              -- HASH_PARTITION_EXCHANGE [$$48]  |PARTITIONED|
+              -- HASH_PARTITION_EXCHANGE [$$49]  |PARTITIONED|
                 -- NESTED_LOOP  |PARTITIONED|
                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                     -- STREAM_PROJECT  |PARTITIONED|
                       -- STREAM_SELECT  |PARTITIONED|
                         -- STREAM_PROJECT  |PARTITIONED|
                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                            -- PRE_CLUSTERED_GROUP_BY[$$34, $$47]  |PARTITIONED|
+                            -- PRE_CLUSTERED_GROUP_BY[$$35, $$48]  |PARTITIONED|
                                     {
                                       -- AGGREGATE  |LOCAL|
                                         -- STREAM_SELECT  |LOCAL|
                                           -- NESTED_TUPLE_SOURCE  |LOCAL|
                                     }
                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                -- STABLE_SORT [$$34(ASC), $$47(ASC)]  |PARTITIONED|
-                                  -- HASH_PARTITION_EXCHANGE [$$34, $$47]  |PARTITIONED|
+                                -- STABLE_SORT [$$35(ASC), $$48(ASC)]  |PARTITIONED|
+                                  -- HASH_PARTITION_EXCHANGE [$$35, $$48]  |PARTITIONED|
                                     -- STREAM_PROJECT  |PARTITIONED|
                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                         -- NESTED_LOOP  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive-2.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive-2.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive-2.plan
index 525500d..b1998f3 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive-2.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive-2.plan
@@ -4,7 +4,7 @@
       -- ASSIGN  |PARTITIONED|
         -- STREAM_PROJECT  |PARTITIONED|
           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-            -- HYBRID_HASH_JOIN [$$56][$$63]  |PARTITIONED|
+            -- HYBRID_HASH_JOIN [$$57][$$64]  |PARTITIONED|
               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                 -- STREAM_PROJECT  |PARTITIONED|
                   -- ASSIGN  |PARTITIONED|
@@ -12,22 +12,22 @@
                       -- DATASOURCE_SCAN  |PARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                           -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-              -- HASH_PARTITION_EXCHANGE [$$63]  |PARTITIONED|
+              -- HASH_PARTITION_EXCHANGE [$$64]  |PARTITIONED|
                 -- NESTED_LOOP  |PARTITIONED|
                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                     -- STREAM_PROJECT  |PARTITIONED|
                       -- STREAM_SELECT  |PARTITIONED|
                         -- STREAM_PROJECT  |PARTITIONED|
                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                            -- PRE_CLUSTERED_GROUP_BY[$$43, $$62]  |PARTITIONED|
+                            -- PRE_CLUSTERED_GROUP_BY[$$44, $$63]  |PARTITIONED|
                                     {
                                       -- AGGREGATE  |LOCAL|
                                         -- STREAM_SELECT  |LOCAL|
                                           -- NESTED_TUPLE_SOURCE  |LOCAL|
                                     }
                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                -- STABLE_SORT [$$43(ASC), $$62(ASC)]  |PARTITIONED|
-                                  -- HASH_PARTITION_EXCHANGE [$$43, $$62]  |PARTITIONED|
+                                -- STABLE_SORT [$$44(ASC), $$63(ASC)]  |PARTITIONED|
+                                  -- HASH_PARTITION_EXCHANGE [$$44, $$63]  |PARTITIONED|
                                     -- STREAM_PROJECT  |PARTITIONED|
                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                         -- NESTED_LOOP  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive.plan
index b429c28..62352d7 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017-recursive.plan
@@ -4,7 +4,7 @@
       -- ASSIGN  |PARTITIONED|
         -- STREAM_PROJECT  |PARTITIONED|
           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-            -- HYBRID_HASH_JOIN [$$52][$$58]  |PARTITIONED|
+            -- HYBRID_HASH_JOIN [$$53][$$59]  |PARTITIONED|
               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                 -- STREAM_PROJECT  |PARTITIONED|
                   -- ASSIGN  |PARTITIONED|
@@ -17,22 +17,22 @@
                                 -- DATASOURCE_SCAN  |PARTITIONED|
                                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                     -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-              -- HASH_PARTITION_EXCHANGE [$$58]  |PARTITIONED|
+              -- HASH_PARTITION_EXCHANGE [$$59]  |PARTITIONED|
                 -- NESTED_LOOP  |PARTITIONED|
                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                     -- STREAM_PROJECT  |PARTITIONED|
                       -- STREAM_SELECT  |PARTITIONED|
                         -- STREAM_PROJECT  |PARTITIONED|
                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                            -- PRE_CLUSTERED_GROUP_BY[$$41, $$57]  |PARTITIONED|
+                            -- PRE_CLUSTERED_GROUP_BY[$$42, $$58]  |PARTITIONED|
                                     {
                                       -- AGGREGATE  |LOCAL|
                                         -- STREAM_SELECT  |LOCAL|
                                           -- NESTED_TUPLE_SOURCE  |LOCAL|
                                     }
                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                -- STABLE_SORT [$$41(ASC), $$57(ASC)]  |PARTITIONED|
-                                  -- HASH_PARTITION_EXCHANGE [$$41, $$57]  |PARTITIONED|
+                                -- STABLE_SORT [$$42(ASC), $$58(ASC)]  |PARTITIONED|
+                                  -- HASH_PARTITION_EXCHANGE [$$42, $$58]  |PARTITIONED|
                                     -- STREAM_PROJECT  |PARTITIONED|
                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                         -- NESTED_LOOP  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017.plan
index 929d3da..2697384 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1017.plan
@@ -4,7 +4,7 @@
       -- ASSIGN  |PARTITIONED|
         -- STREAM_PROJECT  |PARTITIONED|
           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-            -- HYBRID_HASH_JOIN [$$30][$$42]  |PARTITIONED|
+            -- HYBRID_HASH_JOIN [$$31][$$43]  |PARTITIONED|
               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                 -- STREAM_PROJECT  |PARTITIONED|
                   -- ASSIGN  |PARTITIONED|
@@ -12,26 +12,26 @@
                       -- DATASOURCE_SCAN  |PARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                           -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-              -- HASH_PARTITION_EXCHANGE [$$42]  |PARTITIONED|
+              -- HASH_PARTITION_EXCHANGE [$$43]  |PARTITIONED|
                 -- NESTED_LOOP  |PARTITIONED|
                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                     -- STREAM_PROJECT  |PARTITIONED|
                       -- STREAM_SELECT  |PARTITIONED|
                         -- STREAM_PROJECT  |PARTITIONED|
                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                            -- PRE_CLUSTERED_GROUP_BY[$$31, $$41]  |PARTITIONED|
+                            -- PRE_CLUSTERED_GROUP_BY[$$32, $$42]  |PARTITIONED|
                                     {
                                       -- AGGREGATE  |LOCAL|
                                         -- STREAM_SELECT  |LOCAL|
                                           -- NESTED_TUPLE_SOURCE  |LOCAL|
                                     }
                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                -- STABLE_SORT [$$31(ASC), $$41(ASC)]  |PARTITIONED|
-                                  -- HASH_PARTITION_EXCHANGE [$$31, $$41]  |PARTITIONED|
+                                -- STABLE_SORT [$$32(ASC), $$42(ASC)]  |PARTITIONED|
+                                  -- HASH_PARTITION_EXCHANGE [$$32, $$42]  |PARTITIONED|
                                     -- STREAM_PROJECT  |PARTITIONED|
                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                        -- HYBRID_HASH_JOIN [$$38][$$34]  |PARTITIONED|
-                                          -- HASH_PARTITION_EXCHANGE [$$38]  |PARTITIONED|
+                                        -- HYBRID_HASH_JOIN [$$39][$$35]  |PARTITIONED|
+                                          -- HASH_PARTITION_EXCHANGE [$$39]  |PARTITIONED|
                                             -- NESTED_LOOP  |PARTITIONED|
                                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                 -- STREAM_PROJECT  |PARTITIONED|
@@ -46,7 +46,7 @@
                                                     -- DATASOURCE_SCAN  |PARTITIONED|
                                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                         -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-                                          -- HASH_PARTITION_EXCHANGE [$$34]  |PARTITIONED|
+                                          -- HASH_PARTITION_EXCHANGE [$$35]  |PARTITIONED|
                                             -- STREAM_PROJECT  |PARTITIONED|
                                               -- ASSIGN  |PARTITIONED|
                                                 -- STREAM_PROJECT  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1018.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1018.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1018.plan
index d7b279e..3eb81d9 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1018.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1018.plan
@@ -4,46 +4,46 @@
       -- ASSIGN  |PARTITIONED|
         -- STREAM_PROJECT  |PARTITIONED|
           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-            -- HYBRID_HASH_JOIN [$$34][$$47]  |PARTITIONED|
+            -- HYBRID_HASH_JOIN [$$35][$$48]  |PARTITIONED|
               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                 -- STREAM_PROJECT  |PARTITIONED|
                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                     -- DATASOURCE_SCAN  |PARTITIONED|
                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                         -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-              -- HASH_PARTITION_EXCHANGE [$$47]  |PARTITIONED|
+              -- HASH_PARTITION_EXCHANGE [$$48]  |PARTITIONED|
                 -- STREAM_PROJECT  |PARTITIONED|
                   -- ASSIGN  |PARTITIONED|
                     -- STREAM_PROJECT  |PARTITIONED|
                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                        -- PRE_CLUSTERED_GROUP_BY[$$51, $$24, $$52]  |PARTITIONED|
+                        -- PRE_CLUSTERED_GROUP_BY[$$52, $$24, $$53]  |PARTITIONED|
                                 {
                                   -- AGGREGATE  |LOCAL|
                                     -- STREAM_SELECT  |LOCAL|
                                       -- NESTED_TUPLE_SOURCE  |LOCAL|
                                 }
                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                            -- STABLE_SORT [$$51(ASC), $$24(ASC), $$52(ASC)]  |PARTITIONED|
-                              -- HASH_PARTITION_EXCHANGE [$$51, $$24, $$52]  |PARTITIONED|
+                            -- STABLE_SORT [$$52(ASC), $$24(ASC), $$53(ASC)]  |PARTITIONED|
+                              -- HASH_PARTITION_EXCHANGE [$$52, $$24, $$53]  |PARTITIONED|
                                 -- STREAM_PROJECT  |PARTITIONED|
                                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                     -- NESTED_LOOP  |PARTITIONED|
                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                         -- STREAM_SELECT  |PARTITIONED|
                                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                            -- PRE_CLUSTERED_GROUP_BY[$$35, $$46]  |PARTITIONED|
+                                            -- PRE_CLUSTERED_GROUP_BY[$$36, $$47]  |PARTITIONED|
                                                     {
                                                       -- AGGREGATE  |LOCAL|
                                                         -- STREAM_SELECT  |LOCAL|
                                                           -- NESTED_TUPLE_SOURCE  |LOCAL|
                                                     }
                                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                -- STABLE_SORT [$$35(ASC), $$46(ASC)]  |PARTITIONED|
-                                                  -- HASH_PARTITION_EXCHANGE [$$35, $$46]  |PARTITIONED|
+                                                -- STABLE_SORT [$$36(ASC), $$47(ASC)]  |PARTITIONED|
+                                                  -- HASH_PARTITION_EXCHANGE [$$36, $$47]  |PARTITIONED|
                                                     -- STREAM_PROJECT  |PARTITIONED|
                                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                        -- HYBRID_HASH_JOIN [$$44][$$38]  |PARTITIONED|
-                                                          -- HASH_PARTITION_EXCHANGE [$$44]  |PARTITIONED|
+                                                        -- HYBRID_HASH_JOIN [$$45][$$39]  |PARTITIONED|
+                                                          -- HASH_PARTITION_EXCHANGE [$$45]  |PARTITIONED|
                                                             -- NESTED_LOOP  |PARTITIONED|
                                                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                                 -- STREAM_PROJECT  |PARTITIONED|
@@ -59,7 +59,7 @@
                                                                       -- DATASOURCE_SCAN  |PARTITIONED|
                                                                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                                           -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-                                                          -- HASH_PARTITION_EXCHANGE [$$38]  |PARTITIONED|
+                                                          -- HASH_PARTITION_EXCHANGE [$$39]  |PARTITIONED|
                                                             -- STREAM_PROJECT  |PARTITIONED|
                                                               -- ASSIGN  |PARTITIONED|
                                                                 -- STREAM_PROJECT  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1019.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1019.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1019.plan
index 5b2405b..b910acf 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1019.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1019.plan
@@ -2,7 +2,7 @@
   -- STREAM_PROJECT  |PARTITIONED|
     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
       -- INSERT_DELETE  |PARTITIONED|
-        -- HASH_PARTITION_EXCHANGE [$$34]  |PARTITIONED|
+        -- HASH_PARTITION_EXCHANGE [$$35]  |PARTITIONED|
           -- ASSIGN  |PARTITIONED|
             -- STREAM_PROJECT  |PARTITIONED|
               -- ASSIGN  |PARTITIONED|
@@ -12,46 +12,46 @@
                       -- ASSIGN  |PARTITIONED|
                         -- STREAM_PROJECT  |PARTITIONED|
                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                            -- HYBRID_HASH_JOIN [$$38][$$51]  |PARTITIONED|
+                            -- HYBRID_HASH_JOIN [$$39][$$52]  |PARTITIONED|
                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                 -- STREAM_PROJECT  |PARTITIONED|
                                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                     -- DATASOURCE_SCAN  |PARTITIONED|
                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                         -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-                              -- HASH_PARTITION_EXCHANGE [$$51]  |PARTITIONED|
+                              -- HASH_PARTITION_EXCHANGE [$$52]  |PARTITIONED|
                                 -- STREAM_PROJECT  |PARTITIONED|
                                   -- ASSIGN  |PARTITIONED|
                                     -- STREAM_PROJECT  |PARTITIONED|
                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                        -- PRE_CLUSTERED_GROUP_BY[$$56, $$24, $$55]  |PARTITIONED|
+                                        -- PRE_CLUSTERED_GROUP_BY[$$57, $$24, $$56]  |PARTITIONED|
                                                 {
                                                   -- AGGREGATE  |LOCAL|
                                                     -- STREAM_SELECT  |LOCAL|
                                                       -- NESTED_TUPLE_SOURCE  |LOCAL|
                                                 }
                                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                            -- STABLE_SORT [$$56(ASC), $$24(ASC), $$55(ASC)]  |PARTITIONED|
-                                              -- HASH_PARTITION_EXCHANGE [$$56, $$24, $$55]  |PARTITIONED|
+                                            -- STABLE_SORT [$$57(ASC), $$24(ASC), $$56(ASC)]  |PARTITIONED|
+                                              -- HASH_PARTITION_EXCHANGE [$$57, $$24, $$56]  |PARTITIONED|
                                                 -- STREAM_PROJECT  |PARTITIONED|
                                                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                     -- NESTED_LOOP  |PARTITIONED|
                                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                         -- STREAM_SELECT  |PARTITIONED|
                                                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                            -- PRE_CLUSTERED_GROUP_BY[$$50, $$39]  |PARTITIONED|
+                                                            -- PRE_CLUSTERED_GROUP_BY[$$51, $$40]  |PARTITIONED|
                                                                     {
                                                                       -- AGGREGATE  |LOCAL|
                                                                         -- STREAM_SELECT  |LOCAL|
                                                                           -- NESTED_TUPLE_SOURCE  |LOCAL|
                                                                     }
                                                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                                -- STABLE_SORT [$$50(ASC), $$39(ASC)]  |PARTITIONED|
-                                                                  -- HASH_PARTITION_EXCHANGE [$$50, $$39]  |PARTITIONED|
+                                                                -- STABLE_SORT [$$51(ASC), $$40(ASC)]  |PARTITIONED|
+                                                                  -- HASH_PARTITION_EXCHANGE [$$51, $$40]  |PARTITIONED|
                                                                     -- STREAM_PROJECT  |PARTITIONED|
                                                                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                                        -- HYBRID_HASH_JOIN [$$48][$$42]  |PARTITIONED|
-                                                                          -- HASH_PARTITION_EXCHANGE [$$48]  |PARTITIONED|
+                                                                        -- HYBRID_HASH_JOIN [$$49][$$43]  |PARTITIONED|
+                                                                          -- HASH_PARTITION_EXCHANGE [$$49]  |PARTITIONED|
                                                                             -- NESTED_LOOP  |PARTITIONED|
                                                                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                                                 -- STREAM_PROJECT  |PARTITIONED|
@@ -67,7 +67,7 @@
                                                                                       -- DATASOURCE_SCAN  |PARTITIONED|
                                                                                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                                                           -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-                                                                          -- HASH_PARTITION_EXCHANGE [$$42]  |PARTITIONED|
+                                                                          -- HASH_PARTITION_EXCHANGE [$$43]  |PARTITIONED|
                                                                             -- STREAM_PROJECT  |PARTITIONED|
                                                                               -- ASSIGN  |PARTITIONED|
                                                                                 -- STREAM_PROJECT  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1020.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1020.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1020.plan
index 7eb6d35..5558ad4 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1020.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1020.plan
@@ -14,15 +14,15 @@
               -- STREAM_SELECT  |PARTITIONED|
                 -- STREAM_PROJECT  |PARTITIONED|
                   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                    -- PRE_CLUSTERED_GROUP_BY[$$32]  |PARTITIONED|
+                    -- PRE_CLUSTERED_GROUP_BY[$$33]  |PARTITIONED|
                             {
                               -- AGGREGATE  |LOCAL|
                                 -- STREAM_SELECT  |LOCAL|
                                   -- NESTED_TUPLE_SOURCE  |LOCAL|
                             }
                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                        -- STABLE_SORT [$$32(ASC)]  |PARTITIONED|
-                          -- HASH_PARTITION_EXCHANGE [$$32]  |PARTITIONED|
+                        -- STABLE_SORT [$$33(ASC)]  |PARTITIONED|
+                          -- HASH_PARTITION_EXCHANGE [$$33]  |PARTITIONED|
                             -- STREAM_PROJECT  |PARTITIONED|
                               -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                 -- NESTED_LOOP  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-1.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-1.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-1.plan
index 3664ed8..99240dc 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-1.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-1.plan
@@ -23,25 +23,19 @@
                                 -- ASSIGN  |UNPARTITIONED|
                                   -- STREAM_PROJECT  |UNPARTITIONED|
                                     -- UNNEST  |UNPARTITIONED|
-                                      -- STREAM_PROJECT  |UNPARTITIONED|
-                                        -- SUBPLAN  |UNPARTITIONED|
-                                                {
-                                                  -- ASSIGN  |UNPARTITIONED|
-                                                    -- SUBPLAN  |UNPARTITIONED|
-                                                            {
-                                                              -- AGGREGATE  |UNPARTITIONED|
-                                                                -- STREAM_SELECT  |UNPARTITIONED|
-                                                                  -- UNNEST  |UNPARTITIONED|
-                                                                    -- SUBPLAN  |UNPARTITIONED|
-                                                                            {
-                                                                              -- AGGREGATE  |UNPARTITIONED|
-                                                                                -- IN_MEMORY_STABLE_SORT [$$21(ASC)]  |UNPARTITIONED|
-                                                                                  -- UNNEST  |UNPARTITIONED|
-                                                                                    -- NESTED_TUPLE_SOURCE  |UNPARTITIONED|
-                                                                            }
+                                      -- SUBPLAN  |UNPARTITIONED|
+                                              {
+                                                -- AGGREGATE  |UNPARTITIONED|
+                                                  -- STREAM_SELECT  |UNPARTITIONED|
+                                                    -- UNNEST  |UNPARTITIONED|
+                                                      -- SUBPLAN  |UNPARTITIONED|
+                                                              {
+                                                                -- AGGREGATE  |UNPARTITIONED|
+                                                                  -- IN_MEMORY_STABLE_SORT [$$21(ASC)]  |UNPARTITIONED|
+                                                                    -- UNNEST  |UNPARTITIONED|
                                                                       -- NESTED_TUPLE_SOURCE  |UNPARTITIONED|
-                                                            }
-                                                      -- NESTED_TUPLE_SOURCE  |UNPARTITIONED|
-                                                }
-                                          -- ASSIGN  |UNPARTITIONED|
-                                            -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                                                              }
+                                                        -- NESTED_TUPLE_SOURCE  |UNPARTITIONED|
+                                              }
+                                        -- ASSIGN  |UNPARTITIONED|
+                                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-2.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-2.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-2.plan
index caf4c48..aa22db0 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-2.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/udfs/query-ASTERIXDB-1308-2.plan
@@ -5,73 +5,56 @@
         -- STREAM_PROJECT  |PARTITIONED|
           -- SUBPLAN  |PARTITIONED|
                   {
-                    -- SUBPLAN  |LOCAL|
-                            {
-                              -- SUBPLAN  |LOCAL|
-                                      {
-                                        -- ASSIGN  |LOCAL|
-                                          -- SUBPLAN  |LOCAL|
-                                                  {
-                                                    -- AGGREGATE  |LOCAL|
-                                                      -- STREAM_SELECT  |LOCAL|
-                                                        -- ASSIGN  |LOCAL|
-                                                          -- UNNEST  |LOCAL|
-                                                            -- SUBPLAN  |LOCAL|
-                                                                    {
-                                                                      -- AGGREGATE  |LOCAL|
-                                                                        -- IN_MEMORY_STABLE_SORT [$$38(ASC)]  |LOCAL|
-                                                                          -- UNNEST  |LOCAL|
-                                                                            -- NESTED_TUPLE_SOURCE  |LOCAL|
-                                                                    }
-                                                              -- NESTED_TUPLE_SOURCE  |LOCAL|
-                                                  }
+                    -- AGGREGATE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
+                        -- ASSIGN  |LOCAL|
+                          -- UNNEST  |LOCAL|
+                            -- SUBPLAN  |LOCAL|
+                                    {
+                                      -- AGGREGATE  |LOCAL|
+                                        -- IN_MEMORY_STABLE_SORT [$$38(ASC)]  |LOCAL|
+                                          -- UNNEST  |LOCAL|
                                             -- NESTED_TUPLE_SOURCE  |LOCAL|
-                                      }
-                                -- SUBPLAN  |LOCAL|
-                                        {
-                                          -- AGGREGATE  |LOCAL|
-                                            -- IN_MEMORY_STABLE_SORT [$$98(ASC)]  |LOCAL|
-                                              -- ASSIGN  |LOCAL|
-                                                -- UNNEST  |LOCAL|
-                                                  -- NESTED_TUPLE_SOURCE  |LOCAL|
-                                        }
-                                  -- NESTED_TUPLE_SOURCE  |LOCAL|
-                            }
-                      -- SUBPLAN  |LOCAL|
-                              {
-                                -- ASSIGN  |LOCAL|
+                                    }
+                              -- NESTED_TUPLE_SOURCE  |LOCAL|
+                  }
+            -- STREAM_PROJECT  |PARTITIONED|
+              -- SUBPLAN  |PARTITIONED|
+                      {
+                        -- AGGREGATE  |LOCAL|
+                          -- IN_MEMORY_STABLE_SORT [$$98(ASC)]  |LOCAL|
+                            -- ASSIGN  |LOCAL|
+                              -- UNNEST  |LOCAL|
+                                -- NESTED_TUPLE_SOURCE  |LOCAL|
+                      }
+                -- SUBPLAN  |PARTITIONED|
+                        {
+                          -- AGGREGATE  |LOCAL|
+                            -- STREAM_SELECT  |LOCAL|
+                              -- ASSIGN  |LOCAL|
+                                -- UNNEST  |LOCAL|
                                   -- SUBPLAN  |LOCAL|
                                           {
                                             -- AGGREGATE  |LOCAL|
-                                              -- STREAM_SELECT  |LOCAL|
-                                                -- ASSIGN  |LOCAL|
-                                                  -- UNNEST  |LOCAL|
-                                                    -- SUBPLAN  |LOCAL|
-                                                            {
-                                                              -- AGGREGATE  |LOCAL|
-                                                                -- IN_MEMORY_STABLE_SORT [$$31(ASC)]  |LOCAL|
-                                                                  -- UNNEST  |LOCAL|
-                                                                    -- NESTED_TUPLE_SOURCE  |LOCAL|
-                                                            }
-                                                      -- NESTED_TUPLE_SOURCE  |LOCAL|
+                                              -- IN_MEMORY_STABLE_SORT [$$31(ASC)]  |LOCAL|
+                                                -- UNNEST  |LOCAL|
+                                                  -- NESTED_TUPLE_SOURCE  |LOCAL|
                                           }
                                     -- NESTED_TUPLE_SOURCE  |LOCAL|
-                              }
-                        -- NESTED_TUPLE_SOURCE  |LOCAL|
-                  }
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- PRE_CLUSTERED_GROUP_BY[$$94, $$95, $$96, $$97]  |PARTITIONED|
-                      {
-                        -- AGGREGATE  |LOCAL|
-                          -- NESTED_TUPLE_SOURCE  |LOCAL|
-                      }
-                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                  -- STABLE_SORT [$$94(ASC), $$95(ASC), $$96(ASC), $$97(ASC)]  |PARTITIONED|
-                    -- HASH_PARTITION_EXCHANGE [$$94, $$95, $$96, $$97]  |PARTITIONED|
-                      -- STREAM_PROJECT  |PARTITIONED|
-                        -- ASSIGN  |PARTITIONED|
-                          -- STREAM_PROJECT  |PARTITIONED|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+                        }
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- PRE_CLUSTERED_GROUP_BY[$$94, $$95, $$96, $$97]  |PARTITIONED|
+                            {
+                              -- AGGREGATE  |LOCAL|
+                                -- NESTED_TUPLE_SOURCE  |LOCAL|
+                            }
+                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                        -- STABLE_SORT [$$94(ASC), $$95(ASC), $$96(ASC), $$97(ASC)]  |PARTITIONED|
+                          -- HASH_PARTITION_EXCHANGE [$$94, $$95, $$96, $$97]  |PARTITIONED|
+                            -- STREAM_PROJECT  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
+                                -- STREAM_PROJECT  |PARTITIONED|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- DATASOURCE_SCAN  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
index a727fb4..4208580 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
@@ -61,8 +61,7 @@ Groupby
   Variable [ Name=$token ]
   GROUP AS Variable [ Name=#1 ]
   (
-    tokens:=Variable [ Name=$tokens ]
-    token:=Variable [ Name=$token ]
     t:=Variable [ Name=$t ]
+    token:=Variable [ Name=$token ]
   )
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
index 41092db..557eece 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
@@ -102,7 +102,7 @@ Groupby
   ]
   GROUP AS Variable [ Name=#1 ]
   (
-    o:=Variable [ Name=$o ]
     c:=Variable [ Name=$c ]
+    o:=Variable [ Name=$o ]
   )
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast
index 3ca4a03..3367a13 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-dblp-csx.ast
@@ -172,16 +172,10 @@ Groupby
   Variable [ Name=$idCSX ]
   GROUP AS Variable [ Name=#1 ]
   (
-    tokensCSX:=Variable [ Name=$tokensCSX ]
-    unrankedTokensCSX:=Variable [ Name=$unrankedTokensCSX ]
-    idCSX:=Variable [ Name=$idCSX ]
-    tokensDBLP:=Variable [ Name=$tokensDBLP ]
-    unrankedTokensDBLP:=Variable [ Name=$unrankedTokensDBLP ]
-    idDBLP:=Variable [ Name=$idDBLP ]
-    prefixTokenCSX:=Variable [ Name=$prefixTokenCSX ]
-    paperCSX:=Variable [ Name=$paperCSX ]
-    prefixTokenDBLP:=Variable [ Name=$prefixTokenDBLP ]
     paperDBLP:=Variable [ Name=$paperDBLP ]
+    prefixTokenDBLP:=Variable [ Name=$prefixTokenDBLP ]
+    paperCSX:=Variable [ Name=$paperCSX ]
+    prefixTokenCSX:=Variable [ Name=$prefixTokenCSX ]
   )
 
 Orderby

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
index b5e5161..2210b9c 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
@@ -74,8 +74,8 @@ Let Variable [ Name=$tokens ]
           Variable [ Name=$lottery_number ]
           GROUP AS Variable [ Name=#1 ]
           (
-            lottery_number:=Variable [ Name=$lottery_number ]
             user:=Variable [ Name=$user ]
+            lottery_number:=Variable [ Name=$lottery_number ]
           )
 
         Let Variable [ Name=$count ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
index ee802a0..dabf888 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
@@ -73,10 +73,8 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            unrankedTokensDBLP:=Variable [ Name=$unrankedTokensDBLP ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
index 72a1958..c503d72 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
@@ -147,8 +147,6 @@ FROM [  FunctionCall Metadata.dataset@1[
       GROUP AS Variable [ Name=#1 ]
       (
         l:=Variable [ Name=$l ]
-        o:=Variable [ Name=$o ]
-        c:=Variable [ Name=$c ]
       )
 
   )
@@ -241,10 +239,10 @@ Groupby
   ]
   GROUP AS Variable [ Name=#2 ]
   (
-    l:=Variable [ Name=$l ]
-    t:=Variable [ Name=$t ]
-    o:=Variable [ Name=$o ]
     c:=Variable [ Name=$c ]
+    o:=Variable [ Name=$o ]
+    t:=Variable [ Name=$t ]
+    l:=Variable [ Name=$l ]
   )
 
 Orderby

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
index 951e744..d69ca94 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
@@ -162,10 +162,8 @@ RecordConstructor [
         ]
         GROUP AS Variable [ Name=#1 ]
         (
-          customer:=Variable [ Name=$customer ]
           orders:=Variable [ Name=$orders ]
-          sn:=Variable [ Name=$sn ]
-          nation:=Variable [ Name=$nation ]
+          customer:=Variable [ Name=$customer ]
         )
 
       Let Variable [ Name=$sum ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
index 3f1faf2..91378e0 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
@@ -23,17 +23,7 @@ RecordConstructor [
     LiteralExpr [STRING] [ordpercust]
     :
     FunctionCall orders-aggreg.count@1[
-      (
-        SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=o
-        ]
-        ]
-        FROM [          Variable [ Name=#1 ]
-          AS Variable [ Name=#2 ]
-        ]
-      )
+      Variable [ Name=$o ]
     ]
   )
   (

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
index 1a91b41..d36738f 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
@@ -188,17 +188,7 @@ RecordConstructor [
     LiteralExpr [STRING] [count_order]
     :
     FunctionCall tpch.count@1[
-      (
-        SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=l
-        ]
-        ]
-        FROM [          Variable [ Name=#1 ]
-          AS Variable [ Name=#2 ]
-        ]
-      )
+      Variable [ Name=$l ]
     ]
   )
 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
index 2a34cb7..041dfb7 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
@@ -166,9 +166,9 @@ Groupby
   ]
   GROUP AS Variable [ Name=#1 ]
   (
-    l:=Variable [ Name=$l ]
-    o:=Variable [ Name=$o ]
     c:=Variable [ Name=$c ]
+    o:=Variable [ Name=$o ]
+    l:=Variable [ Name=$l ]
   )
 
 Let Variable [ Name=$revenue ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
index f913928..4340fed 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
@@ -388,8 +388,8 @@ Groupby
   ]
   GROUP AS Variable [ Name=#1 ]
   (
-    o1:=Variable [ Name=$o1 ]
     c:=Variable [ Name=$c ]
+    o1:=Variable [ Name=$o1 ]
   )
 
 Let Variable [ Name=$revenue ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
index 37eefd4..1b01e10 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
@@ -85,9 +85,8 @@ Groupby
   ]
   GROUP AS Variable [ Name=#1 ]
   (
-    es:=Variable [ Name=$es ]
-    sponsor:=Variable [ Name=$sponsor ]
     event:=Variable [ Name=$event ]
+    sponsor:=Variable [ Name=$sponsor ]
   )
 
 Let Variable [ Name=$sig_sponsorship_count ]
@@ -95,9 +94,8 @@ Let Variable [ Name=$sig_sponsorship_count ]
   FunctionCall events.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#2 ]
-        Field=es
+      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [es]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
@@ -134,7 +132,9 @@ Let Variable [ Name=$by_chapter ]
       )
     ]
     ]
-    FROM [      Variable [ Name=$es ]
+    FROM [      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [es]
+      ]
       AS Variable [ Name=$e ]
     ]
     Groupby
@@ -150,12 +150,6 @@ Let Variable [ Name=$by_chapter ]
       GROUP AS Variable [ Name=#3 ]
       (
         e:=Variable [ Name=$e ]
-        sig_sponsorship_count:=Variable [ Name=$sig_sponsorship_count ]
-        es:=Variable [ Name=$es ]
-        event:=Variable [ Name=$event ]
-        sponsor:=Variable [ Name=$sponsor ]
-        sig_name:=Variable [ Name=$sig_name ]
-        #1:=Variable [ Name=#1 ]
       )
 
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
index f8988ad..e5a516d 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue550.ast
@@ -181,6 +181,5 @@ Groupby
   GROUP AS Variable [ Name=#1 ]
   (
     s:=Variable [ Name=$s ]
-    sample:=Variable [ Name=$sample ]
   )
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
index 4025ed0..24cafba 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
@@ -227,17 +227,7 @@ RecordConstructor [
     LiteralExpr [STRING] [numcust]
     :
     FunctionCall tpch.count@1[
-      (
-        SELECT ELEMENT [
-        FieldAccessor [
-          Variable [ Name=#2 ]
-          Field=ct
-        ]
-        ]
-        FROM [          Variable [ Name=#1 ]
-          AS Variable [ Name=#2 ]
-        ]
-      )
+      Variable [ Name=$ct ]
     ]
   )
   (
@@ -302,7 +292,6 @@ Groupby
   GROUP AS Variable [ Name=#1 ]
   (
     ct:=Variable [ Name=$ct ]
-    avg:=Variable [ Name=$avg ]
   )
 
 Orderby

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
index 31d5bbc..cf4c9c1 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
@@ -179,10 +179,9 @@ Let Variable [ Name=$X ]
       ]
       GROUP AS Variable [ Name=#1 ]
       (
-        orders:=Variable [ Name=$orders ]
-        customer:=Variable [ Name=$customer ]
         n:=Variable [ Name=$n ]
-        t:=Variable [ Name=$t ]
+        customer:=Variable [ Name=$customer ]
+        orders:=Variable [ Name=$orders ]
       )
 
     Let Variable [ Name=$sum ]
@@ -261,7 +260,5 @@ Groupby
   GROUP AS Variable [ Name=#2 ]
   (
     x:=Variable [ Name=$x ]
-    X:=Variable [ Name=$X ]
-    t:=Variable [ Name=$t ]
   )
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
index 7f7b2f3..b12ce2a 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
@@ -60,7 +60,9 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=$sim ]
+          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [sim]
+          ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -151,14 +153,8 @@ FROM [  FunctionCall Metadata.dataset@1[
               Variable [ Name=$token ]
               GROUP AS Variable [ Name=#1 ]
               (
-                token:=Variable [ Name=$token ]
                 paper:=Variable [ Name=$paper ]
-                tokenUnranked:=Variable [ Name=$tokenUnranked ]
-                lenLeft:=Variable [ Name=$lenLeft ]
-                prefixTokenRight:=Variable [ Name=$prefixTokenRight ]
-                paperRight:=Variable [ Name=$paperRight ]
-                prefixTokenLeft:=Variable [ Name=$prefixTokenLeft ]
-                paperLeft:=Variable [ Name=$paperLeft ]
+                token:=Variable [ Name=$token ]
               )
 
             Orderby
@@ -242,16 +238,8 @@ Variable [ Name=$i ]
               Variable [ Name=$token ]
               GROUP AS Variable [ Name=#3 ]
               (
-                token:=Variable [ Name=$token ]
                 paper:=Variable [ Name=$paper ]
-                tokenUnranked:=Variable [ Name=$tokenUnranked ]
-                lenRight:=Variable [ Name=$lenRight ]
-                tokensLeft:=Variable [ Name=$tokensLeft ]
-                lenLeft:=Variable [ Name=$lenLeft ]
-                prefixTokenRight:=Variable [ Name=$prefixTokenRight ]
-                paperRight:=Variable [ Name=$paperRight ]
-                prefixTokenLeft:=Variable [ Name=$prefixTokenLeft ]
-                paperLeft:=Variable [ Name=$paperLeft ]
+                token:=Variable [ Name=$token ]
               )
 
             Orderby
@@ -341,15 +329,10 @@ Variable [ Name=$i ]
       ]
       GROUP AS Variable [ Name=#5 ]
       (
-        sim:=Variable [ Name=$sim ]
-        tokensRight:=Variable [ Name=$tokensRight ]
-        lenRight:=Variable [ Name=$lenRight ]
-        tokensLeft:=Variable [ Name=$tokensLeft ]
-        lenLeft:=Variable [ Name=$lenLeft ]
-        prefixTokenRight:=Variable [ Name=$prefixTokenRight ]
-        paperRight:=Variable [ Name=$paperRight ]
-        prefixTokenLeft:=Variable [ Name=$prefixTokenLeft ]
         paperLeft:=Variable [ Name=$paperLeft ]
+        prefixTokenLeft:=Variable [ Name=$prefixTokenLeft ]
+        paperRight:=Variable [ Name=$paperRight ]
+        prefixTokenRight:=Variable [ Name=$prefixTokenRight ]
       )
 
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
index a57de72..a5cdcdf 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
@@ -52,9 +52,8 @@ Groupby
   ]
   GROUP AS Variable [ Name=#1 ]
   (
-    es:=Variable [ Name=$es ]
-    sponsor:=Variable [ Name=$sponsor ]
     event:=Variable [ Name=$event ]
+    sponsor:=Variable [ Name=$sponsor ]
   )
 
 Let Variable [ Name=$sig_sponsorship_count ]
@@ -62,9 +61,8 @@ Let Variable [ Name=$sig_sponsorship_count ]
   FunctionCall null.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#2 ]
-        Field=es
+      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [es]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
@@ -88,9 +86,8 @@ Let Variable [ Name=$by_chapter ]
         FunctionCall null.sql-count@1[
           (
             SELECT ELEMENT [
-            FieldAccessor [
-              Variable [ Name=#4 ]
-              Field=es
+            FunctionCall Metadata.dataset@1[
+              LiteralExpr [STRING] [es]
             ]
             ]
             FROM [              Variable [ Name=#3 ]
@@ -101,7 +98,9 @@ Let Variable [ Name=$by_chapter ]
       )
     ]
     ]
-    FROM [      Variable [ Name=$es ]
+    FROM [      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [es]
+      ]
       AS Variable [ Name=$e ]
     ]
     Groupby
@@ -117,12 +116,6 @@ Let Variable [ Name=$by_chapter ]
       GROUP AS Variable [ Name=#3 ]
       (
         e:=Variable [ Name=$e ]
-        sig_sponsorship_count:=Variable [ Name=$sig_sponsorship_count ]
-        es:=Variable [ Name=$es ]
-        event:=Variable [ Name=$event ]
-        sponsor:=Variable [ Name=$sponsor ]
-        sig_name:=Variable [ Name=$sig_name ]
-        #1:=Variable [ Name=#1 ]
       )
 
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast
index 14b5108..78d6362 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast
@@ -1,6 +1,18 @@
 Query:
 SELECT [
-Variable [ Name=$root ]
+FunctionCall null.SQRT@1[
+  OperatorExpr [
+    FieldAccessor [
+      Variable [ Name=$t ]
+      Field=a
+    ]
+    *
+    FieldAccessor [
+      Variable [ Name=$t ]
+      Field=b
+    ]
+  ]
+]
 root
 ]
 FROM [  FunctionCall Metadata.dataset@1[

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast
index cdd4653..056fe36 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast
@@ -4,7 +4,19 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [root]
     :
-    Variable [ Name=$root ]
+    FunctionCall null.SQRT@1[
+      OperatorExpr [
+        FieldAccessor [
+          Variable [ Name=$t ]
+          Field=a
+        ]
+        *
+        FieldAccessor [
+          Variable [ Name=$t ]
+          Field=b
+        ]
+      ]
+    ]
   )
 ]
 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
index f4fcf1f..9454ebc 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
@@ -52,9 +52,8 @@ Groupby
   ]
   GROUP AS Variable [ Name=#1 ]
   (
-    es:=Variable [ Name=$es ]
-    sponsor:=Variable [ Name=$sponsor ]
     event:=Variable [ Name=$event ]
+    sponsor:=Variable [ Name=$sponsor ]
   )
 
 Let Variable [ Name=$sig_sponsorship_count ]
@@ -62,9 +61,8 @@ Let Variable [ Name=$sig_sponsorship_count ]
   FunctionCall null.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#2 ]
-        Field=es
+      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [es]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
@@ -88,9 +86,8 @@ Let Variable [ Name=$by_chapter ]
         FunctionCall null.sql-count@1[
           (
             SELECT ELEMENT [
-            FieldAccessor [
-              Variable [ Name=#4 ]
-              Field=es
+            FunctionCall Metadata.dataset@1[
+              LiteralExpr [STRING] [es]
             ]
             ]
             FROM [              Variable [ Name=#3 ]
@@ -101,7 +98,9 @@ Let Variable [ Name=$by_chapter ]
       )
     ]
     ]
-    FROM [      Variable [ Name=$es ]
+    FROM [      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [es]
+      ]
       AS Variable [ Name=$e ]
     ]
     Groupby
@@ -117,12 +116,6 @@ Let Variable [ Name=$by_chapter ]
       GROUP AS Variable [ Name=#3 ]
       (
         e:=Variable [ Name=$e ]
-        sig_sponsorship_count:=Variable [ Name=$sig_sponsorship_count ]
-        es:=Variable [ Name=$es ]
-        event:=Variable [ Name=$event ]
-        sponsor:=Variable [ Name=$sponsor ]
-        sig_name:=Variable [ Name=$sig_name ]
-        #1:=Variable [ Name=#1 ]
       )
 
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.1.ddl.aql
new file mode 100644
index 0000000..ed74a09
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.1.ddl.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type account as open
+{ id: int32, sum:int32 }
+
+create dataset Accounts(account) primary key id;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.2.update.aql
new file mode 100644
index 0000000..477beec
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.2.update.aql
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use dataverse test;
+
+insert into dataset Accounts(
+{"id": 1, "sum":100}
+)
+insert into dataset Accounts(
+{"id": 2, "sum":150}
+)

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.3.query.aql
new file mode 100644
index 0000000..70954bd
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.3.query.aql
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse test;
+
+for $x in range(1,2)
+return(
+     let $z:=(for $y in dataset Accounts where $y.id=$x return $y)
+     return {"x":$x, "z":$z}
+)

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.1.ddl.sqlpp
new file mode 100644
index 0000000..99eae31
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.1.ddl.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+  street : string,
+  city : string,
+  zip : string,
+  latlong : point
+}
+
+create type test.EventType as
+ closed {
+  event_id : int64,
+  name : string,
+  location : AddressType?,
+  organizers : {{{
+          name : string
+      }
+}},
+  sponsoring_sigs : [{
+          sig_id : int64,
+          chapter_name : string
+      }
+],
+  interest_keywords : {{string}},
+  price : double?,
+  start_time : datetime,
+  end_time : datetime
+}
+
+create external  dataset Event(EventType) using localfs((`path`=`asterix_nc1://data/events/tiny/event.adm`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.2.update.sqlpp
new file mode 100644
index 0000000..bd244d0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.2.update.sqlpp
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.3.query.sqlpp
new file mode 100644
index 0000000..119f28b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-10/q2-10.3.query.sqlpp
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+USE test;
+
+// Tests references to a WITH binding variable in nested GROUP BY.
+WITH t AS 1
+
+SELECT sponsor.sig_id, COUNT(2 * t) total_count,
+       (
+         SELECT e.sponsor.chapter_name, COUNT(2 * t) AS escount
+         FROM es AS e
+         GROUP BY e.sponsor.chapter_name
+       ) chapter_breakdown
+FROM  Event,
+      Event.sponsoring_sigs AS sponsor
+GROUP BY sponsor.sig_id GROUP AS es
+ORDER BY total_count DESC
+LIMIT 5
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.1.ddl.sqlpp
new file mode 100644
index 0000000..99eae31
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.1.ddl.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+  street : string,
+  city : string,
+  zip : string,
+  latlong : point
+}
+
+create type test.EventType as
+ closed {
+  event_id : int64,
+  name : string,
+  location : AddressType?,
+  organizers : {{{
+          name : string
+      }
+}},
+  sponsoring_sigs : [{
+          sig_id : int64,
+          chapter_name : string
+      }
+],
+  interest_keywords : {{string}},
+  price : double?,
+  start_time : datetime,
+  end_time : datetime
+}
+
+create external  dataset Event(EventType) using localfs((`path`=`asterix_nc1://data/events/tiny/event.adm`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.2.update.sqlpp
new file mode 100644
index 0000000..bd244d0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.2.update.sqlpp
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.3.query.sqlpp
new file mode 100644
index 0000000..0b90993
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-11/q2-11.3.query.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+USE test;
+
+// Tests references to a WITH binding variable for a select query in nested GROUP BY.
+WITH t AS (
+   SELECT VALUE AVG(v)
+   FROM [1, 2, 3] v
+)[0]
+
+SELECT sponsor.sig_id, COUNT(2 * t) total_count,
+       (
+         SELECT e.sponsor.chapter_name, COUNT(2 * t) AS escount
+         FROM es AS e
+         GROUP BY e.sponsor.chapter_name
+       ) chapter_breakdown
+FROM  Event,
+      Event.sponsoring_sigs AS sponsor
+GROUP BY sponsor.sig_id GROUP AS es
+ORDER BY total_count DESC
+LIMIT 5
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.1.ddl.sqlpp
new file mode 100644
index 0000000..99eae31
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.1.ddl.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+  street : string,
+  city : string,
+  zip : string,
+  latlong : point
+}
+
+create type test.EventType as
+ closed {
+  event_id : int64,
+  name : string,
+  location : AddressType?,
+  organizers : {{{
+          name : string
+      }
+}},
+  sponsoring_sigs : [{
+          sig_id : int64,
+          chapter_name : string
+      }
+],
+  interest_keywords : {{string}},
+  price : double?,
+  start_time : datetime,
+  end_time : datetime
+}
+
+create external  dataset Event(EventType) using localfs((`path`=`asterix_nc1://data/events/tiny/event.adm`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.2.update.sqlpp
new file mode 100644
index 0000000..bd244d0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.2.update.sqlpp
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.3.query.sqlpp
new file mode 100644
index 0000000..5210ced
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-12/q2-12.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+USE test;
+
+// Tests references to an outer scope variable in a nested global aggregate.
+WITH t AS (
+   SELECT VALUE AVG(v)
+   FROM [1, 2, 3] v
+)[0]
+
+SELECT sponsor.sig_id, COUNT(2 * t) total_count,
+       (
+         SELECT sponsor.sig_id, COUNT(e)
+         FROM es AS e
+       ) chapter_breakdown
+FROM  Event,
+      Event.sponsoring_sigs AS sponsor
+GROUP BY sponsor.sig_id GROUP AS es
+ORDER BY total_count DESC
+LIMIT 5
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.1.ddl.sqlpp
new file mode 100644
index 0000000..99eae31
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.1.ddl.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.AddressType as
+ closed {
+  street : string,
+  city : string,
+  zip : string,
+  latlong : point
+}
+
+create type test.EventType as
+ closed {
+  event_id : int64,
+  name : string,
+  location : AddressType?,
+  organizers : {{{
+          name : string
+      }
+}},
+  sponsoring_sigs : [{
+          sig_id : int64,
+          chapter_name : string
+      }
+],
+  interest_keywords : {{string}},
+  price : double?,
+  start_time : datetime,
+  end_time : datetime
+}
+
+create external  dataset Event(EventType) using localfs((`path`=`asterix_nc1://data/events/tiny/event.adm`),(`format`=`adm`));
+


Mime
View raw message