asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [17/51] [partial] incubator-asterixdb git commit: ASTERIXDB-1226: implement SQL++ core group-by semantics and syntatic sugars.
Date Mon, 28 Mar 2016 20:18:44 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
index bf53a65..7f6a679 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
@@ -6,18 +6,18 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@ FROM [  (
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@ FROM [  (
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@ FROM [  (
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,300 +90,370 @@ FROM [  (
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedDBLP ]
+    Let Variable [ Name=$tokensUnrankedDBLP ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenDBLP ]
+    Let Variable [ Name=$lenDBLP ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedDBLP ]
+        FROM [          Variable [ Name=$tokensUnrankedDBLP ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedCSX ]
+    Let Variable [ Name=$tokensUnrankedCSX ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenCSX ]
+    Let Variable [ Name=$lenCSX ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedCSX ]
+        Variable [ Name=$tokensUnrankedCSX ]
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedCSX ]
+        FROM [          Variable [ Name=$tokensUnrankedCSX ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenCSX ]
-              Variable [ Name=tokensUnrankedCSX ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenCSX ]
+               AS lenCSX
+              Variable [ Name=$tokensUnrankedCSX ]
+               AS tokensUnrankedCSX
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenDBLP ]
-        Variable [ Name=tokensDBLP ]
-        Variable [ Name=lenCSX ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=lenCSX ]
-      Variable [ Name=tokensUnrankedCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=lenDBLP ]
-      Variable [ Name=tokensUnrankedDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$idCSX ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$lenCSX ]
+       AS lenCSX
+      Variable [ Name=$tokensUnrankedCSX ]
+       AS tokensUnrankedCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$lenDBLP ]
+       AS lenDBLP
+      Variable [ Name=$tokensUnrankedDBLP ]
+       AS tokensUnrankedDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
index bf53a65..7f6a679 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
@@ -6,18 +6,18 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@ FROM [  (
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@ FROM [  (
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@ FROM [  (
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,300 +90,370 @@ FROM [  (
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedDBLP ]
+    Let Variable [ Name=$tokensUnrankedDBLP ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenDBLP ]
+    Let Variable [ Name=$lenDBLP ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedDBLP ]
+        FROM [          Variable [ Name=$tokensUnrankedDBLP ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedCSX ]
+    Let Variable [ Name=$tokensUnrankedCSX ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenCSX ]
+    Let Variable [ Name=$lenCSX ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedCSX ]
+        Variable [ Name=$tokensUnrankedCSX ]
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedCSX ]
+        FROM [          Variable [ Name=$tokensUnrankedCSX ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGrouped ]
+            Variable [ Name=$tokenGrouped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenCSX ]
-              Variable [ Name=tokensUnrankedCSX ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenCSX ]
+               AS lenCSX
+              Variable [ Name=$tokensUnrankedCSX ]
+               AS tokensUnrankedCSX
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGrouped ]
+              Variable [ Name=$tokenGrouped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenDBLP ]
-        Variable [ Name=tokensDBLP ]
-        Variable [ Name=lenCSX ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=lenCSX ]
-      Variable [ Name=tokensUnrankedCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=lenDBLP ]
-      Variable [ Name=tokensUnrankedDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$idCSX ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$lenCSX ]
+       AS lenCSX
+      Variable [ Name=$tokensUnrankedCSX ]
+       AS tokensUnrankedCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$lenDBLP ]
+       AS lenDBLP
+      Variable [ Name=$tokensUnrankedDBLP ]
+       AS tokensUnrankedDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
index 7ca0193..4838a20 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
@@ -6,18 +6,18 @@ RecordConstructor [
   (
     LiteralExpr [STRING] [dblp]
     :
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
       Field=sim
     ]
   )
@@ -29,18 +29,18 @@ FROM [  (
       (
         LiteralExpr [STRING] [idDBLP]
         :
-        Variable [ Name=idDBLP ]
+        Variable [ Name=$idDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
-        Variable [ Name=idCSX ]
+        Variable [ Name=$idCSX ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -50,7 +50,7 @@ FROM [  (
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -67,13 +67,13 @@ FROM [  (
         ]
       ]
       AS
-      Variable [ Name=prefixTokenDBLP ]
+      Variable [ Name=$prefixTokenDBLP ]
 ,
       FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [CSX]
       ]
       AS
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
         FunctionCall Metadata.dataset@1[
@@ -90,303 +90,373 @@ FROM [  (
         ]
       ]
       AS
-      Variable [ Name=prefixTokenCSX ]
+      Variable [ Name=$prefixTokenCSX ]
     ]
-    LetVariable [ Name=idDBLP ]
+    Let Variable [ Name=$idDBLP ]
       :=
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedDBLP ]
+    Let Variable [ Name=$tokensUnrankedDBLP ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenDBLP ]
+    Let Variable [ Name=$lenDBLP ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
       ]
-    LetVariable [ Name=tokensDBLP ]
+    Let Variable [ Name=$tokensDBLP ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedDBLP ]
+        FROM [          Variable [ Name=$tokensUnrankedDBLP ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#1 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#2 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#1 ]
+                    AS
+                    Variable [ Name=#2 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=idCSX ]
+    Let Variable [ Name=$idCSX ]
       :=
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
-    LetVariable [ Name=tokensUnrankedCSX ]
+    Let Variable [ Name=$tokensUnrankedCSX ]
       :=
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
-    LetVariable [ Name=lenCSX ]
+    Let Variable [ Name=$lenCSX ]
       :=
       FunctionCall fuzzyjoin.len@1[
-        Variable [ Name=tokensUnrankedCSX ]
+        Variable [ Name=$tokensUnrankedCSX ]
       ]
-    LetVariable [ Name=tokensCSX ]
+    Let Variable [ Name=$tokensCSX ]
       :=
       (
         SELECT ELEMENT [
-        Variable [ Name=i ]
+        Variable [ Name=$i ]
         ]
-        FROM [          Variable [ Name=tokensUnrankedCSX ]
+        FROM [          Variable [ Name=$tokensUnrankedCSX ]
           AS
-          Variable [ Name=tokenUnranked ]
+          Variable [ Name=$tokenUnranked ]
 ,
           (
             SELECT ELEMENT [
-            Variable [ Name=tokenGroupped ]
+            Variable [ Name=$tokenGroupped ]
             ]
             FROM [              FunctionCall Metadata.dataset@1[
                 LiteralExpr [STRING] [DBLP]
               ]
               AS
-              Variable [ Name=paper ]
+              Variable [ Name=$paper ]
 ,
               FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                 FieldAccessor [
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
                   Field=title
                 ]
               ]
               AS
-              Variable [ Name=token ]
+              Variable [ Name=$token ]
             ]
-            LetVariable [ Name=id ]
+            Let Variable [ Name=$id ]
               :=
               FieldAccessor [
-                Variable [ Name=paper ]
+                Variable [ Name=$paper ]
                 Field=id
               ]
             Groupby
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               :=
-              Variable [ Name=token ]
-              With
-              Variable [ Name=id ]
-              Variable [ Name=paper ]
-              Variable [ Name=token ]
-              Variable [ Name=tokenUnranked ]
-              Variable [ Name=lenCSX ]
-              Variable [ Name=tokensUnrankedCSX ]
-              Variable [ Name=idCSX ]
-              Variable [ Name=tokensDBLP ]
-              Variable [ Name=lenDBLP ]
-              Variable [ Name=tokensUnrankedDBLP ]
-              Variable [ Name=idDBLP ]
-              Variable [ Name=paperDBLP ]
-              Variable [ Name=prefixTokenDBLP ]
-              Variable [ Name=prefixTokenCSX ]
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$token ]
+              GROUP AS
+              Variable [ Name=#3 ]
+              (
+              Variable [ Name=$id ]
+               AS id
+              Variable [ Name=$token ]
+               AS token
+              Variable [ Name=$paper ]
+               AS paper
+              Variable [ Name=$tokenUnranked ]
+               AS tokenUnranked
+              Variable [ Name=$lenCSX ]
+               AS lenCSX
+              Variable [ Name=$tokensUnrankedCSX ]
+               AS tokensUnrankedCSX
+              Variable [ Name=$idCSX ]
+               AS idCSX
+              Variable [ Name=$tokensDBLP ]
+               AS tokensDBLP
+              Variable [ Name=$lenDBLP ]
+               AS lenDBLP
+              Variable [ Name=$tokensUnrankedDBLP ]
+               AS tokensUnrankedDBLP
+              Variable [ Name=$idDBLP ]
+               AS idDBLP
+              Variable [ Name=$prefixTokenCSX ]
+               AS prefixTokenCSX
+              Variable [ Name=$paperCSX ]
+               AS paperCSX
+              Variable [ Name=$prefixTokenDBLP ]
+               AS prefixTokenDBLP
+              Variable [ Name=$paperDBLP ]
+               AS paperDBLP
+              )
 
             Orderby
               FunctionCall fuzzyjoin.count@1[
-                Variable [ Name=id ]
+                (
+                  SELECT ELEMENT [
+                  FieldAccessor [
+                    Variable [ Name=#4 ]
+                    Field=id
+                  ]
+                  ]
+                  FROM [                    Variable [ Name=#3 ]
+                    AS
+                    Variable [ Name=#4 ]
+                  ]
+                )
               ]
               ASC
-              Variable [ Name=tokenGroupped ]
+              Variable [ Name=$tokenGroupped ]
               ASC
 
           )
           AS
-          Variable [ Name=tokenRanked ]
+          Variable [ Name=$tokenRanked ]
           AT
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
         ]
         Where
           OperatorExpr [
-            Variable [ Name=tokenUnranked ]
+            Variable [ Name=$tokenUnranked ]
             =
-            Variable [ Name=tokenRanked ]
+            Variable [ Name=$tokenRanked ]
           ]
         Orderby
-          Variable [ Name=i ]
+          Variable [ Name=$i ]
           ASC
 
       )
-    LetVariable [ Name=sim ]
+    Let Variable [ Name=$sim ]
       :=
       FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-        Variable [ Name=lenDBLP ]
-        Variable [ Name=tokensDBLP ]
-        Variable [ Name=lenCSX ]
-        Variable [ Name=tokensCSX ]
-        Variable [ Name=prefixTokenDBLP ]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
         LiteralExpr [FLOAT] [0.5]
       ]
     Where
       OperatorExpr [
         OperatorExpr [
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
           =
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
         and
         OperatorExpr [
-          Variable [ Name=sim ]
+          Variable [ Name=$sim ]
           >=
           LiteralExpr [FLOAT] [0.5]
         ]
       ]
     Groupby
-      Variable [ Name=idDBLP ]
+      Variable [ Name=$idDBLP ]
       :=
-      Variable [ Name=idDBLP ]
-      Variable [ Name=idCSX ]
+      Variable [ Name=$idDBLP ]
+      Variable [ Name=$idCSX ]
       :=
-      Variable [ Name=idCSX ]
-      Variable [ Name=sim ]
+      Variable [ Name=$idCSX ]
+      Variable [ Name=$sim ]
       :=
-      Variable [ Name=sim ]
-      With
-      Variable [ Name=sim ]
-      Variable [ Name=tokensCSX ]
-      Variable [ Name=lenCSX ]
-      Variable [ Name=tokensUnrankedCSX ]
-      Variable [ Name=idCSX ]
-      Variable [ Name=tokensDBLP ]
-      Variable [ Name=lenDBLP ]
-      Variable [ Name=tokensUnrankedDBLP ]
-      Variable [ Name=idDBLP ]
-      Variable [ Name=paperDBLP ]
-      Variable [ Name=prefixTokenDBLP ]
-      Variable [ Name=prefixTokenCSX ]
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$sim ]
+      GROUP AS
+      Variable [ Name=#5 ]
+      (
+      Variable [ Name=$sim ]
+       AS sim
+      Variable [ Name=$tokensCSX ]
+       AS tokensCSX
+      Variable [ Name=$lenCSX ]
+       AS lenCSX
+      Variable [ Name=$tokensUnrankedCSX ]
+       AS tokensUnrankedCSX
+      Variable [ Name=$idCSX ]
+       AS idCSX
+      Variable [ Name=$tokensDBLP ]
+       AS tokensDBLP
+      Variable [ Name=$lenDBLP ]
+       AS lenDBLP
+      Variable [ Name=$tokensUnrankedDBLP ]
+       AS tokensUnrankedDBLP
+      Variable [ Name=$idDBLP ]
+       AS idDBLP
+      Variable [ Name=$prefixTokenCSX ]
+       AS prefixTokenCSX
+      Variable [ Name=$paperCSX ]
+       AS paperCSX
+      Variable [ Name=$prefixTokenDBLP ]
+       AS prefixTokenDBLP
+      Variable [ Name=$paperDBLP ]
+       AS paperDBLP
+      )
 
   )
   AS
-  Variable [ Name=ridpair ]
+  Variable [ Name=$ridpair ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [DBLP]
   ]
   AS
-  Variable [ Name=paperDBLP ]
+  Variable [ Name=$paperDBLP ]
 ,
   FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ]
 Where
   OperatorExpr [
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idDBLP
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
         Field=id
       ]
     ]
     and
     OperatorExpr [
       FieldAccessor [
-        Variable [ Name=ridpair ]
+        Variable [ Name=$ridpair ]
         Field=idCSX
       ]
       =
       FieldAccessor [
-        Variable [ Name=paperCSX ]
+        Variable [ Name=$paperCSX ]
         Field=id
       ]
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLP ]
+    Variable [ Name=$paperDBLP ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
     Field=id
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
index d778b00..3f963eb 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
@@ -7,20 +7,20 @@ RecordConstructor [
     LiteralExpr [STRING] [dblp]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=paperDBLP
     ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=sim
     ]
   )
@@ -30,7 +30,7 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   (
     SELECT ELEMENT [
@@ -39,7 +39,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [idDBLP]
         :
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=id
         ]
       )
@@ -47,20 +47,20 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [idCSX]
         :
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=idCSX
         ]
       )
       (
         LiteralExpr [STRING] [paperDBLP]
         :
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
       )
       (
         LiteralExpr [STRING] [sim]
         :
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=sim
         ]
       )
@@ -70,7 +70,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       (
         SELECT ELEMENT [
@@ -78,18 +78,18 @@ FROM [  FunctionCall Metadata.dataset@1[
           (
             LiteralExpr [STRING] [idDBLP]
             :
-            Variable [ Name=idDBLP ]
+            Variable [ Name=$idDBLP ]
           )
           (
             LiteralExpr [STRING] [idCSX]
             :
-            Variable [ Name=idCSX ]
+            Variable [ Name=$idCSX ]
           )
           (
             LiteralExpr [STRING] [sim]
             :
             IndexAccessor [
-              Variable [ Name=sim ]
+              Variable [ Name=$sim ]
               Index:               LiteralExpr [LONG] [0]
             ]
           )
@@ -99,7 +99,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
             FunctionCall Metadata.dataset@1[
@@ -116,13 +116,13 @@ FROM [  FunctionCall Metadata.dataset@1[
             ]
           ]
           AS
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [CSX]
           ]
           AS
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
             FunctionCall Metadata.dataset@1[
@@ -139,290 +139,360 @@ FROM [  FunctionCall Metadata.dataset@1[
             ]
           ]
           AS
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
-        LetVariable [ Name=idDBLP ]
+        Let Variable [ Name=$idDBLP ]
           :=
           FieldAccessor [
-            Variable [ Name=paperDBLP ]
+            Variable [ Name=$paperDBLP ]
             Field=id
           ]
-        LetVariable [ Name=tokensUnrankedDBLP ]
+        Let Variable [ Name=$tokensUnrankedDBLP ]
           :=
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
-        LetVariable [ Name=lenDBLP ]
+        Let Variable [ Name=$lenDBLP ]
           :=
           FunctionCall fuzzyjoin.len@1[
-            Variable [ Name=tokensUnrankedDBLP ]
+            Variable [ Name=$tokensUnrankedDBLP ]
           ]
-        LetVariable [ Name=tokensDBLP ]
+        Let Variable [ Name=$tokensDBLP ]
           :=
           (
             SELECT ELEMENT [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             ]
-            FROM [              Variable [ Name=tokensUnrankedDBLP ]
+            FROM [              Variable [ Name=$tokensUnrankedDBLP ]
               AS
-              Variable [ Name=tokenUnranked ]
+              Variable [ Name=$tokenUnranked ]
 ,
               (
                 SELECT ELEMENT [
-                Variable [ Name=tokenGrouped ]
+                Variable [ Name=$tokenGrouped ]
                 ]
                 FROM [                  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [DBLP]
                   ]
                   AS
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
 ,
                   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                     FieldAccessor [
-                      Variable [ Name=paper ]
+                      Variable [ Name=$paper ]
                       Field=title
                     ]
                   ]
                   AS
-                  Variable [ Name=token ]
+                  Variable [ Name=$token ]
                 ]
-                LetVariable [ Name=id ]
+                Let Variable [ Name=$id ]
                   :=
                   FieldAccessor [
-                    Variable [ Name=paper ]
+                    Variable [ Name=$paper ]
                     Field=id
                   ]
                 Groupby
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   :=
-                  Variable [ Name=token ]
-                  With
-                  Variable [ Name=id ]
-                  Variable [ Name=paper ]
-                  Variable [ Name=token ]
-                  Variable [ Name=tokenUnranked ]
-                  Variable [ Name=lenDBLP ]
-                  Variable [ Name=tokensUnrankedDBLP ]
-                  Variable [ Name=idDBLP ]
-                  Variable [ Name=paperDBLP ]
-                  Variable [ Name=prefixTokenDBLP ]
-                  Variable [ Name=prefixTokenCSX ]
-                  Variable [ Name=paperCSX ]
+                  Variable [ Name=$token ]
+                  GROUP AS
+                  Variable [ Name=#1 ]
+                  (
+                  Variable [ Name=$id ]
+                   AS id
+                  Variable [ Name=$token ]
+                   AS token
+                  Variable [ Name=$paper ]
+                   AS paper
+                  Variable [ Name=$tokenUnranked ]
+                   AS tokenUnranked
+                  Variable [ Name=$lenDBLP ]
+                   AS lenDBLP
+                  Variable [ Name=$tokensUnrankedDBLP ]
+                   AS tokensUnrankedDBLP
+                  Variable [ Name=$idDBLP ]
+                   AS idDBLP
+                  Variable [ Name=$prefixTokenCSX ]
+                   AS prefixTokenCSX
+                  Variable [ Name=$paperCSX ]
+                   AS paperCSX
+                  Variable [ Name=$prefixTokenDBLP ]
+                   AS prefixTokenDBLP
+                  Variable [ Name=$paperDBLP ]
+                   AS paperDBLP
+                  )
 
                 Orderby
                   FunctionCall fuzzyjoin.count@1[
-                    Variable [ Name=id ]
+                    (
+                      SELECT ELEMENT [
+                      FieldAccessor [
+                        Variable [ Name=#2 ]
+                        Field=id
+                      ]
+                      ]
+                      FROM [                        Variable [ Name=#1 ]
+                        AS
+                        Variable [ Name=#2 ]
+                      ]
+                    )
                   ]
                   ASC
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   ASC
 
               )
               AS
-              Variable [ Name=tokenRanked ]
+              Variable [ Name=$tokenRanked ]
               AT
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
             Where
               OperatorExpr [
-                Variable [ Name=tokenUnranked ]
+                Variable [ Name=$tokenUnranked ]
                 =
-                Variable [ Name=tokenRanked ]
+                Variable [ Name=$tokenRanked ]
               ]
             Orderby
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               ASC
 
           )
-        LetVariable [ Name=idCSX ]
+        Let Variable [ Name=$idCSX ]
           :=
           FieldAccessor [
-            Variable [ Name=paperCSX ]
+            Variable [ Name=$paperCSX ]
             Field=id
           ]
-        LetVariable [ Name=tokensUnrankedCSX ]
+        Let Variable [ Name=$tokensUnrankedCSX ]
           :=
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
-        LetVariable [ Name=lenCSX ]
+        Let Variable [ Name=$lenCSX ]
           :=
           FunctionCall fuzzyjoin.len@1[
-            Variable [ Name=tokensUnrankedCSX ]
+            Variable [ Name=$tokensUnrankedCSX ]
           ]
-        LetVariable [ Name=tokensCSX ]
+        Let Variable [ Name=$tokensCSX ]
           :=
           (
             SELECT ELEMENT [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             ]
-            FROM [              Variable [ Name=tokensUnrankedCSX ]
+            FROM [              Variable [ Name=$tokensUnrankedCSX ]
               AS
-              Variable [ Name=tokenUnranked ]
+              Variable [ Name=$tokenUnranked ]
 ,
               (
                 SELECT ELEMENT [
-                Variable [ Name=tokenGrouped ]
+                Variable [ Name=$tokenGrouped ]
                 ]
                 FROM [                  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [DBLP]
                   ]
                   AS
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
 ,
                   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                     FieldAccessor [
-                      Variable [ Name=paper ]
+                      Variable [ Name=$paper ]
                       Field=title
                     ]
                   ]
                   AS
-                  Variable [ Name=token ]
+                  Variable [ Name=$token ]
                 ]
-                LetVariable [ Name=id ]
+                Let Variable [ Name=$id ]
                   :=
                   FieldAccessor [
-                    Variable [ Name=paper ]
+                    Variable [ Name=$paper ]
                     Field=id
                   ]
                 Groupby
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   :=
-                  Variable [ Name=token ]
-                  With
-                  Variable [ Name=id ]
-                  Variable [ Name=paper ]
-                  Variable [ Name=token ]
-                  Variable [ Name=tokenUnranked ]
-                  Variable [ Name=lenCSX ]
-                  Variable [ Name=tokensUnrankedCSX ]
-                  Variable [ Name=idCSX ]
-                  Variable [ Name=tokensDBLP ]
-                  Variable [ Name=lenDBLP ]
-                  Variable [ Name=tokensUnrankedDBLP ]
-                  Variable [ Name=idDBLP ]
-                  Variable [ Name=paperDBLP ]
-                  Variable [ Name=prefixTokenDBLP ]
-                  Variable [ Name=prefixTokenCSX ]
-                  Variable [ Name=paperCSX ]
+                  Variable [ Name=$token ]
+                  GROUP AS
+                  Variable [ Name=#3 ]
+                  (
+                  Variable [ Name=$id ]
+                   AS id
+                  Variable [ Name=$token ]
+                   AS token
+                  Variable [ Name=$paper ]
+                   AS paper
+                  Variable [ Name=$tokenUnranked ]
+                   AS tokenUnranked
+                  Variable [ Name=$lenCSX ]
+                   AS lenCSX
+                  Variable [ Name=$tokensUnrankedCSX ]
+                   AS tokensUnrankedCSX
+                  Variable [ Name=$idCSX ]
+                   AS idCSX
+                  Variable [ Name=$tokensDBLP ]
+                   AS tokensDBLP
+                  Variable [ Name=$lenDBLP ]
+                   AS lenDBLP
+                  Variable [ Name=$tokensUnrankedDBLP ]
+                   AS tokensUnrankedDBLP
+                  Variable [ Name=$idDBLP ]
+                   AS idDBLP
+                  Variable [ Name=$prefixTokenCSX ]
+                   AS prefixTokenCSX
+                  Variable [ Name=$paperCSX ]
+                   AS paperCSX
+                  Variable [ Name=$prefixTokenDBLP ]
+                   AS prefixTokenDBLP
+                  Variable [ Name=$paperDBLP ]
+                   AS paperDBLP
+                  )
 
                 Orderby
                   FunctionCall fuzzyjoin.count@1[
-                    Variable [ Name=id ]
+                    (
+                      SELECT ELEMENT [
+                      FieldAccessor [
+                        Variable [ Name=#4 ]
+                        Field=id
+                      ]
+                      ]
+                      FROM [                        Variable [ Name=#3 ]
+                        AS
+                        Variable [ Name=#4 ]
+                      ]
+                    )
                   ]
                   ASC
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   ASC
 
               )
               AS
-              Variable [ Name=tokenRanked ]
+              Variable [ Name=$tokenRanked ]
               AT
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
             Where
               OperatorExpr [
-                Variable [ Name=tokenUnranked ]
+                Variable [ Name=$tokenUnranked ]
                 =
-                Variable [ Name=tokenRanked ]
+                Variable [ Name=$tokenRanked ]
               ]
             Orderby
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               ASC
 
           )
-        LetVariable [ Name=sim ]
+        Let Variable [ Name=$sim ]
           :=
           FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-            Variable [ Name=lenDBLP ]
-            Variable [ Name=tokensDBLP ]
-            Variable [ Name=lenCSX ]
-            Variable [ Name=tokensCSX ]
-            Variable [ Name=prefixTokenDBLP ]
+            Variable [ Name=$lenDBLP ]
+            Variable [ Name=$tokensDBLP ]
+            Variable [ Name=$lenCSX ]
+            Variable [ Name=$tokensCSX ]
+            Variable [ Name=$prefixTokenDBLP ]
             LiteralExpr [FLOAT] [0.5]
           ]
         Where
           OperatorExpr [
             OperatorExpr [
-              Variable [ Name=prefixTokenDBLP ]
+              Variable [ Name=$prefixTokenDBLP ]
               =
-              Variable [ Name=prefixTokenCSX ]
+              Variable [ Name=$prefixTokenCSX ]
             ]
             and
             OperatorExpr [
-              Variable [ Name=sim ]
+              Variable [ Name=$sim ]
               >=
               LiteralExpr [FLOAT] [0.5]
             ]
           ]
         Groupby
-          Variable [ Name=idDBLP ]
+          Variable [ Name=$idDBLP ]
           :=
-          Variable [ Name=idDBLP ]
-          Variable [ Name=idCSX ]
+          Variable [ Name=$idDBLP ]
+          Variable [ Name=$idCSX ]
           :=
-          Variable [ Name=idCSX ]
-          With
-          Variable [ Name=sim ]
-          Variable [ Name=tokensCSX ]
-          Variable [ Name=lenCSX ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$idCSX ]
+          GROUP AS
+          Variable [ Name=#5 ]
+          (
+          Variable [ Name=$sim ]
+           AS sim
+          Variable [ Name=$tokensCSX ]
+           AS tokensCSX
+          Variable [ Name=$lenCSX ]
+           AS lenCSX
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
       )
       AS
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=idDBLP
         ]
         =
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=id
         ]
       ]
   )
   AS
-  Variable [ Name=paperDBLPridpair ]
+  Variable [ Name=$paperDBLPridpair ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=idCSX
     ]
     =
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
-    Variable [ Name=paperDBLPridpair ]
+    Variable [ Name=$paperDBLPridpair ]
     Field=idDBLP
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperDBLPridpair ]
+    Variable [ Name=$paperDBLPridpair ]
     Field=idCSX
   ]
   ASC

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
index b94b776..a9c8ad6 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
@@ -7,20 +7,20 @@ RecordConstructor [
     LiteralExpr [STRING] [dblp]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=paperDBLP
     ]
   )
   (
     LiteralExpr [STRING] [csx]
     :
-    Variable [ Name=paperCSX ]
+    Variable [ Name=$paperCSX ]
   )
   (
     LiteralExpr [STRING] [sim]
     :
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=sim
     ]
   )
@@ -30,7 +30,7 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [CSX]
   ]
   AS
-  Variable [ Name=paperCSX ]
+  Variable [ Name=$paperCSX ]
 ,
   (
     SELECT ELEMENT [
@@ -39,20 +39,20 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [idDBLP]
         :
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=id
         ]
       )
       (
         LiteralExpr [STRING] [paperDBLP]
         :
-        Variable [ Name=paperDBLP ]
+        Variable [ Name=$paperDBLP ]
       )
       (
         LiteralExpr [STRING] [idCSX]
         :
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=idCSX
         ]
       )
@@ -60,7 +60,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [sim]
         :
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=sim
         ]
       )
@@ -70,7 +70,7 @@ FROM [  FunctionCall Metadata.dataset@1[
         LiteralExpr [STRING] [DBLP]
       ]
       AS
-      Variable [ Name=paperDBLP ]
+      Variable [ Name=$paperDBLP ]
 ,
       (
         SELECT ELEMENT [
@@ -78,18 +78,18 @@ FROM [  FunctionCall Metadata.dataset@1[
           (
             LiteralExpr [STRING] [idDBLP]
             :
-            Variable [ Name=idDBLP ]
+            Variable [ Name=$idDBLP ]
           )
           (
             LiteralExpr [STRING] [idCSX]
             :
-            Variable [ Name=idCSX ]
+            Variable [ Name=$idCSX ]
           )
           (
             LiteralExpr [STRING] [sim]
             :
             IndexAccessor [
-              Variable [ Name=sim ]
+              Variable [ Name=$sim ]
               Index:               LiteralExpr [LONG] [0]
             ]
           )
@@ -99,7 +99,7 @@ FROM [  FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [DBLP]
           ]
           AS
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
             FunctionCall Metadata.dataset@1[
@@ -116,13 +116,13 @@ FROM [  FunctionCall Metadata.dataset@1[
             ]
           ]
           AS
-          Variable [ Name=prefixTokenDBLP ]
+          Variable [ Name=$prefixTokenDBLP ]
 ,
           FunctionCall Metadata.dataset@1[
             LiteralExpr [STRING] [CSX]
           ]
           AS
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
             FunctionCall Metadata.dataset@1[
@@ -139,293 +139,363 @@ FROM [  FunctionCall Metadata.dataset@1[
             ]
           ]
           AS
-          Variable [ Name=prefixTokenCSX ]
+          Variable [ Name=$prefixTokenCSX ]
         ]
-        LetVariable [ Name=idDBLP ]
+        Let Variable [ Name=$idDBLP ]
           :=
           FieldAccessor [
-            Variable [ Name=paperDBLP ]
+            Variable [ Name=$paperDBLP ]
             Field=id
           ]
-        LetVariable [ Name=tokensUnrankedDBLP ]
+        Let Variable [ Name=$tokensUnrankedDBLP ]
           :=
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperDBLP ]
+              Variable [ Name=$paperDBLP ]
               Field=title
             ]
           ]
-        LetVariable [ Name=lenDBLP ]
+        Let Variable [ Name=$lenDBLP ]
           :=
           FunctionCall fuzzyjoin.len@1[
-            Variable [ Name=tokensUnrankedDBLP ]
+            Variable [ Name=$tokensUnrankedDBLP ]
           ]
-        LetVariable [ Name=tokensDBLP ]
+        Let Variable [ Name=$tokensDBLP ]
           :=
           (
             SELECT ELEMENT [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             ]
-            FROM [              Variable [ Name=tokensUnrankedDBLP ]
+            FROM [              Variable [ Name=$tokensUnrankedDBLP ]
               AS
-              Variable [ Name=tokenUnranked ]
+              Variable [ Name=$tokenUnranked ]
 ,
               (
                 SELECT ELEMENT [
-                Variable [ Name=tokenGrouped ]
+                Variable [ Name=$tokenGrouped ]
                 ]
                 FROM [                  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [DBLP]
                   ]
                   AS
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
 ,
                   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                     FieldAccessor [
-                      Variable [ Name=paper ]
+                      Variable [ Name=$paper ]
                       Field=title
                     ]
                   ]
                   AS
-                  Variable [ Name=token ]
+                  Variable [ Name=$token ]
                 ]
-                LetVariable [ Name=id ]
+                Let Variable [ Name=$id ]
                   :=
                   FieldAccessor [
-                    Variable [ Name=paper ]
+                    Variable [ Name=$paper ]
                     Field=id
                   ]
                 Groupby
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   :=
-                  Variable [ Name=token ]
-                  With
-                  Variable [ Name=id ]
-                  Variable [ Name=paper ]
-                  Variable [ Name=token ]
-                  Variable [ Name=tokenUnranked ]
-                  Variable [ Name=lenDBLP ]
-                  Variable [ Name=tokensUnrankedDBLP ]
-                  Variable [ Name=idDBLP ]
-                  Variable [ Name=paperDBLP ]
-                  Variable [ Name=prefixTokenDBLP ]
-                  Variable [ Name=prefixTokenCSX ]
-                  Variable [ Name=paperCSX ]
+                  Variable [ Name=$token ]
+                  GROUP AS
+                  Variable [ Name=#1 ]
+                  (
+                  Variable [ Name=$id ]
+                   AS id
+                  Variable [ Name=$token ]
+                   AS token
+                  Variable [ Name=$paper ]
+                   AS paper
+                  Variable [ Name=$tokenUnranked ]
+                   AS tokenUnranked
+                  Variable [ Name=$lenDBLP ]
+                   AS lenDBLP
+                  Variable [ Name=$tokensUnrankedDBLP ]
+                   AS tokensUnrankedDBLP
+                  Variable [ Name=$idDBLP ]
+                   AS idDBLP
+                  Variable [ Name=$prefixTokenCSX ]
+                   AS prefixTokenCSX
+                  Variable [ Name=$paperCSX ]
+                   AS paperCSX
+                  Variable [ Name=$prefixTokenDBLP ]
+                   AS prefixTokenDBLP
+                  Variable [ Name=$paperDBLP ]
+                   AS paperDBLP
+                  )
 
                 Orderby
                   FunctionCall fuzzyjoin.count@1[
-                    Variable [ Name=id ]
+                    (
+                      SELECT ELEMENT [
+                      FieldAccessor [
+                        Variable [ Name=#2 ]
+                        Field=id
+                      ]
+                      ]
+                      FROM [                        Variable [ Name=#1 ]
+                        AS
+                        Variable [ Name=#2 ]
+                      ]
+                    )
                   ]
                   ASC
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   ASC
 
               )
               AS
-              Variable [ Name=tokenRanked ]
+              Variable [ Name=$tokenRanked ]
               AT
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
             Where
               OperatorExpr [
-                Variable [ Name=tokenUnranked ]
+                Variable [ Name=$tokenUnranked ]
                 =
-                Variable [ Name=tokenRanked ]
+                Variable [ Name=$tokenRanked ]
               ]
             Orderby
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               ASC
 
           )
-        LetVariable [ Name=idCSX ]
+        Let Variable [ Name=$idCSX ]
           :=
           FieldAccessor [
-            Variable [ Name=paperCSX ]
+            Variable [ Name=$paperCSX ]
             Field=id
           ]
-        LetVariable [ Name=tokensUnrankedCSX ]
+        Let Variable [ Name=$tokensUnrankedCSX ]
           :=
           FunctionCall fuzzyjoin.counthashed-word-tokens@1[
             FieldAccessor [
-              Variable [ Name=paperCSX ]
+              Variable [ Name=$paperCSX ]
               Field=title
             ]
           ]
-        LetVariable [ Name=lenCSX ]
+        Let Variable [ Name=$lenCSX ]
           :=
           FunctionCall fuzzyjoin.len@1[
-            Variable [ Name=tokensUnrankedCSX ]
+            Variable [ Name=$tokensUnrankedCSX ]
           ]
-        LetVariable [ Name=tokensCSX ]
+        Let Variable [ Name=$tokensCSX ]
           :=
           (
             SELECT ELEMENT [
-            Variable [ Name=i ]
+            Variable [ Name=$i ]
             ]
-            FROM [              Variable [ Name=tokensUnrankedCSX ]
+            FROM [              Variable [ Name=$tokensUnrankedCSX ]
               AS
-              Variable [ Name=tokenUnranked ]
+              Variable [ Name=$tokenUnranked ]
 ,
               (
                 SELECT ELEMENT [
-                Variable [ Name=tokenGrouped ]
+                Variable [ Name=$tokenGrouped ]
                 ]
                 FROM [                  FunctionCall Metadata.dataset@1[
                     LiteralExpr [STRING] [DBLP]
                   ]
                   AS
-                  Variable [ Name=paper ]
+                  Variable [ Name=$paper ]
 ,
                   FunctionCall fuzzyjoin.counthashed-word-tokens@1[
                     FieldAccessor [
-                      Variable [ Name=paper ]
+                      Variable [ Name=$paper ]
                       Field=title
                     ]
                   ]
                   AS
-                  Variable [ Name=token ]
+                  Variable [ Name=$token ]
                 ]
-                LetVariable [ Name=id ]
+                Let Variable [ Name=$id ]
                   :=
                   FieldAccessor [
-                    Variable [ Name=paper ]
+                    Variable [ Name=$paper ]
                     Field=id
                   ]
                 Groupby
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   :=
-                  Variable [ Name=token ]
-                  With
-                  Variable [ Name=id ]
-                  Variable [ Name=paper ]
-                  Variable [ Name=token ]
-                  Variable [ Name=tokenUnranked ]
-                  Variable [ Name=lenCSX ]
-                  Variable [ Name=tokensUnrankedCSX ]
-                  Variable [ Name=idCSX ]
-                  Variable [ Name=tokensDBLP ]
-                  Variable [ Name=lenDBLP ]
-                  Variable [ Name=tokensUnrankedDBLP ]
-                  Variable [ Name=idDBLP ]
-                  Variable [ Name=paperDBLP ]
-                  Variable [ Name=prefixTokenDBLP ]
-                  Variable [ Name=prefixTokenCSX ]
-                  Variable [ Name=paperCSX ]
+                  Variable [ Name=$token ]
+                  GROUP AS
+                  Variable [ Name=#3 ]
+                  (
+                  Variable [ Name=$id ]
+                   AS id
+                  Variable [ Name=$token ]
+                   AS token
+                  Variable [ Name=$paper ]
+                   AS paper
+                  Variable [ Name=$tokenUnranked ]
+                   AS tokenUnranked
+                  Variable [ Name=$lenCSX ]
+                   AS lenCSX
+                  Variable [ Name=$tokensUnrankedCSX ]
+                   AS tokensUnrankedCSX
+                  Variable [ Name=$idCSX ]
+                   AS idCSX
+                  Variable [ Name=$tokensDBLP ]
+                   AS tokensDBLP
+                  Variable [ Name=$lenDBLP ]
+                   AS lenDBLP
+                  Variable [ Name=$tokensUnrankedDBLP ]
+                   AS tokensUnrankedDBLP
+                  Variable [ Name=$idDBLP ]
+                   AS idDBLP
+                  Variable [ Name=$prefixTokenCSX ]
+                   AS prefixTokenCSX
+                  Variable [ Name=$paperCSX ]
+                   AS paperCSX
+                  Variable [ Name=$prefixTokenDBLP ]
+                   AS prefixTokenDBLP
+                  Variable [ Name=$paperDBLP ]
+                   AS paperDBLP
+                  )
 
                 Orderby
                   FunctionCall fuzzyjoin.count@1[
-                    Variable [ Name=id ]
+                    (
+                      SELECT ELEMENT [
+                      FieldAccessor [
+                        Variable [ Name=#4 ]
+                        Field=id
+                      ]
+                      ]
+                      FROM [                        Variable [ Name=#3 ]
+                        AS
+                        Variable [ Name=#4 ]
+                      ]
+                    )
                   ]
                   ASC
-                  Variable [ Name=tokenGrouped ]
+                  Variable [ Name=$tokenGrouped ]
                   ASC
 
               )
               AS
-              Variable [ Name=tokenRanked ]
+              Variable [ Name=$tokenRanked ]
               AT
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
             ]
             Where
               OperatorExpr [
-                Variable [ Name=tokenUnranked ]
+                Variable [ Name=$tokenUnranked ]
                 =
-                Variable [ Name=tokenRanked ]
+                Variable [ Name=$tokenRanked ]
               ]
             Orderby
-              Variable [ Name=i ]
+              Variable [ Name=$i ]
               ASC
 
           )
-        LetVariable [ Name=sim ]
+        Let Variable [ Name=$sim ]
           :=
           FunctionCall fuzzyjoin.similarity-jaccard-prefix@6[
-            Variable [ Name=lenDBLP ]
-            Variable [ Name=tokensDBLP ]
-            Variable [ Name=lenCSX ]
-            Variable [ Name=tokensCSX ]
-            Variable [ Name=prefixTokenDBLP ]
+            Variable [ Name=$lenDBLP ]
+            Variable [ Name=$tokensDBLP ]
+            Variable [ Name=$lenCSX ]
+            Variable [ Name=$tokensCSX ]
+            Variable [ Name=$prefixTokenDBLP ]
             LiteralExpr [FLOAT] [0.5]
           ]
         Where
           OperatorExpr [
             OperatorExpr [
-              Variable [ Name=prefixTokenDBLP ]
+              Variable [ Name=$prefixTokenDBLP ]
               =
-              Variable [ Name=prefixTokenCSX ]
+              Variable [ Name=$prefixTokenCSX ]
             ]
             and
             OperatorExpr [
-              Variable [ Name=sim ]
+              Variable [ Name=$sim ]
               >=
               LiteralExpr [FLOAT] [0.5]
             ]
           ]
         Groupby
-          Variable [ Name=idDBLP ]
+          Variable [ Name=$idDBLP ]
           :=
-          Variable [ Name=idDBLP ]
-          Variable [ Name=idCSX ]
+          Variable [ Name=$idDBLP ]
+          Variable [ Name=$idCSX ]
           :=
-          Variable [ Name=idCSX ]
-          With
-          Variable [ Name=sim ]
-          Variable [ Name=tokensCSX ]
-          Variable [ Name=lenCSX ]
-          Variable [ Name=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          Variable [ Name=lenDBLP ]
-          Variable [ Name=tokensUnrankedDBLP ]
-          Variable [ Name=idDBLP ]
-          Variable [ Name=paperDBLP ]
-          Variable [ Name=prefixTokenDBLP ]
-          Variable [ Name=prefixTokenCSX ]
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$idCSX ]
+          GROUP AS
+          Variable [ Name=#5 ]
+          (
+          Variable [ Name=$sim ]
+           AS sim
+          Variable [ Name=$tokensCSX ]
+           AS tokensCSX
+          Variable [ Name=$lenCSX ]
+           AS lenCSX
+          Variable [ Name=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          Variable [ Name=$lenDBLP ]
+           AS lenDBLP
+          Variable [ Name=$tokensUnrankedDBLP ]
+           AS tokensUnrankedDBLP
+          Variable [ Name=$idDBLP ]
+           AS idDBLP
+          Variable [ Name=$prefixTokenCSX ]
+           AS prefixTokenCSX
+          Variable [ Name=$paperCSX ]
+           AS paperCSX
+          Variable [ Name=$prefixTokenDBLP ]
+           AS prefixTokenDBLP
+          Variable [ Name=$paperDBLP ]
+           AS paperDBLP
+          )
 
       )
       AS
-      Variable [ Name=ridpair ]
+      Variable [ Name=$ridpair ]
     ]
     Where
       OperatorExpr [
         FieldAccessor [
-          Variable [ Name=ridpair ]
+          Variable [ Name=$ridpair ]
           Field=idDBLP
         ]
         =
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=id
         ]
       ]
   )
   AS
-  Variable [ Name=paperDBLPridpair ]
+  Variable [ Name=$paperDBLPridpair ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=idCSX
     ]
     =
     FieldAccessor [
-      Variable [ Name=paperCSX ]
+      Variable [ Name=$paperCSX ]
       Field=id
     ]
   ]
 Orderby
   FieldAccessor [
     FieldAccessor [
-      Variable [ Name=paperDBLPridpair ]
+      Variable [ Name=$paperDBLPridpair ]
       Field=paperDBLP
     ]
     Field=id
   ]
   ASC
   FieldAccessor [
-    Variable [ Name=paperDBLPridpair ]
+    Variable [ Name=$paperDBLPridpair ]
     Field=idCSX
   ]
   ASC



Mime
View raw message