asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [05/51] [partial] incubator-asterixdb git commit: SQL++ parser: 1. refactored asterix-aql to become asterix-lang-common and asterix-lang-aql, where the former is the common part for different languages; 2. added asterix-lang-sqlpp on top of asterix-lang-
Date Fri, 30 Oct 2015 23:16:13 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
new file mode 100644
index 0000000..7f8f2d3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
@@ -0,0 +1,304 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32,
+    l_linenumber : int32,
+    l_quantity : int32,
+    l_extendedprice : double,
+    l_discount : double,
+    l_tax : double,
+    l_returnflag : string,
+    l_linestatus : string,
+    l_shipdate : string,
+    l_commitdate : string,
+    l_receiptdate : string,
+    l_shipinstruct : string,
+    l_shipmode : string,
+    l_comment : string
+  }
+]
+TypeDecl OrderType [
+  closed RecordType {
+    o_orderkey : int32,
+    o_custkey : int32,
+    o_orderstatus : string,
+    o_totalprice : double,
+    o_orderdate : string,
+    o_orderpriority : string,
+    o_clerk : string,
+    o_shippriority : int32,
+    o_comment : string
+  }
+]
+TypeDecl CustomerType [
+  closed RecordType {
+    c_custkey : int32,
+    c_name : string,
+    c_address : string,
+    c_nationkey : int32,
+    c_phone : string,
+    c_acctbal : double,
+    c_mktsegment : string,
+    c_comment : string
+  }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Customer(CustomerType) partitioned by [[c_custkey]]
+FunctionDecl q22_customer_tmp([]) {
+  (
+    SELECT ELEMENT [
+    RecordConstructor [
+      (
+        LiteralExpr [STRING] [c_acctbal]
+        :
+        FieldAccessor [
+          Variable [ Name=c ]
+          Field=c_acctbal
+        ]
+      )
+      (
+        LiteralExpr [STRING] [c_custkey]
+        :
+        FieldAccessor [
+          Variable [ Name=c ]
+          Field=c_custkey
+        ]
+      )
+      (
+        LiteralExpr [STRING] [cntrycode]
+        :
+        Variable [ Name=phone_substr ]
+      )
+    ]
+    ]
+    FROM [      Variable [ Name=Customer ]
+      AS
+      Variable [ Name=c ]
+    ]
+    LetVariable [ Name=phone_substr ]
+      :=
+      FunctionCall tpch.substring@3[
+        FieldAccessor [
+          Variable [ Name=c ]
+          Field=c_phone
+        ]
+        LiteralExpr [LONG] [1]
+        LiteralExpr [LONG] [2]
+      ]
+    Where
+      OperatorExpr [
+        OperatorExpr [
+          Variable [ Name=phone_substr ]
+          =
+          LiteralExpr [STRING] [13]
+        ]
+        or
+        OperatorExpr [
+          Variable [ Name=phone_substr ]
+          =
+          LiteralExpr [STRING] [31]
+        ]
+        or
+        OperatorExpr [
+          Variable [ Name=phone_substr ]
+          =
+          LiteralExpr [STRING] [23]
+        ]
+        or
+        OperatorExpr [
+          Variable [ Name=phone_substr ]
+          =
+          LiteralExpr [STRING] [29]
+        ]
+        or
+        OperatorExpr [
+          Variable [ Name=phone_substr ]
+          =
+          LiteralExpr [STRING] [30]
+        ]
+        or
+        OperatorExpr [
+          Variable [ Name=phone_substr ]
+          =
+          LiteralExpr [STRING] [18]
+        ]
+        or
+        OperatorExpr [
+          Variable [ Name=phone_substr ]
+          =
+          LiteralExpr [STRING] [17]
+        ]
+      ]
+  )
+}
+
+Query:
+LetVariable [ Name=avg ]
+  :=
+  FunctionCall tpch.avg@1[
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=c ]
+        Field=c_acctbal
+      ]
+      ]
+      FROM [        FunctionCall Metadata.dataset@1[
+          LiteralExpr [STRING] [Customer]
+        ]
+        AS
+        Variable [ Name=c ]
+      ]
+      LetVariable [ Name=phone_substr ]
+        :=
+        FunctionCall tpch.substring@3[
+          FieldAccessor [
+            Variable [ Name=c ]
+            Field=c_phone
+          ]
+          LiteralExpr [LONG] [1]
+          LiteralExpr [LONG] [2]
+        ]
+      Where
+        OperatorExpr [
+          OperatorExpr [
+            FieldAccessor [
+              Variable [ Name=c ]
+              Field=c_acctbal
+            ]
+            >
+            LiteralExpr [DOUBLE] [0.0]
+          ]
+          and
+          OperatorExpr [
+            OperatorExpr [
+              Variable [ Name=phone_substr ]
+              =
+              LiteralExpr [STRING] [13]
+            ]
+            or
+            OperatorExpr [
+              Variable [ Name=phone_substr ]
+              =
+              LiteralExpr [STRING] [31]
+            ]
+            or
+            OperatorExpr [
+              Variable [ Name=phone_substr ]
+              =
+              LiteralExpr [STRING] [23]
+            ]
+            or
+            OperatorExpr [
+              Variable [ Name=phone_substr ]
+              =
+              LiteralExpr [STRING] [29]
+            ]
+            or
+            OperatorExpr [
+              Variable [ Name=phone_substr ]
+              =
+              LiteralExpr [STRING] [30]
+            ]
+            or
+            OperatorExpr [
+              Variable [ Name=phone_substr ]
+              =
+              LiteralExpr [STRING] [18]
+            ]
+            or
+            OperatorExpr [
+              Variable [ Name=phone_substr ]
+              =
+              LiteralExpr [STRING] [17]
+            ]
+          ]
+        ]
+    )
+  ]
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [cntrycode]
+    :
+    Variable [ Name=cntrycode ]
+  )
+  (
+    LiteralExpr [STRING] [numcust]
+    :
+    FunctionCall tpch.count@1[
+      Variable [ Name=ct ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [totacctbal]
+    :
+    FunctionCall tpch.sum@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=c_acctbal
+        ]
+        ]
+        FROM [          Variable [ Name=ct ]
+          AS
+          Variable [ Name=i ]
+        ]
+      )
+    ]
+  )
+]
+]
+FROM [  FunctionCall tpch.q22_customer_tmp@0[
+  ]
+  AS
+  Variable [ Name=ct ]
+]
+Where
+  OperatorExpr [
+    FunctionCall tpch.count@1[
+      (
+        SELECT ELEMENT [
+        Variable [ Name=o ]
+        ]
+        FROM [          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [Orders]
+          ]
+          AS
+          Variable [ Name=o ]
+        ]
+        Where
+          OperatorExpr [
+            FieldAccessor [
+              Variable [ Name=ct ]
+              Field=c_custkey
+            ]
+            =
+            FieldAccessor [
+              Variable [ Name=o ]
+              Field=o_custkey
+            ]
+          ]
+      )
+    ]
+    =
+    LiteralExpr [LONG] [0]
+  ]
+Groupby
+  Variable [ Name=cntrycode ]
+  :=
+  FieldAccessor [
+    Variable [ Name=ct ]
+    Field=cntrycode
+  ]
+  With
+  Variable [ Name=ct ]
+  Variable [ Name=avg ]
+
+Orderby
+  Variable [ Name=cntrycode ]
+  ASC
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
new file mode 100644
index 0000000..fef8a60
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
@@ -0,0 +1,55 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32,
+    l_linenumber : int32,
+    l_quantity : double,
+    l_extendedprice : double,
+    l_discount : double,
+    l_tax : double,
+    l_returnflag : string,
+    l_linestatus : string,
+    l_shipdate : string,
+    l_commitdate : string,
+    l_receiptdate : string,
+    l_shipinstruct : string,
+    l_shipmode : string,
+    l_comment : string
+  }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [l_linenumber]
+    :
+    Variable [ Name=l_linenumber ]
+  )
+  (
+    LiteralExpr [STRING] [count_order]
+    :
+    FunctionCall tpch.count@1[
+      Variable [ Name=l ]
+    ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [LineItem]
+  ]
+  AS
+  Variable [ Name=l ]
+]
+Groupby
+  Variable [ Name=l_linenumber ]
+  :=
+  FieldAccessor [
+    Variable [ Name=l ]
+    Field=l_linenumber
+  ]
+  With
+  Variable [ Name=l ]
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
new file mode 100644
index 0000000..1409681
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
@@ -0,0 +1,61 @@
+DataverseUse test
+TypeDecl TestType [
+  closed RecordType {
+    key1 : int32,
+    value : int32
+  }
+]
+DatasetDecl test(TestType) partitioned by [[key1]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [gid]
+    :
+    Variable [ Name=aid ]
+  )
+  (
+    LiteralExpr [STRING] [avg]
+    :
+    FunctionCall test.avg@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=j ]
+          Field=value
+        ]
+        ]
+        FROM [          Variable [ Name=i ]
+          AS
+          Variable [ Name=j ]
+        ]
+        Where
+          FunctionCall test.not@1[
+            FunctionCall test.is-null@1[
+              FieldAccessor [
+                Variable [ Name=j ]
+                Field=value
+              ]
+            ]
+          ]
+      )
+    ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [test]
+  ]
+  AS
+  Variable [ Name=i ]
+]
+Groupby
+  Variable [ Name=aid ]
+  :=
+  FieldAccessor [
+    Variable [ Name=i ]
+    Field=key1
+  ]
+  With
+  Variable [ Name=i ]
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
new file mode 100644
index 0000000..5b5cb9a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
@@ -0,0 +1,272 @@
+DataverseUse tpch
+TypeDecl OrderType [
+  closed RecordType {
+    o_orderkey : int32,
+    o_custkey : int32,
+    o_orderstatus : string,
+    o_totalprice : double,
+    o_orderdate : string,
+    o_orderpriority : string,
+    o_clerk : string,
+    o_shippriority : int32,
+    o_comment : string
+  }
+]
+TypeDecl CustomerType [
+  closed RecordType {
+    c_custkey : int32,
+    c_name : string,
+    c_address : string,
+    c_nationkey : int32,
+    c_phone : string,
+    c_acctbal : double,
+    c_mktsegment : string,
+    c_comment : string
+  }
+]
+TypeDecl SupplierType [
+  closed RecordType {
+    s_suppkey : int32,
+    s_name : string,
+    s_address : string,
+    s_nationkey : int32,
+    s_phone : string,
+    s_acctbal : double,
+    s_comment : string
+  }
+]
+TypeDecl NationType [
+  closed RecordType {
+    n_nationkey : int32,
+    n_name : string,
+    n_regionkey : int32,
+    n_comment : string
+  }
+]
+TypeDecl RegionType [
+  closed RecordType {
+    r_regionkey : int32,
+    r_name : string,
+    r_comment : string
+  }
+]
+DatasetDecl Orders(OrderType) partitioned by [[o_orderkey]]
+DatasetDecl Supplier(SupplierType) partitioned by [[s_suppkey]]
+DatasetDecl Region(RegionType) partitioned by [[r_regionkey]]
+DatasetDecl Nation(NationType) partitioned by [[n_nationkey]]
+DatasetDecl Customer(CustomerType) partitioned by [[c_custkey]]
+DatasetDecl SelectedNation(NationType) partitioned by [[n_nationkey]]
+Query:
+LetVariable [ Name=t ]
+  :=
+  (
+    SELECT ELEMENT [
+    RecordConstructor [
+      (
+        LiteralExpr [STRING] [n_nationkey]
+        :
+        FieldAccessor [
+          Variable [ Name=nation ]
+          Field=n_nationkey
+        ]
+      )
+      (
+        LiteralExpr [STRING] [n_name]
+        :
+        FieldAccessor [
+          Variable [ Name=nation ]
+          Field=n_name
+        ]
+      )
+    ]
+    ]
+    FROM [      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [Nation]
+      ]
+      AS
+      Variable [ Name=nation ]
+,
+      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [SelectedNation]
+      ]
+      AS
+      Variable [ Name=sn ]
+    ]
+    Where
+      OperatorExpr [
+        FieldAccessor [
+          Variable [ Name=nation ]
+          Field=n_nationkey
+        ]
+        =
+        FieldAccessor [
+          Variable [ Name=sn ]
+          Field=n_nationkey
+        ]
+      ]
+  )
+LetVariable [ Name=X ]
+  :=
+  (
+    SELECT ELEMENT [
+    RecordConstructor [
+      (
+        LiteralExpr [STRING] [nation_key]
+        :
+        Variable [ Name=nation_key ]
+      )
+      (
+        LiteralExpr [STRING] [order_date]
+        :
+        Variable [ Name=orderdate ]
+      )
+      (
+        LiteralExpr [STRING] [sum_price]
+        :
+        Variable [ Name=sum ]
+      )
+    ]
+    ]
+    FROM [      Variable [ Name=t ]
+      AS
+      Variable [ Name=n ]
+,
+      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [Customer]
+      ]
+      AS
+      Variable [ Name=customer ]
+,
+      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [Orders]
+      ]
+      AS
+      Variable [ Name=orders ]
+    ]
+    Where
+      OperatorExpr [
+        OperatorExpr [
+          FieldAccessor [
+            Variable [ Name=orders ]
+            Field=o_custkey
+          ]
+          =
+          FieldAccessor [
+            Variable [ Name=customer ]
+            Field=c_custkey
+          ]
+        ]
+        and
+        OperatorExpr [
+          FieldAccessor [
+            Variable [ Name=customer ]
+            Field=c_nationkey
+          ]
+          =
+          FieldAccessor [
+            Variable [ Name=n ]
+            Field=n_nationkey
+          ]
+        ]
+      ]
+    Groupby
+      Variable [ Name=orderdate ]
+      :=
+      FieldAccessor [
+        Variable [ Name=orders ]
+        Field=o_orderdate
+      ]
+      Variable [ Name=nation_key ]
+      :=
+      FieldAccessor [
+        Variable [ Name=n ]
+        Field=n_nationkey
+      ]
+      With
+      Variable [ Name=orders ]
+      Variable [ Name=n ]
+      Variable [ Name=customer ]
+      Variable [ Name=X ]
+      Variable [ Name=t ]
+
+    LetVariable [ Name=sum ]
+      :=
+      FunctionCall tpch.sum@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            Variable [ Name=o ]
+            Field=o_totalprice
+          ]
+          ]
+          FROM [            Variable [ Name=orders ]
+            AS
+            Variable [ Name=o ]
+          ]
+        )
+      ]
+  )
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [nation_key]
+    :
+    Variable [ Name=nation_key ]
+  )
+  (
+    LiteralExpr [STRING] [sum_price]
+    :
+    (
+      SELECT ELEMENT [
+      RecordConstructor [
+        (
+          LiteralExpr [STRING] [orderdate]
+          :
+          FieldAccessor [
+            Variable [ Name=y ]
+            Field=order_date
+          ]
+        )
+        (
+          LiteralExpr [STRING] [sum_price]
+          :
+          FieldAccessor [
+            Variable [ Name=y ]
+            Field=sum_price
+          ]
+        )
+      ]
+      ]
+      FROM [        Variable [ Name=x ]
+        AS
+        Variable [ Name=y ]
+      ]
+      Orderby
+        FieldAccessor [
+          Variable [ Name=y ]
+          Field=sum_price
+        ]
+        DESC
+
+      Limit
+        LiteralExpr [LONG] [3]
+    )
+  )
+]
+]
+FROM [  Variable [ Name=X ]
+  AS
+  Variable [ Name=x ]
+]
+Groupby
+  Variable [ Name=nation_key ]
+  :=
+  FieldAccessor [
+    Variable [ Name=x ]
+    Field=nation_key
+  ]
+  With
+  Variable [ Name=x ]
+  Variable [ Name=X ]
+  Variable [ Name=t ]
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
new file mode 100644
index 0000000..1726c87
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
@@ -0,0 +1,204 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32,
+    l_linenumber : int32,
+    l_quantity : double,
+    l_extendedprice : double,
+    l_discount : double,
+    l_tax : double,
+    l_returnflag : string,
+    l_linestatus : string,
+    l_shipdate : string,
+    l_commitdate : string,
+    l_receiptdate : string,
+    l_shipinstruct : string,
+    l_shipmode : string,
+    l_comment : string
+  }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [l_returnflag]
+    :
+    Variable [ Name=l_returnflag ]
+  )
+  (
+    LiteralExpr [STRING] [l_linestatus]
+    :
+    Variable [ Name=l_linestatus ]
+  )
+  (
+    LiteralExpr [STRING] [count_cheaps]
+    :
+    FunctionCall tpch.count@1[
+      Variable [ Name=cheaps ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [avg_expensive_discounts]
+    :
+    FunctionCall tpch.avg@1[
+      Variable [ Name=expensives ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [sum_disc_prices]
+    :
+    FunctionCall tpch.sum@1[
+      Variable [ Name=disc_prices ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [total_charges]
+    :
+    FunctionCall tpch.sum@1[
+      Variable [ Name=charges ]
+    ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [LineItem]
+  ]
+  AS
+  Variable [ Name=l ]
+]
+Where
+  OperatorExpr [
+    FieldAccessor [
+      Variable [ Name=l ]
+      Field=l_shipdate
+    ]
+    <=
+    LiteralExpr [STRING] [1998-09-02]
+  ]
+Groupby
+  Variable [ Name=l_returnflag ]
+  :=
+  FieldAccessor [
+    Variable [ Name=l ]
+    Field=l_returnflag
+  ]
+  Variable [ Name=l_linestatus ]
+  :=
+  FieldAccessor [
+    Variable [ Name=l ]
+    Field=l_linestatus
+  ]
+  With
+  Variable [ Name=l ]
+
+LetVariable [ Name=expensives ]
+  :=
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      Variable [ Name=i ]
+      Field=l_discount
+    ]
+    ]
+    FROM [      Variable [ Name=l ]
+      AS
+      Variable [ Name=i ]
+    ]
+    Where
+      OperatorExpr [
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_discount
+        ]
+        <=
+        LiteralExpr [DOUBLE] [0.05]
+      ]
+  )
+LetVariable [ Name=cheaps ]
+  :=
+  (
+    SELECT ELEMENT [
+    Variable [ Name=i ]
+    ]
+    FROM [      Variable [ Name=l ]
+      AS
+      Variable [ Name=i ]
+    ]
+    Where
+      OperatorExpr [
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_discount
+        ]
+        >
+        LiteralExpr [DOUBLE] [0.05]
+      ]
+  )
+LetVariable [ Name=charges ]
+  :=
+  (
+    SELECT ELEMENT [
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=i ]
+        Field=l_extendedprice
+      ]
+      *
+      OperatorExpr [
+        LiteralExpr [LONG] [1]
+        -
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_discount
+        ]
+      ]
+      *
+      OperatorExpr [
+        LiteralExpr [LONG] [1]
+        +
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_tax
+        ]
+      ]
+    ]
+    ]
+    FROM [      Variable [ Name=l ]
+      AS
+      Variable [ Name=i ]
+    ]
+  )
+LetVariable [ Name=disc_prices ]
+  :=
+  (
+    SELECT ELEMENT [
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=i ]
+        Field=l_extendedprice
+      ]
+      *
+      OperatorExpr [
+        LiteralExpr [LONG] [1]
+        -
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_discount
+        ]
+      ]
+    ]
+    ]
+    FROM [      Variable [ Name=l ]
+      AS
+      Variable [ Name=i ]
+    ]
+  )
+Orderby
+  Variable [ Name=l_returnflag ]
+  ASC
+  Variable [ Name=l_linestatus ]
+  ASC
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
new file mode 100644
index 0000000..3be4f1c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
@@ -0,0 +1,128 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32,
+    l_linenumber : int32,
+    l_quantity : double,
+    l_extendedprice : double,
+    l_discount : double,
+    l_tax : double,
+    l_returnflag : string,
+    l_linestatus : string,
+    l_shipdate : string,
+    l_commitdate : string,
+    l_receiptdate : string,
+    l_shipinstruct : string,
+    l_shipmode : string,
+    l_comment : string
+  }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [l_returnflag]
+    :
+    Variable [ Name=l_returnflag ]
+  )
+  (
+    LiteralExpr [STRING] [l_linestatus]
+    :
+    Variable [ Name=l_linestatus ]
+  )
+  (
+    LiteralExpr [STRING] [count_cheaps]
+    :
+    FunctionCall tpch.count@1[
+      Variable [ Name=cheap ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [count_expensives]
+    :
+    FunctionCall tpch.count@1[
+      Variable [ Name=expensive ]
+    ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [LineItem]
+  ]
+  AS
+  Variable [ Name=l ]
+]
+Where
+  OperatorExpr [
+    FieldAccessor [
+      Variable [ Name=l ]
+      Field=l_shipdate
+    ]
+    <=
+    LiteralExpr [STRING] [1998-09-02]
+  ]
+Groupby
+  Variable [ Name=l_returnflag ]
+  :=
+  FieldAccessor [
+    Variable [ Name=l ]
+    Field=l_returnflag
+  ]
+  Variable [ Name=l_linestatus ]
+  :=
+  FieldAccessor [
+    Variable [ Name=l ]
+    Field=l_linestatus
+  ]
+  With
+  Variable [ Name=l ]
+
+LetVariable [ Name=cheap ]
+  :=
+  (
+    SELECT ELEMENT [
+    Variable [ Name=m ]
+    ]
+    FROM [      Variable [ Name=l ]
+      AS
+      Variable [ Name=m ]
+    ]
+    Where
+      OperatorExpr [
+        FieldAccessor [
+          Variable [ Name=m ]
+          Field=l_discount
+        ]
+        >
+        LiteralExpr [DOUBLE] [0.05]
+      ]
+  )
+LetVariable [ Name=expensive ]
+  :=
+  (
+    SELECT ELEMENT [
+    Variable [ Name=a ]
+    ]
+    FROM [      Variable [ Name=l ]
+      AS
+      Variable [ Name=a ]
+    ]
+    Where
+      OperatorExpr [
+        FieldAccessor [
+          Variable [ Name=a ]
+          Field=l_discount
+        ]
+        <=
+        LiteralExpr [DOUBLE] [0.05]
+      ]
+  )
+Orderby
+  Variable [ Name=l_returnflag ]
+  ASC
+  Variable [ Name=l_linestatus ]
+  ASC
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
new file mode 100644
index 0000000..56a8784
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
@@ -0,0 +1,231 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32,
+    l_linenumber : int32,
+    l_quantity : double,
+    l_extendedprice : double,
+    l_discount : double,
+    l_tax : double,
+    l_returnflag : string,
+    l_linestatus : string,
+    l_shipdate : string,
+    l_commitdate : string,
+    l_receiptdate : string,
+    l_shipinstruct : string,
+    l_shipmode : string,
+    l_comment : string
+  }
+]
+DatasetDecl LineItem(LineItemType) partitioned by [[l_orderkey], [l_linenumber]]
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [sum_qty_partial]
+    :
+    FunctionCall tpch.sum@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_quantity
+        ]
+        ]
+        FROM [          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [LineItem]
+          ]
+          AS
+          Variable [ Name=i ]
+        ]
+        Where
+          OperatorExpr [
+            FieldAccessor [
+              Variable [ Name=i ]
+              Field=l_shipdate
+            ]
+            <=
+            LiteralExpr [STRING] [1998-09-02]
+          ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [sum_base_price]
+    :
+    FunctionCall tpch.sum@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_extendedprice
+        ]
+        ]
+        FROM [          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [LineItem]
+          ]
+          AS
+          Variable [ Name=i ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [sum_disc_price]
+    :
+    FunctionCall tpch.sum@1[
+      (
+        SELECT ELEMENT [
+        OperatorExpr [
+          FieldAccessor [
+            Variable [ Name=i ]
+            Field=l_extendedprice
+          ]
+          *
+          OperatorExpr [
+            LiteralExpr [LONG] [1]
+            -
+            FieldAccessor [
+              Variable [ Name=i ]
+              Field=l_discount
+            ]
+          ]
+        ]
+        ]
+        FROM [          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [LineItem]
+          ]
+          AS
+          Variable [ Name=i ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [sum_charge]
+    :
+    FunctionCall tpch.sum@1[
+      (
+        SELECT ELEMENT [
+        OperatorExpr [
+          FieldAccessor [
+            Variable [ Name=i ]
+            Field=l_extendedprice
+          ]
+          *
+          OperatorExpr [
+            LiteralExpr [LONG] [1]
+            -
+            FieldAccessor [
+              Variable [ Name=i ]
+              Field=l_discount
+            ]
+          ]
+          *
+          OperatorExpr [
+            LiteralExpr [LONG] [1]
+            +
+            FieldAccessor [
+              Variable [ Name=i ]
+              Field=l_tax
+            ]
+          ]
+        ]
+        ]
+        FROM [          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [LineItem]
+          ]
+          AS
+          Variable [ Name=i ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [ave_qty]
+    :
+    FunctionCall tpch.avg@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_quantity
+        ]
+        ]
+        FROM [          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [LineItem]
+          ]
+          AS
+          Variable [ Name=i ]
+        ]
+        Where
+          OperatorExpr [
+            FieldAccessor [
+              Variable [ Name=i ]
+              Field=l_shipdate
+            ]
+            <=
+            LiteralExpr [STRING] [1998-09-02]
+          ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [ave_price]
+    :
+    FunctionCall tpch.avg@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_extendedprice
+        ]
+        ]
+        FROM [          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [LineItem]
+          ]
+          AS
+          Variable [ Name=i ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [ave_disc]
+    :
+    FunctionCall tpch.avg@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=i ]
+          Field=l_discount
+        ]
+        ]
+        FROM [          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [LineItem]
+          ]
+          AS
+          Variable [ Name=i ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [count_order]
+    :
+    FunctionCall tpch.count@1[
+      (
+        SELECT ELEMENT [
+        Variable [ Name=l ]
+        ]
+        FROM [          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [LineItem]
+          ]
+          AS
+          Variable [ Name=l ]
+        ]
+      )
+    ]
+  )
+]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast
new file mode 100644
index 0000000..7a7b3f2
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849-2.ast
@@ -0,0 +1,92 @@
+DataverseUse test
+TypeDecl sType [
+  closed RecordType {
+    b : int32
+  }
+]
+DatasetDecl s(sType) partitioned by [[b]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [x]
+    :
+    Variable [ Name=x ]
+  )
+  (
+    LiteralExpr [STRING] [y]
+    :
+    Variable [ Name=y ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [s]
+  ]
+  AS
+  Variable [ Name=x ]
+,
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      Variable [ Name=z ]
+      Field=c
+    ]
+    ]
+    FROM [      UnorderedListConstructor [
+        RecordConstructor [
+          (
+            LiteralExpr [STRING] [a]
+            :
+            LiteralExpr [LONG] [1]
+          )
+          (
+            LiteralExpr [STRING] [c]
+            :
+            LiteralExpr [LONG] [1]
+          )
+        ]
+        RecordConstructor [
+          (
+            LiteralExpr [STRING] [a]
+            :
+            LiteralExpr [LONG] [2]
+          )
+          (
+            LiteralExpr [STRING] [c]
+            :
+            LiteralExpr [LONG] [2]
+          )
+        ]
+        RecordConstructor [
+          (
+            LiteralExpr [STRING] [a]
+            :
+            LiteralExpr [LONG] [1]
+          )
+          (
+            LiteralExpr [STRING] [c]
+            :
+            LiteralExpr [NULL]
+          )
+        ]
+      ]
+      AS
+      Variable [ Name=z ]
+    ]
+    Where
+      OperatorExpr [
+        FieldAccessor [
+          Variable [ Name=x ]
+          Field=b
+        ]
+        =
+        FieldAccessor [
+          Variable [ Name=z ]
+          Field=a
+        ]
+      ]
+  )
+  AS
+  Variable [ Name=y ]
+]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast
new file mode 100644
index 0000000..98b006e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query_issue849.ast
@@ -0,0 +1,70 @@
+DataverseUse test
+TypeDecl sType [
+  closed RecordType {
+    b : int32
+  }
+]
+DatasetDecl s(sType) partitioned by [[b]]
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [x]
+    :
+    Variable [ Name=x ]
+  )
+  (
+    LiteralExpr [STRING] [y]
+    :
+    Variable [ Name=y ]
+  )
+]
+]
+FROM [  UnorderedListConstructor [
+    RecordConstructor [
+      (
+        LiteralExpr [STRING] [a]
+        :
+        LiteralExpr [LONG] [1]
+      )
+    ]
+    RecordConstructor [
+      (
+        LiteralExpr [STRING] [a]
+        :
+        LiteralExpr [LONG] [2]
+      )
+    ]
+  ]
+  AS
+  Variable [ Name=x ]
+,
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      Variable [ Name=z ]
+      Field=b
+    ]
+    ]
+    FROM [      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [s]
+      ]
+      AS
+      Variable [ Name=z ]
+    ]
+    Where
+      OperatorExpr [
+        FieldAccessor [
+          Variable [ Name=x ]
+          Field=a
+        ]
+        =
+        FieldAccessor [
+          Variable [ Name=z ]
+          Field=b
+        ]
+      ]
+  )
+  AS
+  Variable [ Name=y ]
+]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast
new file mode 100644
index 0000000..576eeb7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric-desc.ast
@@ -0,0 +1,29 @@
+DataverseUse TinySocial
+TypeDecl TwitterUserType [
+  open RecordType {
+    screen-name : string,
+    lang : string,
+    friends_count : int64,
+    statuses_count : int64,
+    name : string,
+    followers_count : int64
+  }
+]
+DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=user ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TwitterUsers]
+  ]
+  AS
+  Variable [ Name=user ]
+]
+Orderby
+  FieldAccessor [
+    Variable [ Name=user ]
+    Field=friends_count
+  ]
+  DESC
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast
new file mode 100644
index 0000000..ec49be3
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-numeric.ast
@@ -0,0 +1,29 @@
+DataverseUse TinySocial
+TypeDecl TwitterUserType [
+  open RecordType {
+    screen-name : string,
+    lang : string,
+    friends_count : int64,
+    statuses_count : int64,
+    name : string,
+    followers_count : int64
+  }
+]
+DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=user ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TwitterUsers]
+  ]
+  AS
+  Variable [ Name=user ]
+]
+Orderby
+  FieldAccessor [
+    Variable [ Name=user ]
+    Field=friends_count
+  ]
+  ASC
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast
new file mode 100644
index 0000000..aefabe9
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string-desc.ast
@@ -0,0 +1,29 @@
+DataverseUse TinySocial
+TypeDecl TwitterUserType [
+  open RecordType {
+    screen-name : string,
+    lang : string,
+    friends_count : int64,
+    statuses_count : int64,
+    name : string,
+    followers_count : int64
+  }
+]
+DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=user ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TwitterUsers]
+  ]
+  AS
+  Variable [ Name=user ]
+]
+Orderby
+  FieldAccessor [
+    Variable [ Name=user ]
+    Field=screen-name
+  ]
+  DESC
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast
new file mode 100644
index 0000000..28b636d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/range-connector/sort-hint-on-closed-string.ast
@@ -0,0 +1,29 @@
+DataverseUse TinySocial
+TypeDecl TwitterUserType [
+  open RecordType {
+    screen-name : string,
+    lang : string,
+    friends_count : int64,
+    statuses_count : int64,
+    name : string,
+    followers_count : int64
+  }
+]
+DatasetDecl TwitterUsers(TwitterUserType) partitioned by [[screen-name]]
+Query:
+SELECT ELEMENT [
+Variable [ Name=user ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TwitterUsers]
+  ]
+  AS
+  Variable [ Name=user ]
+]
+Orderby
+  FieldAccessor [
+    Variable [ Name=user ]
+    Field=screen-name
+  ]
+  ASC
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/record_access.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/record_access.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/record_access.ast
new file mode 100644
index 0000000..013ea15
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/record_access.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+WriteOutputTo nc1:/tmp/rec_access.adm
+Query:
+FieldAccessor [
+  RecordConstructor [
+    (
+      LiteralExpr [STRING] [a]
+      :
+      LiteralExpr [LONG] [2]
+    )
+  ]
+  Field=a
+]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast
new file mode 100644
index 0000000..e98418d
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/issue730.ast
@@ -0,0 +1,102 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+  open RecordType {
+    screen_name : string,
+    lang : string,
+    friends_count : int32,
+    statuses_count : int32,
+    name : string,
+    followers_count : int32
+  }
+]
+TypeDecl TweetMessageType [
+  open RecordType {
+    tweetid : int64,
+    user : TwitterUserType,
+    sender_location : point?,
+    send_time : datetime,
+    referred_topics : UnorderedList <string>
+,
+    message_text : string
+  }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_issue730.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [message]
+    :
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=tweetid
+    ]
+  )
+  (
+    LiteralExpr [STRING] [nearby-message]
+    :
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=t2 ]
+        Field=tweetid
+      ]
+      ]
+      FROM [        FunctionCall Metadata.dataset@1[
+          LiteralExpr [STRING] [TweetMessages]
+        ]
+        AS
+        Variable [ Name=t2 ]
+      ]
+      Where
+        FunctionCall test.spatial-intersect@2[
+          FieldAccessor [
+            Variable [ Name=t2 ]
+            Field=sender_location
+          ]
+          Variable [ Name=n ]
+        ]
+    )
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TweetMessages]
+  ]
+  AS
+  Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+  :=
+  FunctionCall test.create-circle@2[
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=sender_location
+    ]
+    LiteralExpr [DOUBLE] [5.0]
+  ]
+Where
+  OperatorExpr [
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=t1 ]
+        Field=send_time
+      ]
+      >=
+      FunctionCall test.datetime@1[
+        LiteralExpr [STRING] [2011-06-18T14:10:17]
+      ]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=t1 ]
+        Field=send_time
+      ]
+      <
+      FunctionCall test.datetime@1[
+        LiteralExpr [STRING] [2011-06-18T15:10:17]
+      ]
+    ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
new file mode 100644
index 0000000..1c45852
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_01.ast
@@ -0,0 +1,127 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+  closed RecordType {
+    screen-name : string,
+    lang : string,
+    friends-count : int32,
+    statuses-count : int32,
+    name : string,
+    followers-count : int32
+  }
+]
+TypeDecl TweetMessageType [
+  closed RecordType {
+    tweetid : int64,
+    user : TwitterUserType,
+    sender-location : point,
+    send-time : datetime,
+    referred-topics : UnorderedList <string>
+,
+    message-text : string,
+    countA : int32,
+    countB : int32
+  }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_01.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [tweetid1]
+    :
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=tweetid
+    ]
+  )
+  (
+    LiteralExpr [STRING] [loc1]
+    :
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=sender-location
+    ]
+  )
+  (
+    LiteralExpr [STRING] [nearby-message]
+    :
+    (
+      SELECT ELEMENT [
+      RecordConstructor [
+        (
+          LiteralExpr [STRING] [tweetid2]
+          :
+          FieldAccessor [
+            Variable [ Name=t2 ]
+            Field=tweetid
+          ]
+        )
+        (
+          LiteralExpr [STRING] [loc2]
+          :
+          FieldAccessor [
+            Variable [ Name=t2 ]
+            Field=sender-location
+          ]
+        )
+      ]
+      ]
+      FROM [        FunctionCall Metadata.dataset@1[
+          LiteralExpr [STRING] [TweetMessages]
+        ]
+        AS
+        Variable [ Name=t2 ]
+      ]
+      Where
+        FunctionCall test.spatial-intersect@2[
+          FieldAccessor [
+            Variable [ Name=t2 ]
+            Field=sender-location
+          ]
+          Variable [ Name=n ]
+        ]
+      Orderby
+        FieldAccessor [
+          Variable [ Name=t2 ]
+          Field=tweetid
+        ]
+        ASC
+
+    )
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TweetMessages]
+  ]
+  AS
+  Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+  :=
+  FunctionCall test.create-circle@2[
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=sender-location
+    ]
+    LiteralExpr [DOUBLE] [0.5]
+  ]
+Where
+  OperatorExpr [
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=tweetid
+    ]
+    <
+    FunctionCall test.int64@1[
+      LiteralExpr [STRING] [10]
+    ]
+  ]
+Orderby
+  FieldAccessor [
+    Variable [ Name=t1 ]
+    Field=tweetid
+  ]
+  ASC
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
new file mode 100644
index 0000000..628cc16
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/leftouterjoin-probe-pidx-with-join-rtree-sidx_02.ast
@@ -0,0 +1,141 @@
+DataverseUse test
+TypeDecl TwitterUserType [
+  closed RecordType {
+    screen-name : string,
+    lang : string,
+    friends-count : int32,
+    statuses-count : int32,
+    name : string,
+    followers-count : int32
+  }
+]
+TypeDecl TweetMessageType [
+  closed RecordType {
+    tweetid : int64,
+    user : TwitterUserType,
+    sender-location : point,
+    send-time : datetime,
+    referred-topics : UnorderedList <string>
+,
+    message-text : string,
+    countA : int32,
+    countB : int32
+  }
+]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/rtree-index-join_leftouterjoin-probe-pidx-with-join-rtree-sidx_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [tweetid1]
+    :
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=tweetid
+    ]
+  )
+  (
+    LiteralExpr [STRING] [loc1]
+    :
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=sender-location
+    ]
+  )
+  (
+    LiteralExpr [STRING] [nearby-message]
+    :
+    (
+      SELECT ELEMENT [
+      RecordConstructor [
+        (
+          LiteralExpr [STRING] [tweetid2]
+          :
+          FieldAccessor [
+            Variable [ Name=t2 ]
+            Field=tweetid
+          ]
+        )
+        (
+          LiteralExpr [STRING] [loc2]
+          :
+          FieldAccessor [
+            Variable [ Name=t2 ]
+            Field=sender-location
+          ]
+        )
+      ]
+      ]
+      FROM [        FunctionCall Metadata.dataset@1[
+          LiteralExpr [STRING] [TweetMessages]
+        ]
+        AS
+        Variable [ Name=t2 ]
+      ]
+      Where
+        OperatorExpr [
+          FunctionCall test.spatial-intersect@2[
+            FieldAccessor [
+              Variable [ Name=t2 ]
+              Field=sender-location
+            ]
+            Variable [ Name=n ]
+          ]
+          and
+          OperatorExpr [
+            FieldAccessor [
+              Variable [ Name=t1 ]
+              Field=tweetid
+            ]
+            !=
+            FieldAccessor [
+              Variable [ Name=t2 ]
+              Field=tweetid
+            ]
+          ]
+        ]
+      Orderby
+        FieldAccessor [
+          Variable [ Name=t2 ]
+          Field=tweetid
+        ]
+        ASC
+
+    )
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TweetMessages]
+  ]
+  AS
+  Variable [ Name=t1 ]
+]
+LetVariable [ Name=n ]
+  :=
+  FunctionCall test.create-circle@2[
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=sender-location
+    ]
+    LiteralExpr [DOUBLE] [0.5]
+  ]
+Where
+  OperatorExpr [
+    FieldAccessor [
+      Variable [ Name=t1 ]
+      Field=tweetid
+    ]
+    <
+    FunctionCall test.int64@1[
+      LiteralExpr [STRING] [10]
+    ]
+  ]
+Orderby
+  FieldAccessor [
+    Variable [ Name=t1 ]
+    Field=tweetid
+  ]
+  ASC
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
new file mode 100644
index 0000000..de3f414
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
@@ -0,0 +1,88 @@
+DataverseUse twitter
+TypeDecl TweetMessageType [
+  closed RecordType {
+    tweetid : int64,
+    sender-location : point,
+    text : string
+  }
+]
+TypeDecl TweetHistorySubscription [
+  open RecordType {
+    subscription-id : int32,
+    location : point
+  }
+]
+DatasetDecl TweetHistorySubscriptions(TweetHistorySubscription) partitioned by [[subscription-id]]
+DatasetDecl TweetMessages(TweetMessageType) partitioned by [[tweetid]]
+WriteOutputTo nc1:rttest/query-issue838.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [subscription-id]
+    :
+    FieldAccessor [
+      Variable [ Name=sub ]
+      Field=subscription-id
+    ]
+  )
+  (
+    LiteralExpr [STRING] [changeSet]
+    :
+    LiteralExpr [LONG] [1]
+  )
+  (
+    LiteralExpr [STRING] [execution-time]
+    :
+    FunctionCall twitter.current-datetime@0[
+    ]
+  )
+  (
+    LiteralExpr [STRING] [message-text]
+    :
+    Variable [ Name=text ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TweetHistorySubscriptions]
+  ]
+  AS
+  Variable [ Name=sub ]
+,
+  (
+    SELECT ELEMENT [
+    Variable [ Name=tweet ]
+    ]
+    FROM [      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [TweetMessages]
+      ]
+      AS
+      Variable [ Name=tweet ]
+    ]
+    LetVariable [ Name=circle ]
+      :=
+      FunctionCall twitter.create-circle@2[
+        FunctionCall Metadata.dataset@1[
+          LiteralExpr [STRING] [location]
+        ]
+        LiteralExpr [DOUBLE] [30.0]
+      ]
+    Where
+      FunctionCall twitter.spatial-intersect@2[
+        FieldAccessor [
+          Variable [ Name=tweet ]
+          Field=sender-location
+        ]
+        Variable [ Name=circle ]
+      ]
+  )
+  AS
+  Variable [ Name=text ]
+]
+LetVariable [ Name=location ]
+  :=
+  FieldAccessor [
+    Variable [ Name=sub ]
+    Field=location
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast
new file mode 100644
index 0000000..f0bf3f7
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_01.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl MyRecord [
+  closed RecordType {
+    id : int32,
+    point : point,
+    kwds : string,
+    line1 : line,
+    line2 : line,
+    poly1 : polygon,
+    poly2 : polygon,
+    rec : rectangle
+  }
+]
+DatasetDecl MyData1(MyRecord) partitioned by [[id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index-join_rtree-spatial-intersect-point.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [a]
+    :
+    Variable [ Name=a ]
+  )
+  (
+    LiteralExpr [STRING] [b]
+    :
+    Variable [ Name=b ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [MyData1]
+  ]
+  AS
+  Variable [ Name=a ]
+,
+  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [MyData2]
+  ]
+  AS
+  Variable [ Name=b ]
+]
+Where
+  FunctionCall test.spatial-intersect@2[
+    FieldAccessor [
+      Variable [ Name=a ]
+      Field=point
+    ]
+    FieldAccessor [
+      Variable [ Name=b ]
+      Field=point
+    ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast
new file mode 100644
index 0000000..f6c641f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_02.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl MyRecord [
+  closed RecordType {
+    id : int32,
+    point : point,
+    kwds : string,
+    line1 : line,
+    line2 : line,
+    poly1 : polygon,
+    poly2 : polygon,
+    rec : rectangle
+  }
+]
+DatasetDecl MyData1(MyRecord) partitioned by [[id]]
+DatasetDecl MyData2(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_02.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [a]
+    :
+    Variable [ Name=a ]
+  )
+  (
+    LiteralExpr [STRING] [b]
+    :
+    Variable [ Name=b ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [MyData1]
+  ]
+  AS
+  Variable [ Name=a ]
+,
+  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [MyData2]
+  ]
+  AS
+  Variable [ Name=b ]
+]
+Where
+  FunctionCall test.spatial-intersect@2[
+    FieldAccessor [
+      Variable [ Name=a ]
+      Field=point
+    ]
+    FieldAccessor [
+      Variable [ Name=b ]
+      Field=point
+    ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast
new file mode 100644
index 0000000..4494871
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/spatial-intersect-point_03.ast
@@ -0,0 +1,53 @@
+DataverseUse test
+TypeDecl MyRecord [
+  closed RecordType {
+    id : int32,
+    point : point,
+    kwds : string,
+    line1 : line,
+    line2 : line,
+    poly1 : polygon,
+    poly2 : polygon,
+    rec : rectangle
+  }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/rtree-index-join_spatial-intersect-point_03.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [a]
+    :
+    Variable [ Name=a ]
+  )
+  (
+    LiteralExpr [STRING] [b]
+    :
+    Variable [ Name=b ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [MyData]
+  ]
+  AS
+  Variable [ Name=a ]
+,
+  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [MyData]
+  ]
+  AS
+  Variable [ Name=b ]
+]
+Where
+  FunctionCall test.spatial-intersect@2[
+    FieldAccessor [
+      Variable [ Name=a ]
+      Field=point
+    ]
+    FieldAccessor [
+      Variable [ Name=b ]
+      Field=point
+    ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast
new file mode 100644
index 0000000..644a3b8
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index-open.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl MyRecord [
+  open RecordType {
+    id : int32,
+    point : point,
+    kwds : string,
+    line1 : line,
+    line2 : line,
+    poly1 : polygon,
+    poly2 : polygon,
+    rec : rectangle,
+    circle : circle
+  }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index_rtree-secondary-index-open.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [id]
+    :
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=id
+    ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [MyData]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+Where
+  FunctionCall test.spatial-intersect@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=point
+    ]
+    FunctionCall test.create-polygon@1[
+      OrderedListConstructor [
+        LiteralExpr [DOUBLE] [4.0]
+        LiteralExpr [DOUBLE] [1.0]
+        LiteralExpr [DOUBLE] [4.0]
+        LiteralExpr [DOUBLE] [4.0]
+        LiteralExpr [DOUBLE] [12.0]
+        LiteralExpr [DOUBLE] [4.0]
+        LiteralExpr [DOUBLE] [12.0]
+        LiteralExpr [DOUBLE] [1.0]
+      ]
+    ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast
new file mode 100644
index 0000000..a283d04
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-secondary-index.ast
@@ -0,0 +1,54 @@
+DataverseUse test
+TypeDecl MyRecord [
+  closed RecordType {
+    id : int32,
+    point : point,
+    kwds : string,
+    line1 : line,
+    line2 : line,
+    poly1 : polygon,
+    poly2 : polygon,
+    rec : rectangle,
+    circle : circle
+  }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]
+WriteOutputTo nc1:rttest/index_rtree-secondary-index.adm
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [id]
+    :
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=id
+    ]
+  )
+]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [MyData]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+Where
+  FunctionCall test.spatial-intersect@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=point
+    ]
+    FunctionCall test.create-polygon@1[
+      OrderedListConstructor [
+        LiteralExpr [DOUBLE] [4.0]
+        LiteralExpr [DOUBLE] [1.0]
+        LiteralExpr [DOUBLE] [4.0]
+        LiteralExpr [DOUBLE] [4.0]
+        LiteralExpr [DOUBLE] [12.0]
+        LiteralExpr [DOUBLE] [4.0]
+        LiteralExpr [DOUBLE] [12.0]
+        LiteralExpr [DOUBLE] [1.0]
+      ]
+    ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-all.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-all.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-all.ast
new file mode 100644
index 0000000..ef75bcb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-all.ast
@@ -0,0 +1,30 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32,
+    l_linenumber : int32,
+    l_quantity : double,
+    l_extendedprice : double,
+    l_discount : double,
+    l_tax : double,
+    l_returnflag : string,
+    l_linestatus : string,
+    l_shipdate : string,
+    l_commitdate : string,
+    l_receiptdate : string,
+    l_shipinstruct : string,
+    l_shipmode : string,
+    l_comment : string
+  }
+]
+TypeDecl LineIDType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32
+  }
+]
+DatasetDecl LineItems_q1(LineItemType) partitioned by [[l_orderkey]]
+DatasetDecl LineID(LineIDType) partitioned by [[l_orderkey]]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-rtree-secondary-index.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-rtree-secondary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-rtree-secondary-index.ast
new file mode 100644
index 0000000..ab52c9a
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete-rtree-secondary-index.ast
@@ -0,0 +1,15 @@
+DataverseUse test
+TypeDecl MyRecord [
+  closed RecordType {
+    id : int32,
+    point : point,
+    kwds : string,
+    line1 : line,
+    line2 : line,
+    poly1 : polygon,
+    poly2 : polygon,
+    rec : rectangle,
+    circle : circle
+  }
+]
+DatasetDecl MyData(MyRecord) partitioned by [[id]]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete.ast
new file mode 100644
index 0000000..ef75bcb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-delete.ast
@@ -0,0 +1,30 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32,
+    l_linenumber : int32,
+    l_quantity : double,
+    l_extendedprice : double,
+    l_discount : double,
+    l_tax : double,
+    l_returnflag : string,
+    l_linestatus : string,
+    l_shipdate : string,
+    l_commitdate : string,
+    l_receiptdate : string,
+    l_shipinstruct : string,
+    l_shipmode : string,
+    l_comment : string
+  }
+]
+TypeDecl LineIDType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32
+  }
+]
+DatasetDecl LineItems_q1(LineItemType) partitioned by [[l_orderkey]]
+DatasetDecl LineID(LineIDType) partitioned by [[l_orderkey]]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert-secondary-index.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert-secondary-index.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert-secondary-index.ast
new file mode 100644
index 0000000..ef75bcb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert-secondary-index.ast
@@ -0,0 +1,30 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32,
+    l_linenumber : int32,
+    l_quantity : double,
+    l_extendedprice : double,
+    l_discount : double,
+    l_tax : double,
+    l_returnflag : string,
+    l_linestatus : string,
+    l_shipdate : string,
+    l_commitdate : string,
+    l_receiptdate : string,
+    l_shipinstruct : string,
+    l_shipmode : string,
+    l_comment : string
+  }
+]
+TypeDecl LineIDType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32
+  }
+]
+DatasetDecl LineItems_q1(LineItemType) partitioned by [[l_orderkey]]
+DatasetDecl LineID(LineIDType) partitioned by [[l_orderkey]]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert.ast
new file mode 100644
index 0000000..ef75bcb
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/scan-insert.ast
@@ -0,0 +1,30 @@
+DataverseUse tpch
+TypeDecl LineItemType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32,
+    l_linenumber : int32,
+    l_quantity : double,
+    l_extendedprice : double,
+    l_discount : double,
+    l_tax : double,
+    l_returnflag : string,
+    l_linestatus : string,
+    l_shipdate : string,
+    l_commitdate : string,
+    l_receiptdate : string,
+    l_shipinstruct : string,
+    l_shipmode : string,
+    l_comment : string
+  }
+]
+TypeDecl LineIDType [
+  closed RecordType {
+    l_orderkey : int32,
+    l_partkey : int32,
+    l_suppkey : int32
+  }
+]
+DatasetDecl LineItems_q1(LineItemType) partitioned by [[l_orderkey]]
+DatasetDecl LineID(LineIDType) partitioned by [[l_orderkey]]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast
new file mode 100644
index 0000000..9e0d9ac
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_01.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+  :=
+  FunctionCall test.edit-distance@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=authors
+    ]
+    LiteralExpr [STRING] [Michael J. Carey]
+  ]
+Where
+  OperatorExpr [
+    Variable [ Name=ed ]
+    <=
+    LiteralExpr [LONG] [2]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast
new file mode 100644
index 0000000..9e04619
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_02.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+  :=
+  FunctionCall test.edit-distance@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=authors
+    ]
+    LiteralExpr [STRING] [Michael J. Carey]
+  ]
+Where
+  OperatorExpr [
+    LiteralExpr [LONG] [2]
+    >=
+    Variable [ Name=ed ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast
new file mode 100644
index 0000000..8a045ac
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_03.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_03.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+  :=
+  FunctionCall test.edit-distance@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=authors
+    ]
+    LiteralExpr [STRING] [Michael J. Carey]
+  ]
+Where
+  OperatorExpr [
+    Variable [ Name=ed ]
+    <
+    LiteralExpr [LONG] [3]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast
new file mode 100644
index 0000000..c79c629
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_04.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_04.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+  :=
+  FunctionCall test.edit-distance@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=authors
+    ]
+    LiteralExpr [STRING] [Michael J. Carey]
+  ]
+Where
+  OperatorExpr [
+    LiteralExpr [LONG] [3]
+    >
+    Variable [ Name=ed ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast
new file mode 100644
index 0000000..080a508
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_05.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_05.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+  :=
+  FunctionCall test.edit-distance@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=authors
+    ]
+    LiteralExpr [STRING] [Michael J. Carey]
+  ]
+Where
+  OperatorExpr [
+    Variable [ Name=ed ]
+    >=
+    LiteralExpr [LONG] [2]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast
new file mode 100644
index 0000000..9dfd7fa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_06.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_06.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+  :=
+  FunctionCall test.edit-distance@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=authors
+    ]
+    LiteralExpr [STRING] [Michael J. Carey]
+  ]
+Where
+  OperatorExpr [
+    LiteralExpr [LONG] [2]
+    <=
+    Variable [ Name=ed ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast
new file mode 100644
index 0000000..3595d15
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_07.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_07.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+  :=
+  FunctionCall test.edit-distance@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=authors
+    ]
+    LiteralExpr [STRING] [Michael J. Carey]
+  ]
+Where
+  OperatorExpr [
+    Variable [ Name=ed ]
+    >
+    LiteralExpr [LONG] [2]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast
new file mode 100644
index 0000000..eb03e16
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-let-to-edit-distance-check_08.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-let-to-edit-distance-check_08.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=ed ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+LetVariable [ Name=ed ]
+  :=
+  FunctionCall test.edit-distance@2[
+    FieldAccessor [
+      Variable [ Name=o ]
+      Field=authors
+    ]
+    LiteralExpr [STRING] [Michael J. Carey]
+  ]
+Where
+  OperatorExpr [
+    LiteralExpr [LONG] [2]
+    <
+    Variable [ Name=ed ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast
new file mode 100644
index 0000000..8b4917e
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_01.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_01.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+Where
+  OperatorExpr [
+    FunctionCall test.edit-distance@2[
+      FieldAccessor [
+        Variable [ Name=o ]
+        Field=authors
+      ]
+      LiteralExpr [STRING] [Michael J. Carey]
+    ]
+    <=
+    LiteralExpr [LONG] [2]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast
new file mode 100644
index 0000000..0217bad
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_02.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_02.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+Where
+  OperatorExpr [
+    LiteralExpr [LONG] [2]
+    >=
+    FunctionCall test.edit-distance@2[
+      FieldAccessor [
+        Variable [ Name=o ]
+        Field=authors
+      ]
+      LiteralExpr [STRING] [Michael J. Carey]
+    ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast
new file mode 100644
index 0000000..fe8097c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_03.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_03.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+Where
+  OperatorExpr [
+    FunctionCall test.edit-distance@2[
+      FieldAccessor [
+        Variable [ Name=o ]
+        Field=authors
+      ]
+      LiteralExpr [STRING] [Michael J. Carey]
+    ]
+    <
+    LiteralExpr [LONG] [3]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast
new file mode 100644
index 0000000..684dc9c
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_04.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_04.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+Where
+  OperatorExpr [
+    LiteralExpr [LONG] [3]
+    >
+    FunctionCall test.edit-distance@2[
+      FieldAccessor [
+        Variable [ Name=o ]
+        Field=authors
+      ]
+      LiteralExpr [STRING] [Michael J. Carey]
+    ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast
new file mode 100644
index 0000000..5fc23b4
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_05.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_05.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+Where
+  OperatorExpr [
+    FunctionCall test.edit-distance@2[
+      FieldAccessor [
+        Variable [ Name=o ]
+        Field=authors
+      ]
+      LiteralExpr [STRING] [Michael J. Carey]
+    ]
+    >=
+    LiteralExpr [LONG] [2]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast
new file mode 100644
index 0000000..9afcb14
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_06.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_06.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+Where
+  OperatorExpr [
+    LiteralExpr [LONG] [2]
+    <=
+    FunctionCall test.edit-distance@2[
+      FieldAccessor [
+        Variable [ Name=o ]
+        Field=authors
+      ]
+      LiteralExpr [STRING] [Michael J. Carey]
+    ]
+  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast
new file mode 100644
index 0000000..92b6dfd
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/similarity/edit-distance-to-edit-distance-check_07.ast
@@ -0,0 +1,34 @@
+DataverseUse test
+TypeDecl DBLPType [
+  closed RecordType {
+    id : int32,
+    dblpid : string,
+    title : string,
+    authors : string,
+    misc : string
+  }
+]
+DatasetDecl DBLP(DBLPType) partitioned by [[id]]
+WriteOutputTo nc1:rttest/similarity_edit-distance-to-edit-distance-check_07.adm
+Query:
+SELECT ELEMENT [
+Variable [ Name=o ]
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [DBLP]
+  ]
+  AS
+  Variable [ Name=o ]
+]
+Where
+  OperatorExpr [
+    FunctionCall test.edit-distance@2[
+      FieldAccessor [
+        Variable [ Name=o ]
+        Field=authors
+      ]
+      LiteralExpr [STRING] [Michael J. Carey]
+    ]
+    >
+    LiteralExpr [LONG] [2]
+  ]



Mime
View raw message