asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [19/51] [partial] incubator-asterixdb git commit: ASTERIXDB-1226: implement SQL++ core group-by semantics and syntatic sugars.
Date Mon, 28 Mar 2016 20:18:46 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-2_3/dblp-csx-2_3.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
index 90cb49f..1276294 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
@@ -6,18 +6,18 @@ RecordConstructor [
   (
     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]
     ]
   )
@@ -27,7 +27,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[
@@ -44,13 +44,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[
@@ -67,244 +67,304 @@ 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=tokensDBLP ]
+Let Variable [ Name=$tokensDBLP ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
       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=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=$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=tokensCSX ]
+Let Variable [ Name=$tokensCSX ]
   :=
   (
     SELECT ELEMENT [
-    Variable [ Name=i ]
+    Variable [ Name=$i ]
     ]
     FROM [      FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
       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=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          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=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          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[
     FunctionCall fuzzyjoin.len@1[
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperDBLP ]
+          Variable [ Name=$paperDBLP ]
           Field=title
         ]
       ]
     ]
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
     FunctionCall fuzzyjoin.len@1[
       FunctionCall fuzzyjoin.counthashed-word-tokens@1[
         FieldAccessor [
-          Variable [ Name=paperCSX ]
+          Variable [ Name=$paperCSX ]
           Field=title
         ]
       ]
     ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    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=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  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=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  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
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$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-2_4/dblp-csx-2_4.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
index 037d123..5358e91 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
@@ -6,18 +6,18 @@ RecordConstructor [
   (
     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]
     ]
   )
@@ -27,7 +27,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[
@@ -44,13 +44,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[
@@ -67,245 +67,310 @@ 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=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=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=$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=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=tokensUnrankedCSX ]
-          Variable [ Name=idCSX ]
-          Variable [ Name=tokensDBLP ]
-          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=$tokensUnrankedCSX ]
+           AS tokensUnrankedCSX
+          Variable [ Name=$idCSX ]
+           AS idCSX
+          Variable [ Name=$tokensDBLP ]
+           AS tokensDBLP
+          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[
     FunctionCall fuzzyjoin.len@1[
-      Variable [ Name=tokensUnrankedDBLP ]
+      Variable [ Name=$tokensUnrankedDBLP ]
     ]
-    Variable [ Name=tokensDBLP ]
+    Variable [ Name=$tokensDBLP ]
     FunctionCall fuzzyjoin.len@1[
-      Variable [ Name=tokensUnrankedCSX ]
+      Variable [ Name=$tokensUnrankedCSX ]
     ]
-    Variable [ Name=tokensCSX ]
-    Variable [ Name=prefixTokenDBLP ]
+    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=tokensUnrankedCSX ]
-  Variable [ Name=idCSX ]
-  Variable [ Name=tokensDBLP ]
-  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=$tokensUnrankedCSX ]
+   AS tokensUnrankedCSX
+  Variable [ Name=$idCSX ]
+   AS idCSX
+  Variable [ Name=$tokensDBLP ]
+   AS tokensDBLP
+  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
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$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-2_5.1/dblp-csx-2_5.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
index ed1f277..c925dea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
@@ -6,18 +6,18 @@ RecordConstructor [
   (
     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]
     ]
   )
@@ -27,7 +27,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[
@@ -44,13 +44,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[
@@ -67,253 +67,323 @@ 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
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$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-2_5.2/dblp-csx-2_5.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
index ed1f277..c925dea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
@@ -6,18 +6,18 @@ RecordConstructor [
   (
     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]
     ]
   )
@@ -27,7 +27,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[
@@ -44,13 +44,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[
@@ -67,253 +67,323 @@ 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
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$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-2_5.3.1/dblp-csx-2_5.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
index 5844826..8ddc7b1 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
@@ -6,18 +6,18 @@ RecordConstructor [
   (
     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]
     ]
   )
@@ -27,7 +27,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[
@@ -44,13 +44,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[
@@ -67,256 +67,326 @@ 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=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
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$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-2_5.3/dblp-csx-2_5.3.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
index ed1f277..c925dea 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
@@ -6,18 +6,18 @@ RecordConstructor [
   (
     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]
     ]
   )
@@ -27,7 +27,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[
@@ -44,13 +44,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[
@@ -67,253 +67,323 @@ 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
+  )
 
 Orderby
-  Variable [ Name=idDBLP ]
+  Variable [ Name=$idDBLP ]
   ASC
-  Variable [ Name=idCSX ]
+  Variable [ Name=$idCSX ]
   ASC
 


Mime
View raw message