ASTERIXDB-1128: add TPC-H queries with secondary indices into build tests.

Change-Id: I4237ca17d5e334959a320ed92fcdccf51cc4856d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/704
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/distinct_by/distinct_by.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/distinct_by/distinct_by.1.ddl.sqlpp
new file mode 100644
index 0000000..86fe00c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/distinct_by/distinct_by.1.ddl.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/distinct_by/distinct_by.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/distinct_by/distinct_by.2.update.sqlpp
new file mode 100644
index 0000000..8353a07
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/distinct_by/distinct_by.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/distinct_by/distinct_by.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/distinct_by/distinct_by.3.query.sqlpp
new file mode 100644
index 0000000..da0745e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/distinct_by/distinct_by.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select distinct element {'l_returnflag':l.l_returnflag,'l_linestatus':l.l_linestatus,'l_shipmode':l.l_shipmode}
+from  LineItem as l
+order by l.l_returnflag,l.l_linestatus,l.l_shipmode
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.1.ddl.sqlpp
new file mode 100644
index 0000000..d2ca9f7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.1.ddl.sqlpp
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.2.update.sqlpp
new file mode 100644
index 0000000..24ff26a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+use tpch;
+
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.3.query.sqlpp
new file mode 100644
index 0000000..3a015ae
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.3.query.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+use tpch;
+
+
+select element {'nation_key':nation.n_nationkey,'name':nation.n_name,'aggregates':(
+        select element {'order_date':orderdate,'sum_price':sum}
+        from  Orders as orders,
+              Customer as customer
+        where ((orders.o_custkey = customer.c_custkey) and (customer.c_nationkey = nation.n_nationkey))
+        group by orders.o_orderdate as orderdate
+        with  sum as tpch.sum((
+              select element o.o_totalprice
+              from  orders as o
+          ))
+        order by sum
+        limit 3
+    )}
+from  Nation as nation,
+      SelectedNation as sn
+where (nation.n_nationkey /*+ indexnl */ = sn.n_nationkey)
+order by nation.n_nationkey
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp
new file mode 100644
index 0000000..d2ca9f7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.2.update.sqlpp
new file mode 100644
index 0000000..24ff26a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+use tpch;
+
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.3.query.sqlpp
new file mode 100644
index 0000000..1aa687c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.3.query.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+use tpch;
+
+
+select element {'nation_key':nation.n_nationkey,'name':nation.n_name,'aggregates':(
+        select element orderdate
+        from  Orders as orders,
+              Customer as customer
+        where ((orders.o_custkey = customer.c_custkey) and (customer.c_nationkey = nation.n_nationkey))
+        group by orders.o_orderdate as orderdate
+        with  sum as tpch.sum((
+              select element o.o_totalprice
+              from  orders as o
+          ))
+        order by sum
+        limit 3
+    )}
+from  Nation as nation,
+      SelectedNation as sn
+where (nation.n_nationkey /*+ indexnl */ = sn.n_nationkey)
+order by nation.n_nationkey
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp
new file mode 100644
index 0000000..935e489
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  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
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.2.update.sqlpp
new file mode 100644
index 0000000..8353a07
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
new file mode 100644
index 0000000..94b313f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+set "import-private-functions" "true";
+
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'sum_qty':tpch.sum((
+        select element i.l_quantity
+        from  l as i
+    )),'sum_base_price':tpch.sum((
+        select element i.l_extendedprice
+        from  l as i
+    )),'sum_disc_price':tpch.sum((
+        select element (i.l_extendedprice * (1 - i.l_discount))
+        from  l as i
+    )),'sum_charge':tpch.sum((
+        select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
+        from  l as i
+    )),'ave_qty':tpch.avg((
+        select element i.l_quantity
+        from  l as i
+    )),'ave_price':tpch.avg((
+        select element i.l_extendedprice
+        from  l as i
+    )),'ave_disc':tpch.avg((
+        select element i.l_discount
+        from  l as i
+    )),'count_order':tpch.count(l)}
+from  LineItem as l
+where (l.l_shipdate <= '1998-09-02')
+/* +hash */
+group by l.l_returnflag as l_returnflag,l.l_linestatus as l_linestatus
+order by l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp
new file mode 100644
index 0000000..f50eb7c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
new file mode 100644
index 0000000..a55c74d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function tmp1() {
+(
+    select element {'s_acctbal':pssrn.s_acctbal,'s_name':pssrn.s_name,'n_name':pssrn.n_name,'p_partkey':p.p_partkey,'ps_supplycost':pssrn.ps_supplycost,'p_mfgr':p.p_mfgr,'s_address':pssrn.s_address,'s_phone':pssrn.s_phone,'s_comment':pssrn.s_comment}
+    from  Part as p,
+          (
+        select element {'n_name':srn.n_name,'p_partkey':ps.ps_partkey,'ps_supplycost':ps.ps_supplycost,'s_name':srn.s_name,'s_acctbal':srn.s_acctbal,'s_address':srn.s_address,'s_phone':srn.s_phone,'s_comment':srn.s_comment}
+        from  Partsupp as ps,
+              (
+            select element {'s_suppkey':s.s_suppkey,'n_name':rn.n_name,'s_name':s.s_name,'s_acctbal':s.s_acctbal,'s_address':s.s_address,'s_phone':s.s_phone,'s_comment':s.s_comment}
+            from  Supplier as s,
+                  (
+                select element {'n_nationkey':n.n_nationkey,'n_name':n.n_name}
+                from  Region as r,
+                      Nation as n
+                where ((n.n_regionkey = r.r_regionkey) and (r.r_name = 'EUROPE'))
+            ) as rn
+            where (s.s_nationkey = rn.n_nationkey)
+        ) as srn
+        where (srn.s_suppkey = ps.ps_suppkey)
+    ) as pssrn
+    where ((p.p_partkey = pssrn.p_partkey) and tpch.like(p.p_type,'%BRASS'))
+)
+};
+declare function tmp2() {
+(
+    select element {'p_partkey':p_partkey,'ps_min_supplycost':tpch.min((
+            select element i.ps_supplycost
+            from  pssrn as i
+        ))}
+    from  Part as p,
+          (
+        select element {'n_name':srn.n_name,'p_partkey':ps.ps_partkey,'ps_supplycost':ps.ps_supplycost,'s_name':srn.s_name,'s_acctbal':srn.s_acctbal,'s_address':srn.s_address,'s_phone':srn.s_phone,'s_comment':srn.s_comment}
+        from  Partsupp as ps,
+              (
+            select element {'s_suppkey':s.s_suppkey,'n_name':rn.n_name,'s_name':s.s_name,'s_acctbal':s.s_acctbal,'s_address':s.s_address,'s_phone':s.s_phone,'s_comment':s.s_comment}
+            from  Supplier as s,
+                  (
+                select element {'n_nationkey':n.n_nationkey,'n_name':n.n_name}
+                from  Region as r,
+                      Nation as n
+                where ((n.n_regionkey = r.r_regionkey) and (r.r_name = 'EUROPE'))
+            ) as rn
+            where (s.s_nationkey = rn.n_nationkey)
+        ) as srn
+        where (srn.s_suppkey = ps.ps_suppkey)
+    ) as pssrn
+    where ((p.p_partkey = pssrn.p_partkey) and tpch.like(p.p_type,'%BRASS'))
+    /* +hash */
+    group by pssrn.p_partkey as p_partkey
+)
+};
+select element {'s_acctbal':t1.s_acctbal,'s_name':t1.s_name,'n_name':t1.n_name,'p_partkey':t1.p_partkey,'p_mfgr':t1.p_mfgr,'s_address':t1.s_address,'s_phone':t1.s_phone,'s_comment':t1.s_comment}
+from  tpch.tmp2() as t2,
+      tpch.tmp1() as t1
+where ((t1.p_partkey = t2.p_partkey) and (t1.ps_supplycost = t2.ps_min_supplycost))
+order by t1.s_acctbal desc,t1.n_name,t1.s_name,t1.p_partkey
+limit 100
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.2.update.sqlpp
new file mode 100644
index 0000000..e27ea4e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.2.update.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
new file mode 100644
index 0000000..d30c6d3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'l_orderkey':l_orderkey,'revenue':revenue,'o_orderdate':o_orderdate,'o_shippriority':o_shippriority}
+from  Customer as c,
+      Orders as o,
+      LineItem as l
+where (((c.c_mktsegment = 'BUILDING') and (c.c_custkey = o.o_custkey)) and ((l.l_orderkey = o.o_orderkey) and (o.o_orderdate < '1995-03-15') and (l.l_shipdate > '1995-03-15')))
+/* +hash */
+group by l.l_orderkey as l_orderkey,o.o_orderdate as o_orderdate,o.o_shippriority as o_shippriority
+with  revenue as tpch.sum((
+      select element (i.l_extendedprice * (1 - i.l_discount))
+      from  l as i
+  ))
+order by revenue desc,o_orderdate
+limit 10
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q04_order_priority/q04_order_priority.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q04_order_priority/q04_order_priority.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q04_order_priority/q04_order_priority.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q04_order_priority/q04_order_priority.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q04_order_priority/q04_order_priority.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q04_order_priority/q04_order_priority.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q04_order_priority/q04_order_priority.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q04_order_priority/q04_order_priority.3.query.sqlpp
new file mode 100644
index 0000000..f693ba3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q04_order_priority/q04_order_priority.3.query.sqlpp
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function tmp() {
+(
+    select distinct element {'o_orderkey':l.l_orderkey}
+    from  LineItem as l
+    where (l.l_commitdate < l.l_receiptdate)
+)
+};
+select element {'order_priority':o_orderpriority,'count':count(o)}
+from  Orders as o join
+      tpch.tmp() as t on o.o_orderkey = t.o_orderkey
+where o.o_orderdate >= '1993-07-01' and o.o_orderdate < '1993-10-01'
+group by o.o_orderpriority as o_orderpriority
+order by o_orderpriority
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
new file mode 100644
index 0000000..150e4b1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'n_name':n_name,'revenue':revenue}
+from  Customer as c,
+      (
+    select element {'n_name':l1.n_name,'l_extendedprice':l1.l_extendedprice,'l_discount':l1.l_discount,'s_nationkey':l1.s_nationkey,'o_custkey':o.o_custkey}
+    from  Orders as o,
+          (
+        select element {'n_name':s1.n_name,'l_extendedprice':l.l_extendedprice,'l_discount':l.l_discount,'l_orderkey':l.l_orderkey,'s_nationkey':s1.s_nationkey}
+        from  LineItem as l,
+              (
+            select element {'n_name':n1.n_name,'s_suppkey':s.s_suppkey,'s_nationkey':s.s_nationkey}
+            from  Supplier as s,
+                  (
+                select element {'n_name':n.n_name,'n_nationkey':n.n_nationkey}
+                from  Nation as n,
+                      Region as r
+                where (n.n_regionkey = r.r_regionkey)
+            ) as n1
+            where (s.s_nationkey = n1.n_nationkey)
+        ) as s1
+        where (l.l_suppkey = s1.s_suppkey)
+    ) as l1
+    where ((l1.l_orderkey = o.o_orderkey) and (o.o_orderdate >= '1990-01-01') and (o.o_orderdate < '1995-01-01'))
+) as o1
+where ((c.c_nationkey = o1.s_nationkey) and (c.c_custkey = o1.o_custkey))
+/* +hash */
+group by o1.n_name as n_name
+with  revenue as tpch.sum((
+      select element (i.l_extendedprice * (1 - i.l_discount))
+      from  o1 as i
+  ))
+order by revenue desc
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp
new file mode 100644
index 0000000..46ee240
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
new file mode 100644
index 0000000..9dee61f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+{'revenue':tpch.sum((
+    select element (l.l_extendedprice * l.l_discount)
+    from  LineItem as l
+    where ((l.l_shipdate >= '1994-01-01') and (l.l_shipdate < '1995-01-01') and (l.l_discount >= 0.05) and (l.l_discount <= 0.07) and (l.l_quantity < 24))
+))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
new file mode 100644
index 0000000..74d3b5a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function q7_volume_shipping_tmp() {
+(
+    select element {'supp_nation':n1.n_name,'cust_nation':n2.n_name,'s_nationkey':n1.n_nationkey,'c_nationkey':n2.n_nationkey}
+    from  Nation as n1,
+          Nation as n2
+    where ((n2.n_name = 'GERMANY') or (n1.n_name = 'GERMANY'))
+)
+};
+select element {'supp_nation':supp_nation,'cust_nation':cust_nation,'l_year':l_year,'revenue':revenue}
+from  (
+    select element {'l_shipdate':loc.l_shipdate,'l_extendedprice':loc.l_extendedprice,'l_discount':loc.l_discount,'c_nationkey':loc.c_nationkey,'s_nationkey':s.s_nationkey}
+    from  (
+        select element {'l_shipdate':lo.l_shipdate,'l_extendedprice':lo.l_extendedprice,'l_discount':lo.l_discount,'l_suppkey':lo.l_suppkey,'c_nationkey':c.c_nationkey}
+        from  (
+            select element {'l_shipdate':l.l_shipdate,'l_extendedprice':l.l_extendedprice,'l_discount':l.l_discount,'l_suppkey':l.l_suppkey,'o_custkey':o.o_custkey}
+            from  LineItem as l,
+                  Orders as o
+            where ((o.o_orderkey = l.l_orderkey) and (l.l_shipdate >= '1992-01-01') and (l.l_shipdate <= '1996-12-31'))
+        ) as lo,
+              Customer as c
+        where (c.c_custkey = lo.o_custkey)
+    ) as loc,
+          Supplier as s
+    where (s.s_suppkey = loc.l_suppkey)
+) as locs,
+      tpch.q7_volume_shipping_tmp() as t
+with  l_year0 as tpch."get-year"(locs.l_shipdate)
+where ((locs.c_nationkey = t.c_nationkey) and (locs.s_nationkey = t.s_nationkey))
+group by t.supp_nation as supp_nation,t.cust_nation as cust_nation,l_year0 as l_year
+with  revenue as tpch.sum((
+      select element (i.l_extendedprice * (1 - i.l_discount))
+      from  locs as i
+  ))
+order by supp_nation,cust_nation,l_year
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.3.query.sqlpp
new file mode 100644
index 0000000..77d3881
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.3.query.sqlpp
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'year':year,'mkt_share':(tpch.sum((
+          select element tpch."switch-case"((i.s_name = 'BRAZIL'),true,i.revenue,false,0.0)
+          from  t as i
+      )) / tpch.sum((
+          select element i.revenue
+          from  t as i
+      )))}
+from  (
+    select element {'year':o_year,'revenue':(slnrcop.l_extendedprice * (1 - slnrcop.l_discount)),'s_name':n2.n_name}
+    from  (
+        select element {'o_orderdate':lnrcop.o_orderdate,'l_discount':lnrcop.l_discount,'l_extendedprice':lnrcop.l_extendedprice,'l_suppkey':lnrcop.l_suppkey,'s_nationkey':s.s_nationkey}
+        from  Supplier as s,
+              (
+            select element {'o_orderdate':lnrco.o_orderdate,'l_discount':lnrco.l_discount,'l_extendedprice':lnrco.l_extendedprice,'l_suppkey':lnrco.l_suppkey}
+            from  (
+                select element {'o_orderdate':nrco.o_orderdate,'l_partkey':l.l_partkey,'l_discount':l.l_discount,'l_extendedprice':l.l_extendedprice,'l_suppkey':l.l_suppkey}
+                from  LineItem as l,
+                      (
+                    select element {'o_orderdate':o.o_orderdate,'o_orderkey':o.o_orderkey}
+                    from  Orders as o,
+                          (
+                        select element {'c_custkey':c.c_custkey}
+                        from  Customer as c,
+                              (
+                            select element {'n_nationkey':n1.n_nationkey}
+                            from  Nation as n1,
+                                  Region as r1
+                            where ((n1.n_regionkey = r1.r_regionkey) and (r1.r_name = 'AMERICA'))
+                        ) as nr
+                        where (c.c_nationkey = nr.n_nationkey)
+                    ) as nrc
+                    where (nrc.c_custkey = o.o_custkey)
+                ) as nrco
+                where ((l.l_orderkey = nrco.o_orderkey) and (nrco.o_orderdate >= '1995-01-01') and (nrco.o_orderdate < '1996-12-31'))
+            ) as lnrco,
+                  Part as p
+            where ((p.p_partkey = lnrco.l_partkey) and (p.p_type = 'ECONOMY ANODIZED STEEL'))
+        ) as lnrcop
+        where (s.s_suppkey = lnrcop.l_suppkey)
+    ) as slnrcop,
+          Nation as n2
+    with  o_year as tpch."get-year"(slnrcop.o_orderdate)
+    where (slnrcop.s_nationkey = n2.n_nationkey)
+) as t
+group by t.year as year
+order by year
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
new file mode 100644
index 0000000..b7e5e4b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'nation':nation,'o_year':o_year,'sum_profit':tpch.sum((
+        select element pr.amount
+        from  profit as pr
+    ))}
+from  (
+    select element {'nation':l3.n_name,'o_year':o_year,'amount':amount}
+    from  Orders as o,
+          (
+        select element {'l_extendedprice':l2.l_extendedprice,'l_discount':l2.l_discount,'l_quantity':l2.l_quantity,'l_orderkey':l2.l_orderkey,'n_name':l2.n_name,'ps_supplycost':l2.ps_supplycost}
+        from  Part as p join
+              (
+            select element {'l_extendedprice':l1.l_extendedprice,'l_discount':l1.l_discount,'l_quantity':l1.l_quantity,'l_partkey':l1.l_partkey,'l_orderkey':l1.l_orderkey,'n_name':l1.n_name,'ps_supplycost':ps.ps_supplycost}
+            from  Partsupp as ps join
+                  (
+                select element {'l_suppkey':l.l_suppkey,'l_extendedprice':l.l_extendedprice,'l_discount':l.l_discount,'l_quantity':l.l_quantity,'l_partkey':l.l_partkey,'l_orderkey':l.l_orderkey,'n_name':s1.n_name}
+                from  (
+                    select element {'s_suppkey':s.s_suppkey,'n_name':n.n_name}
+                    from  Supplier as s,
+                          Nation as n
+                    where (n.n_nationkey = s.s_nationkey)
+                ) as s1 join
+                      LineItem as l
+                on (s1.s_suppkey = l.l_suppkey)
+            ) as l1
+            on ((ps.ps_suppkey = l1.l_suppkey) and (ps.ps_partkey = l1.l_partkey))
+        ) as l2
+         on (tpch.contains(p.p_name,'green') and (p.p_partkey = l2.l_partkey))
+    ) as l3
+    with  amount as ((l3.l_extendedprice * (1 - l3.l_discount)) - (l3.ps_supplycost * l3.l_quantity)),
+          o_year as tpch."get-year"(o.o_orderdate)
+    where (o.o_orderkey = l3.l_orderkey)
+) as profit
+group by profit.nation as nation,profit.o_year as o_year
+order by nation,o_year desc
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.2.update.sqlpp
new file mode 100644
index 0000000..42bbece
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.3.query.sqlpp
new file mode 100644
index 0000000..50fb6c3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.3.query.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'c_custkey':c_custkey,'c_name':c_name,'revenue':revenue,'c_acctbal':c_acctbal,'n_name':n_name,'c_address':c_address,'c_phone':c_phone,'c_comment':c_comment}
+from  (
+    select element {'c_custkey':ocn.c_custkey,'c_name':ocn.c_name,'c_acctbal':ocn.c_acctbal,'n_name':ocn.n_name,'c_address':ocn.c_address,'c_phone':ocn.c_phone,'c_comment':ocn.c_comment,'l_extendedprice':l.l_extendedprice,'l_discount':l.l_discount}
+    from  LineItem as l,
+          (
+        select element {'c_custkey':c.c_custkey,'c_name':c.c_name,'c_acctbal':c.c_acctbal,'n_name':n.n_name,'c_address':c.c_address,'c_phone':c.c_phone,'c_comment':c.c_comment,'o_orderkey':o.o_orderkey}
+        from  Orders as o,
+              Customer as c,
+              Nation as n
+        where (((c.c_custkey = o.o_custkey) and (o.o_orderdate >= '1993-10-01') and (o.o_orderdate < '1994-01-01')) and (c.c_nationkey = n.n_nationkey))
+    ) as ocn
+    where ((l.l_orderkey = ocn.o_orderkey) and (l.l_returnflag = 'R'))
+) as locn
+group by locn.c_custkey as c_custkey,locn.c_name as c_name,locn.c_acctbal as c_acctbal,locn.c_phone as c_phone,locn.n_name as n_name,locn.c_address as c_address,locn.c_comment as c_comment
+with  revenue as tpch.sum((
+      select element (i.l_extendedprice * (1 - i.l_discount))
+      from  locn as i
+  ))
+order by revenue desc
+limit 20
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
new file mode 100644
index 0000000..50fb6c3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'c_custkey':c_custkey,'c_name':c_name,'revenue':revenue,'c_acctbal':c_acctbal,'n_name':n_name,'c_address':c_address,'c_phone':c_phone,'c_comment':c_comment}
+from  (
+    select element {'c_custkey':ocn.c_custkey,'c_name':ocn.c_name,'c_acctbal':ocn.c_acctbal,'n_name':ocn.n_name,'c_address':ocn.c_address,'c_phone':ocn.c_phone,'c_comment':ocn.c_comment,'l_extendedprice':l.l_extendedprice,'l_discount':l.l_discount}
+    from  LineItem as l,
+          (
+        select element {'c_custkey':c.c_custkey,'c_name':c.c_name,'c_acctbal':c.c_acctbal,'n_name':n.n_name,'c_address':c.c_address,'c_phone':c.c_phone,'c_comment':c.c_comment,'o_orderkey':o.o_orderkey}
+        from  Orders as o,
+              Customer as c,
+              Nation as n
+        where (((c.c_custkey = o.o_custkey) and (o.o_orderdate >= '1993-10-01') and (o.o_orderdate < '1994-01-01')) and (c.c_nationkey = n.n_nationkey))
+    ) as ocn
+    where ((l.l_orderkey = ocn.o_orderkey) and (l.l_returnflag = 'R'))
+) as locn
+group by locn.c_custkey as c_custkey,locn.c_name as c_name,locn.c_acctbal as c_acctbal,locn.c_phone as c_phone,locn.n_name as n_name,locn.c_address as c_address,locn.c_comment as c_comment
+with  revenue as tpch.sum((
+      select element (i.l_extendedprice * (1 - i.l_discount))
+      from  locn as i
+  ))
+order by revenue desc
+limit 20
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.3.query.sqlpp
new file mode 100644
index 0000000..ea3bd5a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.3.query.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+with  sum as tpch.sum((
+      select element (ps.ps_supplycost * ps.ps_availqty)
+      from  Partsupp as ps,
+            (
+          select element {'s_suppkey':s.s_suppkey}
+          from  Supplier as s,
+                Nation as n
+          where (s.s_nationkey = n.n_nationkey)
+      ) as sn
+      where (ps.ps_suppkey = sn.s_suppkey)
+  ))
+select element {'partkey':t1.ps_partkey,'part_value':t1.part_value}
+from  (
+    select element {'ps_partkey':ps_partkey,'part_value':tpch.sum((
+            select element (i.ps_supplycost * i.ps_availqty)
+            from  ps as i
+        ))}
+    from  Partsupp as ps,
+          (
+        select element {'s_suppkey':s.s_suppkey}
+        from  Supplier as s,
+              Nation as n
+        where (s.s_nationkey = n.n_nationkey)
+    ) as sn
+    where (ps.ps_suppkey = sn.s_suppkey)
+    group by ps.ps_partkey as ps_partkey
+) as t1
+where (t1.part_value > (sum * 0.00001))
+order by t1.part_value desc
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.3.query.sqlpp
new file mode 100644
index 0000000..61b685e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.3.query.sqlpp
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'l_shipmode':l_shipmode,'high_line_count':tpch.sum((
+        select element tpch."switch-case"(((i.o_orderpriority = '1-URGENT') or (i.o_orderpriority = '2-HIGH')),true,1,false,0)
+        from  o as i
+    )),'low_line_count':tpch.sum((
+        select element tpch."switch-case"(((i.o_orderpriority = '1-URGENT') or (i.o_orderpriority = '2-HIGH')),true,0,false,1)
+        from  o as i
+    ))}
+from  LineItem as l,
+      Orders as o
+where ((o.o_orderkey = l.l_orderkey) and (l.l_commitdate < l.l_receiptdate) and (l.l_shipdate < l.l_commitdate) and (l.l_receiptdate >= '1994-01-01') and (l.l_receiptdate < '1995-01-01') and ((l.l_shipmode = 'MAIL') or (l.l_shipmode = 'SHIP')))
+group by l.l_shipmode as l_shipmode
+order by l_shipmode
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
new file mode 100644
index 0000000..afa7c9b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+set "import-private-functions" "true";
+
+select element {'c_count':c_count,'custdist':custdist}
+from  (
+    select element {'c_custkey':c_custkey,'c_count':tpch.sum((
+            select element i.o_orderkey_count
+            from  co as i
+        ))}
+    from  (
+        select element {'c_custkey':c.c_custkey,'o_orderkey_count':tpch.count((
+                select element o.o_orderkey
+                from  Orders as o
+                where ((c.c_custkey = o.o_custkey) and tpch.not(tpch.like(o.o_comment,'%special%requests%')))
+            ))}
+        from  Customer as c
+    ) as co
+    group by co.c_custkey as c_custkey
+) as gco
+group by gco.c_count as c_count
+with  custdist as tpch.count(gco)
+order by custdist desc,c_count desc
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
new file mode 100644
index 0000000..559dfc8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element (100.0 * tpch.sum((
+      select element tpch."switch-case"(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
+      from  l as i
+  )) / tpch.sum((
+      select element (i.l_extendedprice * (1 - i.l_discount))
+      from  l as i
+  )))
+from  LineItem as l,
+      Part as p
+where ((l.l_partkey = p.p_partkey) and (l.l_shipdate >= '1995-09-01') and (l.l_shipdate < '1995-10-01'))
+group by 1 as t
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.3.query.sqlpp
new file mode 100644
index 0000000..e21104b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.3.query.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function revenue() {
+(
+    select element {'supplier_no':l_suppkey,'total_revenue':tpch.sum((
+            select element (i.l_extendedprice * (1 - i.l_discount))
+            from  l as i
+        ))}
+    from  LineItem as l
+    where ((l.l_shipdate >= '1996-01-01') and (l.l_shipdate < '1996-04-01'))
+    group by l.l_suppkey as l_suppkey
+)
+};
+with  m as tpch.max((
+      select element r2.total_revenue
+      from  tpch.revenue() as r2
+  ))
+select element {'s_suppkey':s.s_suppkey,'s_name':s.s_name,'s_address':s.s_address,'s_phone':s.s_phone,'total_revenue':r.total_revenue}
+from  Supplier as s,
+      tpch.revenue() as r
+where ((s.s_suppkey = r.supplier_no) and (r.total_revenue < (m + 0.000000001)) and (r.total_revenue > (m - 0.000000001)))
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
new file mode 100644
index 0000000..cc4d01a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function tmp() {
+(
+    select element {'p_brand':psp.p_brand,'p_type':psp.p_type,'p_size':psp.p_size,'ps_suppkey':psp.ps_suppkey}
+    from  (
+        select element {'p_brand':p.p_brand,'p_type':p.p_type,'p_size':p.p_size,'ps_suppkey':ps.ps_suppkey}
+        from  Partsupp as ps,
+              Part as p
+        where ((p.p_partkey = ps.ps_partkey) and (p.p_brand != 'Brand#45') and tpch.not(tpch.like(p.p_type,'MEDIUM POLISHED%')))
+    ) as psp,
+          Supplier as s
+    where ((psp.ps_suppkey = s.s_suppkey) and tpch.not(tpch.like(s.s_comment,'%Customer%Complaints%')))
+)
+};
+select element {'p_brand':p_brand,'p_type':p_type,'p_size':p_size,'supplier_cnt':supplier_cnt}
+from  (
+    select element {'p_brand':p_brand1,'p_type':p_type1,'p_size':p_size1,'ps_suppkey':ps_suppkey1}
+    from  tpch.tmp() as t
+    where ((t.p_size = 49) or (t.p_size = 14) or (t.p_size = 23) or (t.p_size = 45) or (t.p_size = 19) or (t.p_size = 3) or (t.p_size = 36) or (t.p_size = 9))
+    group by t.p_brand as p_brand1,t.p_type as p_type1,t.p_size as p_size1,t.ps_suppkey as ps_suppkey1
+) as t2
+group by t2.p_brand as p_brand,t2.p_type as p_type,t2.p_size as p_size
+with  supplier_cnt as tpch.count((
+      select element i.ps_suppkey
+      from  t2 as i
+  ))
+order by supplier_cnt desc,p_brand,p_type,p_size
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
new file mode 100644
index 0000000..ada4f75
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'t_partkey':l_partkey,'t_count':tpch.count(l),'t_avg_quantity':(0.2 * tpch.avg((
+          select element i.l_quantity
+          from  l as i
+      ))),'t_max_suppkey':tpch.max((
+        select element i.l_suppkey
+        from  l as i
+    )),'t_max_linenumber':tpch.max((
+        select element i.l_linenumber
+        from  l as i
+    )),'t_avg_extendedprice':tpch.avg((
+        select element i.l_extendedprice
+        from  l as i
+    )),'t_avg_discount':tpch.avg((
+        select element i.l_discount
+        from  l as i
+    )),'t_avg_tax':tpch.avg((
+        select element i.l_tax
+        from  l as i
+    )),'t_max_shipdate':tpch.max((
+        select element i.l_shipdate
+        from  l as i
+    )),'t_min_commitdate':tpch.min((
+        select element i.l_commitdate
+        from  l as i
+    )),'t_min_receiptdate':tpch.min((
+        select element i.l_receiptdate
+        from  l as i
+    )),'t_max_comment':tpch.max((
+        select element i.l_comment
+        from  l as i
+    ))}
+from  LineItem as l
+group by l.l_partkey as l_partkey
+order by l_partkey
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
new file mode 100644
index 0000000..79c397c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function tmp() {
+(
+    select element {'t_partkey':l_partkey,'t_avg_quantity':(0.2 * tpch.avg((
+              select element i.l_quantity
+              from  l as i
+          )))}
+    from  LineItem as l
+    group by l.l_partkey as l_partkey
+)
+};
+
+select element (tpch.sum((
+      select element l.l_extendedprice
+      from  tpch.tmp() as t,
+            LineItem as l,
+            Part as p
+      where p.p_partkey = l.l_partkey and p.p_container = 'MED BOX' and l.l_partkey = t.t_partkey and l.l_quantity < t.t_avg_quantity
+  )) / 7.0);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
new file mode 100644
index 0000000..89ff8f8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'c_name':c_name,'c_custkey':c_custkey,'o_orderkey':o_orderkey,'o_orderdate':o_orderdate,'o_totalprice':o_totalprice,'sum_quantity':tpch.sum((
+        select element j.l_quantity
+        from  l as j
+    ))}
+from  Customer as c,
+      Orders as o,
+      (
+    select element {'l_orderkey':l_orderkey,'t_sum_quantity':tpch.sum((
+            select element i.l_quantity
+            from  l as i
+        ))}
+    from  LineItem as l
+    group by l.l_orderkey as l_orderkey
+) as t,
+      LineItem as l
+where ((c.c_custkey = o.o_custkey) and (o.o_orderkey = t.l_orderkey) and (t.t_sum_quantity > 30) and (l.l_orderkey = t.l_orderkey))
+group by c.c_name as c_name,c.c_custkey as c_custkey,o.o_orderkey as o_orderkey,o.o_orderdate as o_orderdate,o.o_totalprice as o_totalprice
+order by o_totalprice desc,o_orderdate
+limit 100
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
new file mode 100644
index 0000000..7065f87
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+set "import-private-functions" "true";
+
+select element tpch.sum((
+    select element (l.l_extendedprice * (1 - l.l_discount))
+    from  LineItem as l,
+          Part as p
+    where ((p.p_partkey = l.l_partkey) and (((p.p_brand = 'Brand#12') and tpch."reg-exp"(p.p_container,'SM CASE||SM BOX||SM PACK||SM PKG') and (l.l_quantity >= 1) and (l.l_quantity <= 11) and (p.p_size >= 1) and (p.p_size <= 5) and tpch."reg-exp"(l.l_shipmode,'AIR||AIR REG') and (l.l_shipinstruct = 'DELIVER IN PERSON')) or ((p.p_brand = 'Brand#23') and tpch."reg-exp"(p.p_container,'MED BAG||MED BOX||MED PKG||MED PACK') and (l.l_quantity >= 10) and (l.l_quantity <= 20) and (p.p_size >= 1) and (p.p_size <= 10) and tpch."reg-exp"(l.l_shipmode,'AIR||AIR REG') and (l.l_shipinstruct = 'DELIVER IN PERSON')) or ((p.p_brand = 'Brand#34') and tpch."reg-exp"(p.p_container,'LG CASE||LG BOX||LG PACK||LG PKG') and (l.l_quantity >= 20) and (l.l_quantity <= 30) and (p.p_size >= 1) and (p.p_size <= 15) and tpch."reg-exp"(l.l_shipmode,'AIR||AIR REG') and (l.l_shipinstruct = 'DELIVER IN PERSON'))))
+));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
new file mode 100644
index 0000000..0657ad3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+select element {'s_name':t4.s_name,'s_address':t4.s_address}
+from  (
+    select distinct element {'ps_suppkey':pst1.ps_suppkey}
+    from  (
+        select element {'l_partkey':l_partkey,'l_suppkey':l_suppkey,'sum_quantity':(0.5 * tpch.sum((
+                  select element i.l_quantity
+                  from  l as i
+              )))}
+        from  LineItem as l
+        group by l.l_partkey as l_partkey,l.l_suppkey as l_suppkey
+    ) as t2,
+          (
+        select element {'ps_suppkey':ps.ps_suppkey,'ps_partkey':ps.ps_partkey,'ps_availqty':ps.ps_availqty}
+        from  Partsupp as ps,
+              (
+            select distinct element {'p_partkey':p.p_partkey}
+            from  Part as p
+        ) as t1
+        where (ps.ps_partkey = t1.p_partkey)
+    ) as pst1
+    where ((pst1.ps_partkey = t2.l_partkey) and (pst1.ps_suppkey = t2.l_suppkey) and (pst1.ps_availqty > t2.sum_quantity))
+) as t3,
+      (
+    select element {'s_name':s.s_name,'s_address':s.s_address,'s_suppkey':s.s_suppkey}
+    from  Nation as n,
+          Supplier as s
+    where (s.s_nationkey = n.n_nationkey)
+) as t4
+where (t3.ps_suppkey = t4.s_suppkey)
+order by t4.s_name
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.ddl.sqlpp
new file mode 100644
index 0000000..0fdf4e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  l_quantity : int64,
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int64,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int64,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int64,
+  ps_suppkey : int64,
+  ps_availqty : int64,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp
new file mode 100644
index 0000000..f91068d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function tmp1() {
+(
+    select element {'l_orderkey':l_orderkey,'count_suppkey':tpch.count((
+            select element i.l_suppkey
+            from  l2 as i
+        )),'max_suppkey':tpch.max((
+            select element i.l_suppkey
+            from  l2 as i
+        ))}
+    from  (
+        select element {'l_orderkey':l_orderkey1,'l_suppkey':l_suppkey1}
+        from  LineItem as l
+        group by l.l_orderkey as l_orderkey1,l.l_suppkey as l_suppkey1
+    ) as l2
+    group by l2.l_orderkey as l_orderkey
+)
+};
+declare function tmp2() {
+(
+    select element {'l_orderkey':l_orderkey,'count_suppkey':tpch.count((
+            select element i.l_suppkey
+            from  l2 as i
+        )),'max_suppkey':tpch.max((
+            select element i.l_suppkey
+            from  l2 as i
+        ))}
+    from  (
+        select element {'l_orderkey':l_orderkey1,'l_suppkey':l_suppkey1}
+        from  LineItem as l
+        where (l.l_receiptdate > l.l_commitdate)
+        group by l.l_orderkey as l_orderkey1,l.l_suppkey as l_suppkey1
+    ) as l2
+    group by l2.l_orderkey as l_orderkey
+)
+};
+select element {'s_name':s_name,'numwait':numwait}
+from  (
+    select element {'s_name':t3.s_name,'l_suppkey':t3.l_suppkey,'l_orderkey':t2.l_orderkey,'count_suppkey':t2.count_suppkey,'max_suppkey':t2.max_suppkey}
+    from  (
+            select element {'s_name':ns.s_name,'l_orderkey':t1.l_orderkey,'l_suppkey':l.l_suppkey}
+            from  LineItem as l,
+                  (
+                        select element {'s_name':s.s_name,'s_suppkey':s.s_suppkey}
+                        from  Nation as n,
+                        Supplier as s
+                        where (s.s_nationkey = n.n_nationkey)
+                   ) as ns,
+                   Orders as o,
+                   tpch.tmp1() as t1
+            where ns.s_suppkey = l.l_suppkey and l.l_receiptdate > l.l_commitdate and o.o_orderkey = l.l_orderkey and l.l_orderkey = t1.l_orderkey
+    ) as t3,
+      tpch.tmp2() as t2
+    where ((t2.count_suppkey >= 0) and (t3.l_orderkey = t2.l_orderkey))
+) as t4
+group by t4.s_name as s_name
+with  numwait as tpch.count(t4)
+order by numwait desc,s_name
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.1.ddl.sqlpp
new file mode 100644
index 0000000..b881621
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.1.ddl.sqlpp
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.2.update.sqlpp
new file mode 100644
index 0000000..824fc6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.2.update.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
new file mode 100644
index 0000000..6136008
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+declare function q22_customer_tmp() {
+(
+    select element {'c_acctbal':c.c_acctbal,'c_custkey':c.c_custkey,'cntrycode':tpch.substring(c.c_phone,1,2)}
+    from  Customer as c
+)
+};
+with  avg as tpch.avg((
+      select element c.c_acctbal
+      from  Customer as c
+      where (c.c_acctbal > 0.0)
+  ))
+select element {'cntrycode':cntrycode,'numcust':tpch.count(ct),'totacctbal':tpch.sum((
+        select element i.c_acctbal
+        from  ct as i
+    ))}
+from  tpch.q22_customer_tmp() as ct
+where (ct.c_acctbal > avg)
+group by ct.cntrycode as cntrycode
+order by cntrycode
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.1.ddl.sqlpp
new file mode 100644
index 0000000..cabd3be
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.1.ddl.sqlpp
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue562
+ * https://code.google.com/p/asterixdb/issues/detail?id=562
+ * Expected Res : SUCCESS
+ * Date         : 15th Jan. 2015
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create type tpch.PartType as
+ closed {
+  p_partkey : int32,
+  p_name : string,
+  p_mfgr : string,
+  p_brand : string,
+  p_type : string,
+  p_size : int32,
+  p_container : string,
+  p_retailprice : double,
+  p_comment : string
+}
+
+create type tpch.PartSuppType as
+ closed {
+  ps_partkey : int32,
+  ps_suppkey : int32,
+  ps_availqty : int32,
+  ps_supplycost : double,
+  ps_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Part(PartType) primary key p_partkey;
+
+create  table Partsupp(PartSuppType) primary key ps_partkey,ps_suppkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index partsupp_fk_part on Partsupp (ps_partkey);
+create index partsupp_fk_supplier on Partsupp (ps_suppkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.2.update.sqlpp
new file mode 100644
index 0000000..9d5125c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.2.update.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue562
+ * https://code.google.com/p/asterixdb/issues/detail?id=562
+ * Expected Res : SUCCESS
+ * Date         : 15th Jan. 2015
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.3.query.sqlpp
new file mode 100644
index 0000000..ac54a30
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.3.query.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue562
+ * https://code.google.com/p/asterixdb/issues/detail?id=562
+ * Expected Res : SUCCESS
+ * Date         : 15th Jan. 2015
+ */
+
+use tpch;
+
+
+declare function q22_customer_tmp() {
+(
+    select element {'c_acctbal':c.c_acctbal,'c_custkey':c.c_custkey,'cntrycode':phone_substr}
+    from  Customer as c
+    with  phone_substr as tpch.substring(c.c_phone,1,2)
+    where ((phone_substr = '13') or (phone_substr = '31') or (phone_substr = '23') or (phone_substr = '29') or (phone_substr = '30') or (phone_substr = '18') or (phone_substr = '17'))
+)
+};
+with  avg as tpch.avg((
+      select element c.c_acctbal
+      from  Customer as c
+      with  phone_substr as tpch.substring(c.c_phone,1,2)
+      where ((c.c_acctbal > 0.0) and ((phone_substr = '13') or (phone_substr = '31') or (phone_substr = '23') or (phone_substr = '29') or (phone_substr = '30') or (phone_substr = '18') or (phone_substr = '17')))
+  ))
+select element {'cntrycode':cntrycode,'numcust':tpch.count(ct),'totacctbal':tpch.sum((
+        select element i.c_acctbal
+        from  ct as i
+    ))}
+from  tpch.q22_customer_tmp() as ct
+where (tpch.count((
+    select element o
+    from  Orders as o
+    where (ct.c_custkey = o.o_custkey)
+)) = 0)
+group by ct.cntrycode as cntrycode
+order by cntrycode
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue601/query-issue601.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue601/query-issue601.1.ddl.sqlpp
new file mode 100644
index 0000000..c925fd4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue601/query-issue601.1.ddl.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue601
+ * https://code.google.com/p/asterixdb/issues/detail?id=601
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int64,
+  l_partkey : int64,
+  l_suppkey : int64,
+  l_linenumber : int64,
+  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
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue601/query-issue601.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue601/query-issue601.2.update.sqlpp
new file mode 100644
index 0000000..4dab63a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue601/query-issue601.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue601
+ * https://code.google.com/p/asterixdb/issues/detail?id=601
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue601/query-issue601.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue601/query-issue601.3.query.sqlpp
new file mode 100644
index 0000000..efe6954
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue601/query-issue601.3.query.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue601
+ * https://code.google.com/p/asterixdb/issues/detail?id=601
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct 2014
+ */
+
+use tpch;
+
+
+select element {'l_linenumber':l_linenumber,'count_order':tpch.count(l)}
+from  LineItem as l
+group by l.l_linenumber as l_linenumber
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.1.ddl.sqlpp
new file mode 100644
index 0000000..2c8a9e5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.1.ddl.sqlpp
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.2.update.sqlpp
new file mode 100644
index 0000000..1c14a94
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+use tpch;
+
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.3.query.sqlpp
new file mode 100644
index 0000000..2cad6ea
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.3.query.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+use tpch;
+
+
+with  t as (
+      select element {'n_nationkey':nation.n_nationkey,'n_name':nation.n_name}
+      from  Nation as nation,
+            SelectedNation as sn
+      where (nation.n_nationkey = sn.n_nationkey)
+  ),
+      X as (
+      select element {'nation_key':nation_key,'order_date':orderdate,'sum_price':sum}
+      from  t as n,
+            Customer as customer,
+            Orders as orders
+      where ((orders.o_custkey = customer.c_custkey) and (customer.c_nationkey = n.n_nationkey))
+      group by orders.o_orderdate as orderdate,n.n_nationkey as nation_key
+      with  sum as tpch.sum((
+            select element o.o_totalprice
+            from  orders as o
+        ))
+  )
+select element {'nation_key':nation_key,'sum_price':(
+        select element {'orderdate':y.order_date,'sum_price':y.sum_price}
+        from  x as y
+        order by y.sum_price desc
+        limit 3
+    )}
+from  X as x
+group by x.nation_key as nation_key
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.1.ddl.sqlpp
new file mode 100644
index 0000000..2c8a9e5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.1.ddl.sqlpp
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.2.update.sqlpp
new file mode 100644
index 0000000..1c14a94
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+use tpch;
+
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.3.query.sqlpp
new file mode 100644
index 0000000..ed649ca
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.3.query.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue785
+ * https://code.google.com/p/asterixdb/issues/detail?id=785
+ * Expected Res : SUCCESS
+ * Date         : 2nd Oct. 2014
+ */
+
+use tpch;
+
+
+select element {'nation_key':nation_key,'sum_price':(
+        select element {'orderdate':od,'sum_price':sum}
+        from  x as i
+        group by i.order_date as od
+        with  sum as tpch.sum((
+              select element s.sum_price
+              from  i as s
+          ))
+        order by sum desc
+        limit 3
+    )}
+from  (
+    select element {'nation_key':nation_key,'order_date':orderdate,'sum_price':tpch.sum((
+            select element o.o_totalprice
+            from  orders as o
+        ))}
+    from  Nation as n,
+          Customer as customer,
+          Orders as orders
+    where ((orders.o_custkey = customer.c_custkey) and (customer.c_nationkey = n.n_nationkey))
+    group by orders.o_orderdate as orderdate,n.n_nationkey as nation_key
+) as x
+group by x.nation_key as nation_key
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.1.ddl.sqlpp
new file mode 100644
index 0000000..b36e90e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.1.ddl.sqlpp
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue786
+ * https://code.google.com/p/asterixdb/issues/detail?id=786
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  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
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int32,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int32,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int32,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int32,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int32,
+  n_name : string,
+  n_regionkey : int32,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+
+
+create index customer_fk_nation on Customer (c_nationkey);
+create index nation_fk_region on Nation(n_regionkey);
+create index orders_fk_customer on Orders (o_custkey);
+create index orders_orderdateIx on Orders (o_orderdate);
+create index supplier_fk_nation on Supplier (s_nationkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.2.update.sqlpp
new file mode 100644
index 0000000..90e2139
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.2.update.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue786
+ * https://code.google.com/p/asterixdb/issues/detail?id=786
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct. 2014
+ */
+
+use tpch;
+
+
+load  table Orders using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.3.query.sqlpp
new file mode 100644
index 0000000..dead643
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.3.query.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue786
+ * https://code.google.com/p/asterixdb/issues/detail?id=786
+ * Expected Res : SUCCESS
+ * Date         : 10th Oct. 2014
+ */
+
+use tpch;
+
+
+select element {'nation_key':nation.n_nationkey,'name':nation.n_name,'aggregates':(
+        select element {'order_date':orderdate,'sum_price':sum}
+        from  Orders as orders,
+              Customer as customer
+        where ((orders.o_custkey = customer.c_custkey) and (customer.c_nationkey = nation.n_nationkey))
+        group by orders.o_orderdate as orderdate
+        with  sum as tpch.sum((
+              select element o.o_totalprice
+              from  orders as o
+          ))
+        order by sum desc
+        limit 3
+    )}
+from  Nation as nation,
+      SelectedNation as sn
+where (nation.n_nationkey = sn.sn_nationkey)
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.1.ddl.sqlpp
new file mode 100644
index 0000000..6d147c2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.1.ddl.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.2.update.sqlpp
new file mode 100644
index 0000000..ab2b193
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.3.query.sqlpp
new file mode 100644
index 0000000..16d3fe0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.3.query.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':tpch.count(cheaps),'total_charges':tpch.sum(charges)}
+from  LineItem as l
+where (l.l_shipdate <= '1998-09-02')
+/* +hash */
+group by l.l_returnflag as l_returnflag,l.l_linestatus as l_linestatus
+with  cheaps as (
+      select element m
+      from  l as m
+      where (m.l_discount > 0.05)
+  ),
+      charges as (
+      select element (a.l_extendedprice * (1 - a.l_discount) * (1 + a.l_tax))
+      from  l as a
+  )
+order by l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.1.ddl.sqlpp
new file mode 100644
index 0000000..6d147c2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.1.ddl.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.2.update.sqlpp
new file mode 100644
index 0000000..ab2b193
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.3.query.sqlpp
new file mode 100644
index 0000000..576192d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.3.query.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':tpch.count(cheaps),'avg_expensive_discounts':tpch.avg(expensives),'sum_disc_prices':tpch.sum(disc_prices),'total_charges':tpch.sum(charges)}
+from  LineItem as l
+where (l.l_shipdate <= '1998-09-02')
+/* +hash */
+group by l.l_returnflag as l_returnflag,l.l_linestatus as l_linestatus
+with  expensives as (
+      select element i.l_discount
+      from  l as i
+      where (i.l_discount <= 0.05)
+  ),
+      cheaps as (
+      select element i
+      from  l as i
+      where (i.l_discount > 0.05)
+  ),
+      charges as (
+      select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
+      from  l as i
+  ),
+      disc_prices as (
+      select element (i.l_extendedprice * (1 - i.l_discount))
+      from  l as i
+  )
+order by l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.1.ddl.sqlpp
new file mode 100644
index 0000000..6d147c2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.1.ddl.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.2.update.sqlpp
new file mode 100644
index 0000000..ab2b193
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.3.query.sqlpp
new file mode 100644
index 0000000..01e1654
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.3.query.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue810
+ * https://code.google.com/p/asterixdb/issues/detail?id=810
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':tpch.count(cheap),'count_expensives':tpch.count(expensive)}
+from  LineItem as l
+where (l.l_shipdate <= '1998-09-02')
+/* +hash */
+group by l.l_returnflag as l_returnflag,l.l_linestatus as l_linestatus
+with  cheap as (
+      select element m
+      from  l as m
+      where (m.l_discount > 0.05)
+  ),
+      expensive as (
+      select element a
+      from  l as a
+      where (a.l_discount <= 0.05)
+  )
+order by l_returnflag,l_linestatus
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.1.ddl.sqlpp
new file mode 100644
index 0000000..2b93648
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.1.ddl.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue827
+ * https://code.google.com/p/asterixdb/issues/detail?id=827
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.2.update.sqlpp
new file mode 100644
index 0000000..d3a8e68
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue827
+ * https://code.google.com/p/asterixdb/issues/detail?id=827
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.3.query.sqlpp
new file mode 100644
index 0000000..562f78f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.3.query.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue827
+ * https://code.google.com/p/asterixdb/issues/detail?id=827
+ * Expected Res : SUCCESS
+ * Date         : 3rd Dec. 2014
+ */
+
+use tpch;
+
+
+{'sum_qty_partial':tpch.sum((
+    select element i.l_quantity
+    from  LineItem as i
+    where (i.l_shipdate <= '1998-09-02')
+)),'sum_base_price':tpch.sum((
+    select element i.l_extendedprice
+    from  LineItem as i
+)),'sum_disc_price':tpch.sum((
+    select element (i.l_extendedprice * (1 - i.l_discount))
+    from  LineItem as i
+)),'sum_charge':tpch.sum((
+    select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
+    from  LineItem as i
+)),'ave_qty':tpch.avg((
+    select element i.l_quantity
+    from  LineItem as i
+    where (i.l_shipdate <= '1998-09-02')
+)),'ave_price':tpch.avg((
+    select element i.l_extendedprice
+    from  LineItem as i
+)),'ave_disc':tpch.avg((
+    select element i.l_discount
+    from  LineItem as i
+)),'count_order':tpch.count((
+    select element l
+    from  LineItem as l
+))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.1.ddl.sqlpp
new file mode 100644
index 0000000..2b93648
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.1.ddl.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue827
+ * https://code.google.com/p/asterixdb/issues/detail?id=827
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  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
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+
+create index lineitem_shipdateIx on LineItem (l_shipdate);
+create index lineitem_receiptdateIx on LineItem (l_receiptdate);
+create index lineitem_fk_orders on LineItem (l_orderkey);
+create index lineitem_fk_part on LineItem (l_partkey);
+create index lineitem_fk_supplier on LineItem (l_suppkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.2.update.sqlpp
new file mode 100644
index 0000000..d3a8e68
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue827
+ * https://code.google.com/p/asterixdb/issues/detail?id=827
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+load  table LineItem using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.3.query.sqlpp
new file mode 100644
index 0000000..d056bcb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.3.query.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue827
+ * https://code.google.com/p/asterixdb/issues/detail?id=827
+ * Expected Res : SUCCESS
+ * Date         : 16th Nov. 2014
+ */
+
+use tpch;
+
+
+{'count_cheaps':tpch.count((
+    select element l.l_quantity
+    from  LineItem as l
+)),'count_expensives':tpch.sum((
+    select element e
+    from  (
+        select element l.l_extendedprice
+        from  LineItem as l
+    ) as e
+))};
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/distinct_by/distinct_by.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/distinct_by/distinct_by.1.adm
new file mode 100644
index 0000000..472cb64
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/distinct_by/distinct_by.1.adm
@@ -0,0 +1,28 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "AIR" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "FOB" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "MAIL" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "RAIL" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "REG AIR" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "SHIP" }
+{ "l_returnflag": "A", "l_linestatus": "F", "l_shipmode": "TRUCK" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "AIR" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "FOB" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "MAIL" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "RAIL" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "REG AIR" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "SHIP" }
+{ "l_returnflag": "N", "l_linestatus": "F", "l_shipmode": "TRUCK" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "AIR" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "FOB" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "MAIL" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "RAIL" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "REG AIR" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "SHIP" }
+{ "l_returnflag": "N", "l_linestatus": "O", "l_shipmode": "TRUCK" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "AIR" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "FOB" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "MAIL" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "RAIL" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "REG AIR" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "SHIP" }
+{ "l_returnflag": "R", "l_linestatus": "F", "l_shipmode": "TRUCK" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/nest_aggregate/nest_aggregate.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/nest_aggregate/nest_aggregate.1.adm
new file mode 100644
index 0000000..428af08
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/nest_aggregate/nest_aggregate.1.adm
@@ -0,0 +1,11 @@
+{ "nation_key": 0, "name": "ALGERIA", "aggregates": [ { "order_date": "1994-05-27", "sum_price": 1051.15d }, { "order_date": "1994-05-08", "sum_price": 4819.91d }, { "order_date": "1993-08-27", "sum_price": 10500.27d } ] }
+{ "nation_key": 1, "name": "ARGENTINA", "aggregates": [ { "order_date": "1997-08-14", "sum_price": 16763.95d }, { "order_date": "1997-11-26", "sum_price": 18653.09d }, { "order_date": "1998-04-20", "sum_price": 24637.96d } ] }
+{ "nation_key": 2, "name": "BRAZIL", "aggregates": [ { "order_date": "1993-03-05", "sum_price": 8225.96d }, { "order_date": "1994-08-31", "sum_price": 19056.99d }, { "order_date": "1997-05-04", "sum_price": 23984.88d } ] }
+{ "nation_key": 3, "name": "CANADA", "aggregates": [ { "order_date": "1992-02-22", "sum_price": 1084.38d }, { "order_date": "1992-11-28", "sum_price": 4766.19d }, { "order_date": "1995-02-17", "sum_price": 4913.06d } ] }
+{ "nation_key": 4, "name": "EGYPT", "aggregates": [ { "order_date": "1998-04-19", "sum_price": 3089.42d }, { "order_date": "1996-03-12", "sum_price": 3892.77d }, { "order_date": "1997-07-25", "sum_price": 11405.4d } ] }
+{ "nation_key": 19, "name": "ROMANIA", "aggregates": [ { "order_date": "1994-07-05", "sum_price": 7108.12d }, { "order_date": "1994-11-17", "sum_price": 13282.23d }, { "order_date": "1997-02-07", "sum_price": 16689.19d } ] }
+{ "nation_key": 20, "name": "SAUDI ARABIA", "aggregates": [ { "order_date": "1994-04-30", "sum_price": 6406.29d }, { "order_date": "1992-05-10", "sum_price": 45695.84d }, { "order_date": "1994-01-31", "sum_price": 62316.61d } ] }
+{ "nation_key": 21, "name": "VIETNAM", "aggregates": [ { "order_date": "1994-02-17", "sum_price": 1984.14d }, { "order_date": "1995-08-05", "sum_price": 16922.51d }, { "order_date": "1994-06-01", "sum_price": 21088.59d } ] }
+{ "nation_key": 22, "name": "RUSSIA", "aggregates": [ { "order_date": "1993-11-16", "sum_price": 7471.75d }, { "order_date": "1996-01-11", "sum_price": 8720.45d }, { "order_date": "1995-07-15", "sum_price": 27016.74d } ] }
+{ "nation_key": 23, "name": "UNITED KINGDOM", "aggregates": [ { "order_date": "1997-12-18", "sum_price": 10934.84d }, { "order_date": "1995-05-26", "sum_price": 11474.95d }, { "order_date": "1997-05-13", "sum_price": 18307.45d } ] }
+{ "nation_key": 24, "name": "UNITED STATES", "aggregates": [  ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/nest_aggregate2/nest_aggregate2.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/nest_aggregate2/nest_aggregate2.1.adm
new file mode 100644
index 0000000..3834939
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/nest_aggregate2/nest_aggregate2.1.adm
@@ -0,0 +1,11 @@
+{ "nation_key": 0, "name": "ALGERIA", "aggregates": [ "1994-05-27", "1994-05-08", "1993-08-27" ] }
+{ "nation_key": 1, "name": "ARGENTINA", "aggregates": [ "1997-08-14", "1997-11-26", "1998-04-20" ] }
+{ "nation_key": 2, "name": "BRAZIL", "aggregates": [ "1993-03-05", "1994-08-31", "1997-05-04" ] }
+{ "nation_key": 3, "name": "CANADA", "aggregates": [ "1992-02-22", "1992-11-28", "1995-02-17" ] }
+{ "nation_key": 4, "name": "EGYPT", "aggregates": [ "1998-04-19", "1996-03-12", "1997-07-25" ] }
+{ "nation_key": 19, "name": "ROMANIA", "aggregates": [ "1994-07-05", "1994-11-17", "1997-02-07" ] }
+{ "nation_key": 20, "name": "SAUDI ARABIA", "aggregates": [ "1994-04-30", "1992-05-10", "1994-01-31" ] }
+{ "nation_key": 21, "name": "VIETNAM", "aggregates": [ "1994-02-17", "1995-08-05", "1994-06-01" ] }
+{ "nation_key": 22, "name": "RUSSIA", "aggregates": [ "1993-11-16", "1996-01-11", "1995-07-15" ] }
+{ "nation_key": 23, "name": "UNITED KINGDOM", "aggregates": [ "1997-12-18", "1995-05-26", "1997-05-13" ] }
+{ "nation_key": 24, "name": "UNITED STATES", "aggregates": [  ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.adm
new file mode 100644
index 0000000..8acdda4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.adm
@@ -0,0 +1,4 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "sum_qty": 37474.0d, "sum_base_price": 3.7569624640000015E7d, "sum_disc_price": 3.567619209699997E7d, "sum_charge": 3.7101416222424E7d, "ave_qty": 25.354533152909337d, "ave_price": 25419.231826792973d, "ave_disc": 0.05086603518267936d, "count_order": 1478 }
+{ "l_returnflag": "N", "l_linestatus": "F", "sum_qty": 1041.0d, "sum_base_price": 1041301.0700000001d, "sum_disc_price": 999060.898d, "sum_charge": 1036450.8022800002d, "ave_qty": 27.394736842105264d, "ave_price": 27402.659736842106d, "ave_disc": 0.04289473684210526d, "count_order": 38 }
+{ "l_returnflag": "N", "l_linestatus": "O", "sum_qty": 75168.0d, "sum_base_price": 7.538495537000003E7d, "sum_disc_price": 7.165316630340004E7d, "sum_charge": 7.449879813307303E7d, "ave_qty": 25.558653519211152d, "ave_price": 25632.422771166282d, "ave_disc": 0.04969738184291074d, "count_order": 2941 }
+{ "l_returnflag": "R", "l_linestatus": "F", "sum_qty": 36511.0d, "sum_base_price": 3.657084124000002E7d, "sum_disc_price": 3.473847287579997E7d, "sum_charge": 3.616906011219299E7d, "ave_qty": 25.059025394646532d, "ave_price": 25100.09693891559d, "ave_disc": 0.05002745367192867d, "count_order": 1457 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.adm
new file mode 100644
index 0000000..a7d5b93
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.adm
@@ -0,0 +1,13 @@
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 2, "p_mfgr": "Manufacturer#1", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 4, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 22, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 35, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 38, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 62, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 79, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 94, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 102, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 106, "p_mfgr": "Manufacturer#3", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 131, "p_mfgr": "Manufacturer#5", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 159, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
+{ "s_acctbal": 6820.35d, "s_name": "Supplier#000000007", "n_name": "UNITED KINGDOM", "p_partkey": 193, "p_mfgr": "Manufacturer#4", "s_address": "s,4TicNGB4uO6PaSqNBUq", "s_phone": "33-990-965-2201", "s_comment": "s unwind silently furiously regular courts. final requests are deposits. requests wake quietly blit" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.1.adm
new file mode 100644
index 0000000..625a418
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.1.adm
@@ -0,0 +1,8 @@
+{ "l_orderkey": 1637, "revenue": 164224.9253d, "o_orderdate": "1995-02-08", "o_shippriority": 0 }
+{ "l_orderkey": 5191, "revenue": 49378.309400000006d, "o_orderdate": "1994-12-11", "o_shippriority": 0 }
+{ "l_orderkey": 742, "revenue": 43728.048d, "o_orderdate": "1994-12-23", "o_shippriority": 0 }
+{ "l_orderkey": 3492, "revenue": 43716.072400000005d, "o_orderdate": "1994-11-24", "o_shippriority": 0 }
+{ "l_orderkey": 2883, "revenue": 36666.9612d, "o_orderdate": "1995-01-23", "o_shippriority": 0 }
+{ "l_orderkey": 998, "revenue": 11785.548600000002d, "o_orderdate": "1994-11-26", "o_shippriority": 0 }
+{ "l_orderkey": 3430, "revenue": 4726.6775d, "o_orderdate": "1994-12-12", "o_shippriority": 0 }
+{ "l_orderkey": 4423, "revenue": 3055.9365d, "o_orderdate": "1995-02-17", "o_shippriority": 0 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q04_order_priority/q04_order_priority.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q04_order_priority/q04_order_priority.1.adm
new file mode 100644
index 0000000..5e38c96
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q04_order_priority/q04_order_priority.1.adm
@@ -0,0 +1,5 @@
+{ "order_priority": "1-URGENT", "count": 9 }
+{ "order_priority": "2-HIGH", "count": 7 }
+{ "order_priority": "3-MEDIUM", "count": 9 }
+{ "order_priority": "4-NOT SPECIFIED", "count": 8 }
+{ "order_priority": "5-LOW", "count": 12 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.1.adm
new file mode 100644
index 0000000..ac68fb3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.1.adm
@@ -0,0 +1,8 @@
+{ "n_name": "PERU", "revenue": 1099912.8209000002d }
+{ "n_name": "MOROCCO", "revenue": 520107.17919999996d }
+{ "n_name": "IRAN", "revenue": 375610.964d }
+{ "n_name": "IRAQ", "revenue": 364417.398d }
+{ "n_name": "ETHIOPIA", "revenue": 253825.76219999997d }
+{ "n_name": "ARGENTINA", "revenue": 102659.0106d }
+{ "n_name": "UNITED KINGDOM", "revenue": 61065.8711d }
+{ "n_name": "KENYA", "revenue": 29679.393200000002d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.1.adm
new file mode 100644
index 0000000..06f9a78
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.1.adm
@@ -0,0 +1 @@
+{ "revenue": 77949.9186d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q07_volume_shipping/q07_volume_shipping.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q07_volume_shipping/q07_volume_shipping.1.adm
new file mode 100644
index 0000000..37138fc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q07_volume_shipping/q07_volume_shipping.1.adm
@@ -0,0 +1,37 @@
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 63089.1006d }
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 64024.4532d }
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 32719.877199999995d }
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 63729.862400000005d }
+{ "supp_nation": "ARGENTINA", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 1801.8198d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 74693.317d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 13733.706600000001d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 83631.40359999999d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 69329.67199999999d }
+{ "supp_nation": "ETHIOPIA", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 42017.435999999994d }
+{ "supp_nation": "IRAN", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 38014.335399999996d }
+{ "supp_nation": "IRAN", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 252152.5927d }
+{ "supp_nation": "IRAN", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 9106.957199999999d }
+{ "supp_nation": "IRAQ", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 68040.7747d }
+{ "supp_nation": "IRAQ", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 3676.8004d }
+{ "supp_nation": "IRAQ", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 85948.85280000001d }
+{ "supp_nation": "IRAQ", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 66380.2488d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 77164.5422d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 63792.8736d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 74537.6256d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 37851.309d }
+{ "supp_nation": "KENYA", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 18467.316d }
+{ "supp_nation": "MOROCCO", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 89669.69080000001d }
+{ "supp_nation": "MOROCCO", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 173726.0087d }
+{ "supp_nation": "MOROCCO", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 37169.8497d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 226624.7652d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 58359.3076d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 345376.29829999997d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 52968.9424d }
+{ "supp_nation": "PERU", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 7960.72d }
+{ "supp_nation": "UNITED KINGDOM", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 100143.32139999999d }
+{ "supp_nation": "UNITED KINGDOM", "cust_nation": "GERMANY", "l_year": 1993, "revenue": 41582.5227d }
+{ "supp_nation": "UNITED KINGDOM", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 164740.32710000002d }
+{ "supp_nation": "UNITED KINGDOM", "cust_nation": "GERMANY", "l_year": 1996, "revenue": 50909.551999999996d }
+{ "supp_nation": "UNITED STATES", "cust_nation": "GERMANY", "l_year": 1992, "revenue": 52480.9528d }
+{ "supp_nation": "UNITED STATES", "cust_nation": "GERMANY", "l_year": 1994, "revenue": 115566.8388d }
+{ "supp_nation": "UNITED STATES", "cust_nation": "GERMANY", "l_year": 1995, "revenue": 80489.69949999999d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q08_national_market_share/q08_national_market_share.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q08_national_market_share/q08_national_market_share.1.adm
new file mode 100644
index 0000000..5a0b1da
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q08_national_market_share/q08_national_market_share.1.adm
@@ -0,0 +1,2 @@
+{ "year": 1995, "mkt_share": 0.0d }
+{ "year": 1996, "mkt_share": 0.0d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.1.adm
new file mode 100644
index 0000000..e9f3f47
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q09_product_type_profit_nt/q09_product_type_profit_nt.1.adm
@@ -0,0 +1,59 @@
+{ "nation": "ARGENTINA", "o_year": 1997, "sum_profit": 18247.873399999993d }
+{ "nation": "ARGENTINA", "o_year": 1996, "sum_profit": 7731.089399999995d }
+{ "nation": "ARGENTINA", "o_year": 1995, "sum_profit": 134490.5697d }
+{ "nation": "ARGENTINA", "o_year": 1994, "sum_profit": 36767.101500000004d }
+{ "nation": "ARGENTINA", "o_year": 1993, "sum_profit": 35857.08d }
+{ "nation": "ARGENTINA", "o_year": 1992, "sum_profit": 35740.0d }
+{ "nation": "ETHIOPIA", "o_year": 1998, "sum_profit": 2758.7801999999992d }
+{ "nation": "ETHIOPIA", "o_year": 1997, "sum_profit": 19419.294599999994d }
+{ "nation": "ETHIOPIA", "o_year": 1995, "sum_profit": 51231.87439999999d }
+{ "nation": "ETHIOPIA", "o_year": 1994, "sum_profit": 3578.9478999999974d }
+{ "nation": "ETHIOPIA", "o_year": 1992, "sum_profit": 1525.8234999999986d }
+{ "nation": "IRAN", "o_year": 1998, "sum_profit": 37817.229600000006d }
+{ "nation": "IRAN", "o_year": 1997, "sum_profit": 52643.77359999999d }
+{ "nation": "IRAN", "o_year": 1996, "sum_profit": 70143.77609999999d }
+{ "nation": "IRAN", "o_year": 1995, "sum_profit": 84094.58260000001d }
+{ "nation": "IRAN", "o_year": 1994, "sum_profit": 18140.925599999995d }
+{ "nation": "IRAN", "o_year": 1993, "sum_profit": 78655.1676d }
+{ "nation": "IRAN", "o_year": 1992, "sum_profit": 87142.2396d }
+{ "nation": "IRAQ", "o_year": 1998, "sum_profit": 22860.8082d }
+{ "nation": "IRAQ", "o_year": 1997, "sum_profit": 93676.24359999999d }
+{ "nation": "IRAQ", "o_year": 1996, "sum_profit": 45103.3242d }
+{ "nation": "IRAQ", "o_year": 1994, "sum_profit": 36010.728599999995d }
+{ "nation": "IRAQ", "o_year": 1993, "sum_profit": 33221.9399d }
+{ "nation": "IRAQ", "o_year": 1992, "sum_profit": 47755.05900000001d }
+{ "nation": "KENYA", "o_year": 1998, "sum_profit": 44194.831999999995d }
+{ "nation": "KENYA", "o_year": 1997, "sum_profit": 57578.3626d }
+{ "nation": "KENYA", "o_year": 1996, "sum_profit": 59195.9021d }
+{ "nation": "KENYA", "o_year": 1995, "sum_profit": 79262.6278d }
+{ "nation": "KENYA", "o_year": 1994, "sum_profit": 102360.66609999999d }
+{ "nation": "KENYA", "o_year": 1993, "sum_profit": 128422.01959999999d }
+{ "nation": "KENYA", "o_year": 1992, "sum_profit": 181517.20890000003d }
+{ "nation": "MOROCCO", "o_year": 1998, "sum_profit": 41797.823199999984d }
+{ "nation": "MOROCCO", "o_year": 1997, "sum_profit": 23685.801799999997d }
+{ "nation": "MOROCCO", "o_year": 1996, "sum_profit": 62115.19579999999d }
+{ "nation": "MOROCCO", "o_year": 1995, "sum_profit": 42442.64300000001d }
+{ "nation": "MOROCCO", "o_year": 1994, "sum_profit": 48655.87800000001d }
+{ "nation": "MOROCCO", "o_year": 1993, "sum_profit": 22926.744400000003d }
+{ "nation": "MOROCCO", "o_year": 1992, "sum_profit": 32239.8088d }
+{ "nation": "PERU", "o_year": 1998, "sum_profit": 86999.36459999997d }
+{ "nation": "PERU", "o_year": 1997, "sum_profit": 121110.41070000001d }
+{ "nation": "PERU", "o_year": 1996, "sum_profit": 177040.40759999998d }
+{ "nation": "PERU", "o_year": 1995, "sum_profit": 122247.94519999999d }
+{ "nation": "PERU", "o_year": 1994, "sum_profit": 88046.2533d }
+{ "nation": "PERU", "o_year": 1993, "sum_profit": 49379.813799999996d }
+{ "nation": "PERU", "o_year": 1992, "sum_profit": 80646.86050000001d }
+{ "nation": "UNITED KINGDOM", "o_year": 1998, "sum_profit": 50577.25560000001d }
+{ "nation": "UNITED KINGDOM", "o_year": 1997, "sum_profit": 114288.86049999998d }
+{ "nation": "UNITED KINGDOM", "o_year": 1996, "sum_profit": 147684.46480000002d }
+{ "nation": "UNITED KINGDOM", "o_year": 1995, "sum_profit": 225267.6576d }
+{ "nation": "UNITED KINGDOM", "o_year": 1994, "sum_profit": 140595.58639999997d }
+{ "nation": "UNITED KINGDOM", "o_year": 1993, "sum_profit": 322548.49210000003d }
+{ "nation": "UNITED KINGDOM", "o_year": 1992, "sum_profit": 67747.88279999999d }
+{ "nation": "UNITED STATES", "o_year": 1998, "sum_profit": 3957.0431999999996d }
+{ "nation": "UNITED STATES", "o_year": 1997, "sum_profit": 94729.5704d }
+{ "nation": "UNITED STATES", "o_year": 1996, "sum_profit": 79297.8567d }
+{ "nation": "UNITED STATES", "o_year": 1995, "sum_profit": 62201.23360000001d }
+{ "nation": "UNITED STATES", "o_year": 1994, "sum_profit": 43075.62989999999d }
+{ "nation": "UNITED STATES", "o_year": 1993, "sum_profit": 27168.486199999996d }
+{ "nation": "UNITED STATES", "o_year": 1992, "sum_profit": 34092.366d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q10_returned_item/q10_returned_ite.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q10_returned_item/q10_returned_ite.1.adm
new file mode 100644
index 0000000..6df13e2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q10_returned_item/q10_returned_ite.1.adm
@@ -0,0 +1,20 @@
+{ "c_custkey": 121i32, "c_name": "Customer#000000121", "revenue": 282635.1719d, "c_acctbal": 6428.32d, "n_name": "PERU", "c_address": "tv nCR2YKupGN73mQudO", "c_phone": "27-411-990-2959", "c_comment": "uriously stealthy ideas. carefully final courts use carefully" }
+{ "c_custkey": 124i32, "c_name": "Customer#000000124", "revenue": 222182.51880000002d, "c_acctbal": 1842.49d, "n_name": "CHINA", "c_address": "aTbyVAW5tCd,v09O", "c_phone": "28-183-750-7809", "c_comment": "le fluffily even dependencies. quietly s" }
+{ "c_custkey": 106i32, "c_name": "Customer#000000106", "revenue": 190241.3334d, "c_acctbal": 3288.42d, "n_name": "ARGENTINA", "c_address": "xGCOEAUjUNG", "c_phone": "11-751-989-4627", "c_comment": "lose slyly. ironic accounts along the evenly regular theodolites wake about the special, final gifts. " }
+{ "c_custkey": 16i32, "c_name": "Customer#000000016", "revenue": 161422.04609999998d, "c_acctbal": 4681.03d, "n_name": "IRAN", "c_address": "cYiaeMLZSMAOQ2 d0W,", "c_phone": "20-781-609-3107", "c_comment": "kly silent courts. thinly regular theodolites sleep fluffily after " }
+{ "c_custkey": 44i32, "c_name": "Customer#000000044", "revenue": 149364.5652d, "c_acctbal": 7315.94d, "n_name": "MOZAMBIQUE", "c_address": "Oi,dOSPwDu4jo4x,,P85E0dmhZGvNtBwi", "c_phone": "26-190-260-5375", "c_comment": "r requests around the unusual, bold a" }
+{ "c_custkey": 71i32, "c_name": "Customer#000000071", "revenue": 129481.0245d, "c_acctbal": -611.19d, "n_name": "GERMANY", "c_address": "TlGalgdXWBmMV,6agLyWYDyIz9MKzcY8gl,w6t1B", "c_phone": "17-710-812-5403", "c_comment": "g courts across the regular, final pinto beans are blithely pending ac" }
+{ "c_custkey": 89i32, "c_name": "Customer#000000089", "revenue": 121663.1243d, "c_acctbal": 1530.76d, "n_name": "KENYA", "c_address": "dtR, y9JQWUO6FoJExyp8whOU", "c_phone": "24-394-451-5404", "c_comment": "counts are slyly beyond the slyly final accounts. quickly final ideas wake. r" }
+{ "c_custkey": 112i32, "c_name": "Customer#000000112", "revenue": 111137.7141d, "c_acctbal": 2953.35d, "n_name": "ROMANIA", "c_address": "RcfgG3bO7QeCnfjqJT1", "c_phone": "29-233-262-8382", "c_comment": "rmanently unusual multipliers. blithely ruthless deposits are furiously along the" }
+{ "c_custkey": 62i32, "c_name": "Customer#000000062", "revenue": 106368.0153d, "c_acctbal": 595.61d, "n_name": "GERMANY", "c_address": "upJK2Dnw13,", "c_phone": "17-361-978-7059", "c_comment": "kly special dolphins. pinto beans are slyly. quickly regular accounts are furiously a" }
+{ "c_custkey": 146i32, "c_name": "Customer#000000146", "revenue": 103265.98879999999d, "c_acctbal": 3328.68d, "n_name": "CANADA", "c_address": "GdxkdXG9u7iyI1,,y5tq4ZyrcEy", "c_phone": "13-835-723-3223", "c_comment": "ffily regular dinos are slyly unusual requests. slyly specia" }
+{ "c_custkey": 19i32, "c_name": "Customer#000000019", "revenue": 99306.0127d, "c_acctbal": 8914.71d, "n_name": "CHINA", "c_address": "uc,3bHIx84H,wdrmLOjVsiqXCq2tr", "c_phone": "28-396-526-5053", "c_comment": " nag. furiously careful packages are slyly at the accounts. furiously regular in" }
+{ "c_custkey": 145i32, "c_name": "Customer#000000145", "revenue": 99256.9018d, "c_acctbal": 9748.93d, "n_name": "JORDAN", "c_address": "kQjHmt2kcec cy3hfMh969u", "c_phone": "23-562-444-8454", "c_comment": "ests? express, express instructions use. blithely fina" }
+{ "c_custkey": 103i32, "c_name": "Customer#000000103", "revenue": 97311.77240000002d, "c_acctbal": 2757.45d, "n_name": "INDONESIA", "c_address": "8KIsQX4LJ7QMsj6DrtFtXu0nUEdV,8a", "c_phone": "19-216-107-2107", "c_comment": "furiously pending notornis boost slyly around the blithely ironic ideas? final, even instructions cajole fl" }
+{ "c_custkey": 136i32, "c_name": "Customer#000000136", "revenue": 95855.39799999999d, "c_acctbal": -842.39d, "n_name": "GERMANY", "c_address": "QoLsJ0v5C1IQbh,DS1", "c_phone": "17-501-210-4726", "c_comment": "ackages sleep ironic, final courts. even requests above the blithely bold requests g" }
+{ "c_custkey": 53i32, "c_name": "Customer#000000053", "revenue": 92568.9124d, "c_acctbal": 4113.64d, "n_name": "MOROCCO", "c_address": "HnaxHzTfFTZs8MuCpJyTbZ47Cm4wFOOgib", "c_phone": "25-168-852-5363", "c_comment": "ar accounts are. even foxes are blithely. fluffily pending deposits boost" }
+{ "c_custkey": 49i32, "c_name": "Customer#000000049", "revenue": 90965.7262d, "c_acctbal": 4573.94d, "n_name": "IRAN", "c_address": "cNgAeX7Fqrdf7HQN9EwjUa4nxT,68L FKAxzl", "c_phone": "20-908-631-4424", "c_comment": "nusual foxes! fluffily pending packages maintain to the regular " }
+{ "c_custkey": 37i32, "c_name": "Customer#000000037", "revenue": 88065.74579999999d, "c_acctbal": -917.75d, "n_name": "INDIA", "c_address": "7EV4Pwh,3SboctTWt", "c_phone": "18-385-235-7162", "c_comment": "ilent packages are carefully among the deposits. furiousl" }
+{ "c_custkey": 82i32, "c_name": "Customer#000000082", "revenue": 86998.9644d, "c_acctbal": 9468.34d, "n_name": "CHINA", "c_address": "zhG3EZbap4c992Gj3bK,3Ne,Xn", "c_phone": "28-159-442-5305", "c_comment": "s wake. bravely regular accounts are furiously. regula" }
+{ "c_custkey": 125i32, "c_name": "Customer#000000125", "revenue": 84808.068d, "c_acctbal": -234.12d, "n_name": "ROMANIA", "c_address": ",wSZXdVR xxIIfm9s8ITyLl3kgjT6UC07GY0Y", "c_phone": "29-261-996-3120", "c_comment": "x-ray finally after the packages? regular requests c" }
+{ "c_custkey": 59i32, "c_name": "Customer#000000059", "revenue": 84655.5711d, "c_acctbal": 3458.6d, "n_name": "ARGENTINA", "c_address": "zLOCP0wh92OtBihgspOGl4", "c_phone": "11-355-584-3112", "c_comment": "ously final packages haggle blithely after the express deposits. furiou" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.1.adm
new file mode 100644
index 0000000..ed5dae4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.1.adm
@@ -0,0 +1,20 @@
+{ "c_custkey": 121, "c_name": "Customer#000000121", "revenue": 282635.1719d, "c_acctbal": 6428.32d, "n_name": "PERU", "c_address": "tv nCR2YKupGN73mQudO", "c_phone": "27-411-990-2959", "c_comment": "uriously stealthy ideas. carefully final courts use carefully" }
+{ "c_custkey": 124, "c_name": "Customer#000000124", "revenue": 222182.5188d, "c_acctbal": 1842.49d, "n_name": "CHINA", "c_address": "aTbyVAW5tCd,v09O", "c_phone": "28-183-750-7809", "c_comment": "le fluffily even dependencies. quietly s" }
+{ "c_custkey": 106, "c_name": "Customer#000000106", "revenue": 190241.3334d, "c_acctbal": 3288.42d, "n_name": "ARGENTINA", "c_address": "xGCOEAUjUNG", "c_phone": "11-751-989-4627", "c_comment": "lose slyly. ironic accounts along the evenly regular theodolites wake about the special, final gifts. " }
+{ "c_custkey": 16, "c_name": "Customer#000000016", "revenue": 161422.04609999998d, "c_acctbal": 4681.03d, "n_name": "IRAN", "c_address": "cYiaeMLZSMAOQ2 d0W,", "c_phone": "20-781-609-3107", "c_comment": "kly silent courts. thinly regular theodolites sleep fluffily after " }
+{ "c_custkey": 44, "c_name": "Customer#000000044", "revenue": 149364.5652d, "c_acctbal": 7315.94d, "n_name": "MOZAMBIQUE", "c_address": "Oi,dOSPwDu4jo4x,,P85E0dmhZGvNtBwi", "c_phone": "26-190-260-5375", "c_comment": "r requests around the unusual, bold a" }
+{ "c_custkey": 71, "c_name": "Customer#000000071", "revenue": 129481.02450000001d, "c_acctbal": -611.19d, "n_name": "GERMANY", "c_address": "TlGalgdXWBmMV,6agLyWYDyIz9MKzcY8gl,w6t1B", "c_phone": "17-710-812-5403", "c_comment": "g courts across the regular, final pinto beans are blithely pending ac" }
+{ "c_custkey": 89, "c_name": "Customer#000000089", "revenue": 121663.1243d, "c_acctbal": 1530.76d, "n_name": "KENYA", "c_address": "dtR, y9JQWUO6FoJExyp8whOU", "c_phone": "24-394-451-5404", "c_comment": "counts are slyly beyond the slyly final accounts. quickly final ideas wake. r" }
+{ "c_custkey": 112, "c_name": "Customer#000000112", "revenue": 111137.7141d, "c_acctbal": 2953.35d, "n_name": "ROMANIA", "c_address": "RcfgG3bO7QeCnfjqJT1", "c_phone": "29-233-262-8382", "c_comment": "rmanently unusual multipliers. blithely ruthless deposits are furiously along the" }
+{ "c_custkey": 62, "c_name": "Customer#000000062", "revenue": 106368.0153d, "c_acctbal": 595.61d, "n_name": "GERMANY", "c_address": "upJK2Dnw13,", "c_phone": "17-361-978-7059", "c_comment": "kly special dolphins. pinto beans are slyly. quickly regular accounts are furiously a" }
+{ "c_custkey": 146, "c_name": "Customer#000000146", "revenue": 103265.98879999999d, "c_acctbal": 3328.68d, "n_name": "CANADA", "c_address": "GdxkdXG9u7iyI1,,y5tq4ZyrcEy", "c_phone": "13-835-723-3223", "c_comment": "ffily regular dinos are slyly unusual requests. slyly specia" }
+{ "c_custkey": 19, "c_name": "Customer#000000019", "revenue": 99306.0127d, "c_acctbal": 8914.71d, "n_name": "CHINA", "c_address": "uc,3bHIx84H,wdrmLOjVsiqXCq2tr", "c_phone": "28-396-526-5053", "c_comment": " nag. furiously careful packages are slyly at the accounts. furiously regular in" }
+{ "c_custkey": 145, "c_name": "Customer#000000145", "revenue": 99256.9018d, "c_acctbal": 9748.93d, "n_name": "JORDAN", "c_address": "kQjHmt2kcec cy3hfMh969u", "c_phone": "23-562-444-8454", "c_comment": "ests? express, express instructions use. blithely fina" }
+{ "c_custkey": 103, "c_name": "Customer#000000103", "revenue": 97311.77240000002d, "c_acctbal": 2757.45d, "n_name": "INDONESIA", "c_address": "8KIsQX4LJ7QMsj6DrtFtXu0nUEdV,8a", "c_phone": "19-216-107-2107", "c_comment": "furiously pending notornis boost slyly around the blithely ironic ideas? final, even instructions cajole fl" }
+{ "c_custkey": 136, "c_name": "Customer#000000136", "revenue": 95855.39799999999d, "c_acctbal": -842.39d, "n_name": "GERMANY", "c_address": "QoLsJ0v5C1IQbh,DS1", "c_phone": "17-501-210-4726", "c_comment": "ackages sleep ironic, final courts. even requests above the blithely bold requests g" }
+{ "c_custkey": 53, "c_name": "Customer#000000053", "revenue": 92568.9124d, "c_acctbal": 4113.64d, "n_name": "MOROCCO", "c_address": "HnaxHzTfFTZs8MuCpJyTbZ47Cm4wFOOgib", "c_phone": "25-168-852-5363", "c_comment": "ar accounts are. even foxes are blithely. fluffily pending deposits boost" }
+{ "c_custkey": 49, "c_name": "Customer#000000049", "revenue": 90965.7262d, "c_acctbal": 4573.94d, "n_name": "IRAN", "c_address": "cNgAeX7Fqrdf7HQN9EwjUa4nxT,68L FKAxzl", "c_phone": "20-908-631-4424", "c_comment": "nusual foxes! fluffily pending packages maintain to the regular " }
+{ "c_custkey": 37, "c_name": "Customer#000000037", "revenue": 88065.74579999999d, "c_acctbal": -917.75d, "n_name": "INDIA", "c_address": "7EV4Pwh,3SboctTWt", "c_phone": "18-385-235-7162", "c_comment": "ilent packages are carefully among the deposits. furiousl" }
+{ "c_custkey": 82, "c_name": "Customer#000000082", "revenue": 86998.9644d, "c_acctbal": 9468.34d, "n_name": "CHINA", "c_address": "zhG3EZbap4c992Gj3bK,3Ne,Xn", "c_phone": "28-159-442-5305", "c_comment": "s wake. bravely regular accounts are furiously. regula" }
+{ "c_custkey": 125, "c_name": "Customer#000000125", "revenue": 84808.068d, "c_acctbal": -234.12d, "n_name": "ROMANIA", "c_address": ",wSZXdVR xxIIfm9s8ITyLl3kgjT6UC07GY0Y", "c_phone": "29-261-996-3120", "c_comment": "x-ray finally after the packages? regular requests c" }
+{ "c_custkey": 59, "c_name": "Customer#000000059", "revenue": 84655.5711d, "c_acctbal": 3458.6d, "n_name": "ARGENTINA", "c_address": "zLOCP0wh92OtBihgspOGl4", "c_phone": "11-355-584-3112", "c_comment": "ously final packages haggle blithely after the express deposits. furiou" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q11_important_stock/q11_important_stock.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q11_important_stock/q11_important_stock.1.adm
new file mode 100644
index 0000000..0fc28fb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q11_important_stock/q11_important_stock.1.adm
@@ -0,0 +1,200 @@
+{ "partkey": 25, "part_value": 2.832302068E7d }
+{ "partkey": 124, "part_value": 2.59627599E7d }
+{ "partkey": 175, "part_value": 2.385395363E7d }
+{ "partkey": 197, "part_value": 2.248551967E7d }
+{ "partkey": 163, "part_value": 2.099460571E7d }
+{ "partkey": 160, "part_value": 2.00232846E7d }
+{ "partkey": 82, "part_value": 1.991921335E7d }
+{ "partkey": 169, "part_value": 1.898734723E7d }
+{ "partkey": 29, "part_value": 1.867279344E7d }
+{ "partkey": 26, "part_value": 1.861245827E7d }
+{ "partkey": 73, "part_value": 1.827170729E7d }
+{ "partkey": 161, "part_value": 1.7987463009999998E7d }
+{ "partkey": 75, "part_value": 1.7959598009999998E7d }
+{ "partkey": 34, "part_value": 1.778083836E7d }
+{ "partkey": 98, "part_value": 1.7763191509999998E7d }
+{ "partkey": 69, "part_value": 1.728526943E7d }
+{ "partkey": 111, "part_value": 1.7083882619999997E7d }
+{ "partkey": 171, "part_value": 1.635442066E7d }
+{ "partkey": 166, "part_value": 1.6351893740000002E7d }
+{ "partkey": 77, "part_value": 1.598059909E7d }
+{ "partkey": 78, "part_value": 1.58768992E7d }
+{ "partkey": 143, "part_value": 1.585686159E7d }
+{ "partkey": 17, "part_value": 1.547426112E7d }
+{ "partkey": 109, "part_value": 1.5054682620000001E7d }
+{ "partkey": 105, "part_value": 1.5053163809999999E7d }
+{ "partkey": 96, "part_value": 1.495213259E7d }
+{ "partkey": 146, "part_value": 1.481075944E7d }
+{ "partkey": 136, "part_value": 1.465496775E7d }
+{ "partkey": 116, "part_value": 1.4432091339999998E7d }
+{ "partkey": 128, "part_value": 1.4393555259999998E7d }
+{ "partkey": 142, "part_value": 1.422039904E7d }
+{ "partkey": 121, "part_value": 1.420032605E7d }
+{ "partkey": 30, "part_value": 1.416313241E7d }
+{ "partkey": 16, "part_value": 1.413646503E7d }
+{ "partkey": 198, "part_value": 1.413535335E7d }
+{ "partkey": 79, "part_value": 1.38652287E7d }
+{ "partkey": 90, "part_value": 1.373279748E7d }
+{ "partkey": 32, "part_value": 1.369962979E7d }
+{ "partkey": 74, "part_value": 1.338871111E7d }
+{ "partkey": 1, "part_value": 1.337870724E7d }
+{ "partkey": 89, "part_value": 1.337148041E7d }
+{ "partkey": 22, "part_value": 1.3354991740000002E7d }
+{ "partkey": 186, "part_value": 1.317604077E7d }
+{ "partkey": 189, "part_value": 1.305492542E7d }
+{ "partkey": 14, "part_value": 1.299397721E7d }
+{ "partkey": 93, "part_value": 1.299298218E7d }
+{ "partkey": 168, "part_value": 1.299041501E7d }
+{ "partkey": 99, "part_value": 1.2750046790000001E7d }
+{ "partkey": 167, "part_value": 1.268255069E7d }
+{ "partkey": 2, "part_value": 1.258471636E7d }
+{ "partkey": 182, "part_value": 1.256239411E7d }
+{ "partkey": 61, "part_value": 1.253677656E7d }
+{ "partkey": 112, "part_value": 1.234957975E7d }
+{ "partkey": 178, "part_value": 1.2260301739999998E7d }
+{ "partkey": 172, "part_value": 1.219775193E7d }
+{ "partkey": 165, "part_value": 1.219746506E7d }
+{ "partkey": 184, "part_value": 1.216784393E7d }
+{ "partkey": 187, "part_value": 1.214970141E7d }
+{ "partkey": 153, "part_value": 1.2119354219999999E7d }
+{ "partkey": 95, "part_value": 1.20468895E7d }
+{ "partkey": 11, "part_value": 1.2007151559999999E7d }
+{ "partkey": 125, "part_value": 1.2003476109999998E7d }
+{ "partkey": 154, "part_value": 1.185113385E7d }
+{ "partkey": 15, "part_value": 1.1798438790000001E7d }
+{ "partkey": 67, "part_value": 1.178579951E7d }
+{ "partkey": 8, "part_value": 1.1707892620000001E7d }
+{ "partkey": 87, "part_value": 1.168637671E7d }
+{ "partkey": 134, "part_value": 1.1683586929999998E7d }
+{ "partkey": 130, "part_value": 1.1682461489999998E7d }
+{ "partkey": 43, "part_value": 1.161150462E7d }
+{ "partkey": 102, "part_value": 1.151554211E7d }
+{ "partkey": 21, "part_value": 1.141066856E7d }
+{ "partkey": 62, "part_value": 1.138927324E7d }
+{ "partkey": 9, "part_value": 1.126484373E7d }
+{ "partkey": 80, "part_value": 1.118329032E7d }
+{ "partkey": 173, "part_value": 1.102677486E7d }
+{ "partkey": 94, "part_value": 1.092440116E7d }
+{ "partkey": 3, "part_value": 1.075814545E7d }
+{ "partkey": 103, "part_value": 1.06912216E7d }
+{ "partkey": 158, "part_value": 1.067861635E7d }
+{ "partkey": 49, "part_value": 1.06445572E7d }
+{ "partkey": 139, "part_value": 1.044045371E7d }
+{ "partkey": 192, "part_value": 1.035745974E7d }
+{ "partkey": 24, "part_value": 1.033911936E7d }
+{ "partkey": 39, "part_value": 1.03210148E7d }
+{ "partkey": 156, "part_value": 1.014364082E7d }
+{ "partkey": 188, "part_value": 1.011906085E7d }
+{ "partkey": 12, "part_value": 1.01085874E7d }
+{ "partkey": 33, "part_value": 1.005296264E7d }
+{ "partkey": 28, "part_value": 1.005234286E7d }
+{ "partkey": 40, "part_value": 9927827.77d }
+{ "partkey": 199, "part_value": 9907803.559999999d }
+{ "partkey": 193, "part_value": 9869674.77d }
+{ "partkey": 106, "part_value": 9869361.73d }
+{ "partkey": 108, "part_value": 9868370.309999999d }
+{ "partkey": 183, "part_value": 9855564.82d }
+{ "partkey": 70, "part_value": 9700431.94d }
+{ "partkey": 48, "part_value": 9655921.88d }
+{ "partkey": 118, "part_value": 9622756.15d }
+{ "partkey": 13, "part_value": 9592610.32d }
+{ "partkey": 83, "part_value": 9543465.08d }
+{ "partkey": 159, "part_value": 9519909.44d }
+{ "partkey": 147, "part_value": 9513932.18d }
+{ "partkey": 45, "part_value": 9423874.47d }
+{ "partkey": 117, "part_value": 9408426.72d }
+{ "partkey": 135, "part_value": 9311247.280000001d }
+{ "partkey": 185, "part_value": 9305341.780000001d }
+{ "partkey": 131, "part_value": 9223742.49d }
+{ "partkey": 7, "part_value": 9175528.21d }
+{ "partkey": 71, "part_value": 9167712.04d }
+{ "partkey": 100, "part_value": 9131099.530000001d }
+{ "partkey": 76, "part_value": 9092927.11d }
+{ "partkey": 53, "part_value": 8979121.97d }
+{ "partkey": 141, "part_value": 8686511.120000001d }
+{ "partkey": 64, "part_value": 8627897.290000001d }
+{ "partkey": 101, "part_value": 8521762.0d }
+{ "partkey": 176, "part_value": 8510175.88d }
+{ "partkey": 19, "part_value": 8481679.5d }
+{ "partkey": 194, "part_value": 8464559.54d }
+{ "partkey": 91, "part_value": 8460636.52d }
+{ "partkey": 132, "part_value": 8416851.239999998d }
+{ "partkey": 113, "part_value": 8405217.96d }
+{ "partkey": 51, "part_value": 8247118.499999999d }
+{ "partkey": 41, "part_value": 8187897.16d }
+{ "partkey": 55, "part_value": 8092552.890000001d }
+{ "partkey": 72, "part_value": 8007155.3d }
+{ "partkey": 115, "part_value": 7954624.0d }
+{ "partkey": 170, "part_value": 7895241.609999999d }
+{ "partkey": 114, "part_value": 7832023.28d }
+{ "partkey": 37, "part_value": 7809598.659999999d }
+{ "partkey": 54, "part_value": 7578243.79d }
+{ "partkey": 180, "part_value": 7531794.4799999995d }
+{ "partkey": 60, "part_value": 7508961.69d }
+{ "partkey": 31, "part_value": 7433034.240000001d }
+{ "partkey": 35, "part_value": 7132671.49d }
+{ "partkey": 140, "part_value": 7122050.08d }
+{ "partkey": 150, "part_value": 7106237.92d }
+{ "partkey": 107, "part_value": 7082828.68d }
+{ "partkey": 123, "part_value": 7049500.720000001d }
+{ "partkey": 190, "part_value": 7017966.9d }
+{ "partkey": 120, "part_value": 6920857.090000001d }
+{ "partkey": 196, "part_value": 6905182.43d }
+{ "partkey": 177, "part_value": 6887257.27d }
+{ "partkey": 126, "part_value": 6813302.029999999d }
+{ "partkey": 122, "part_value": 6812763.34d }
+{ "partkey": 200, "part_value": 6780024.53d }
+{ "partkey": 157, "part_value": 6766365.680000001d }
+{ "partkey": 63, "part_value": 6724960.14d }
+{ "partkey": 38, "part_value": 6667789.55d }
+{ "partkey": 58, "part_value": 6640619.380000001d }
+{ "partkey": 145, "part_value": 6633786.59d }
+{ "partkey": 144, "part_value": 6546945.92d }
+{ "partkey": 20, "part_value": 6533101.39d }
+{ "partkey": 127, "part_value": 6483139.620000001d }
+{ "partkey": 10, "part_value": 6433776.51d }
+{ "partkey": 47, "part_value": 6407355.369999999d }
+{ "partkey": 191, "part_value": 6347187.43d }
+{ "partkey": 137, "part_value": 6180452.85d }
+{ "partkey": 56, "part_value": 6145826.6d }
+{ "partkey": 104, "part_value": 6134341.85d }
+{ "partkey": 44, "part_value": 6038126.66d }
+{ "partkey": 97, "part_value": 6036047.1899999995d }
+{ "partkey": 181, "part_value": 5853464.149999999d }
+{ "partkey": 162, "part_value": 5829410.54d }
+{ "partkey": 86, "part_value": 5746713.88d }
+{ "partkey": 52, "part_value": 5680644.4799999995d }
+{ "partkey": 155, "part_value": 5552007.57d }
+{ "partkey": 92, "part_value": 5489588.279999999d }
+{ "partkey": 5, "part_value": 5461046.930000001d }
+{ "partkey": 18, "part_value": 5456316.21d }
+{ "partkey": 149, "part_value": 5367514.63d }
+{ "partkey": 110, "part_value": 5261352.11d }
+{ "partkey": 4, "part_value": 5162989.07d }
+{ "partkey": 6, "part_value": 5120392.470000001d }
+{ "partkey": 148, "part_value": 5061589.27d }
+{ "partkey": 42, "part_value": 4957032.47d }
+{ "partkey": 119, "part_value": 4954403.4799999995d }
+{ "partkey": 84, "part_value": 4891082.38d }
+{ "partkey": 65, "part_value": 4834763.09d }
+{ "partkey": 66, "part_value": 4719253.369999999d }
+{ "partkey": 179, "part_value": 4610607.919999999d }
+{ "partkey": 23, "part_value": 4531731.12d }
+{ "partkey": 68, "part_value": 4504770.61d }
+{ "partkey": 27, "part_value": 4371849.52d }
+{ "partkey": 36, "part_value": 4036576.8999999994d }
+{ "partkey": 129, "part_value": 3997604.78d }
+{ "partkey": 195, "part_value": 3817436.31d }
+{ "partkey": 59, "part_value": 3765210.2100000004d }
+{ "partkey": 57, "part_value": 3739347.12d }
+{ "partkey": 138, "part_value": 3567425.75d }
+{ "partkey": 174, "part_value": 3484708.3100000005d }
+{ "partkey": 164, "part_value": 3462215.0d }
+{ "partkey": 81, "part_value": 3421610.42d }
+{ "partkey": 46, "part_value": 3398443.33d }
+{ "partkey": 85, "part_value": 3338711.3899999997d }
+{ "partkey": 50, "part_value": 3145791.9699999997d }
+{ "partkey": 88, "part_value": 3117730.2399999998d }
+{ "partkey": 151, "part_value": 2727444.22d }
+{ "partkey": 152, "part_value": 1837809.1700000002d }
+{ "partkey": 133, "part_value": 1517282.3299999998d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q12_shipping/q12_shipping.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q12_shipping/q12_shipping.1.adm
new file mode 100644
index 0000000..e0eeaf8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q12_shipping/q12_shipping.1.adm
@@ -0,0 +1,2 @@
+{ "l_shipmode": "MAIL", "high_line_count": 5, "low_line_count": 5 }
+{ "l_shipmode": "SHIP", "high_line_count": 5, "low_line_count": 10 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q13_customer_distribution/q13_customer_distribution.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q13_customer_distribution/q13_customer_distribution.1.adm
new file mode 100644
index 0000000..9257a84
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q13_customer_distribution/q13_customer_distribution.1.adm
@@ -0,0 +1,27 @@
+{ "c_count": 0, "custdist": 50 }
+{ "c_count": 16, "custdist": 8 }
+{ "c_count": 17, "custdist": 7 }
+{ "c_count": 20, "custdist": 6 }
+{ "c_count": 13, "custdist": 6 }
+{ "c_count": 12, "custdist": 6 }
+{ "c_count": 9, "custdist": 6 }
+{ "c_count": 23, "custdist": 5 }
+{ "c_count": 14, "custdist": 5 }
+{ "c_count": 10, "custdist": 5 }
+{ "c_count": 21, "custdist": 4 }
+{ "c_count": 18, "custdist": 4 }
+{ "c_count": 11, "custdist": 4 }
+{ "c_count": 8, "custdist": 4 }
+{ "c_count": 7, "custdist": 4 }
+{ "c_count": 26, "custdist": 3 }
+{ "c_count": 22, "custdist": 3 }
+{ "c_count": 6, "custdist": 3 }
+{ "c_count": 5, "custdist": 3 }
+{ "c_count": 4, "custdist": 3 }
+{ "c_count": 29, "custdist": 2 }
+{ "c_count": 24, "custdist": 2 }
+{ "c_count": 19, "custdist": 2 }
+{ "c_count": 15, "custdist": 2 }
+{ "c_count": 28, "custdist": 1 }
+{ "c_count": 25, "custdist": 1 }
+{ "c_count": 3, "custdist": 1 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.adm
new file mode 100644
index 0000000..da45d73
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q14_promotion_effect/q14_promotion_effect.1.adm
@@ -0,0 +1 @@
+0.0d
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q15_top_supplier/q15_top_supplier.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q15_top_supplier/q15_top_supplier.1.adm
new file mode 100644
index 0000000..817794b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q15_top_supplier/q15_top_supplier.1.adm
@@ -0,0 +1 @@
+{ "s_suppkey": 10, "s_name": "Supplier#000000010", "s_address": "Saygah3gYWMp72i PY", "s_phone": "34-852-489-8585", "total_revenue": 797313.3838d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.adm
new file mode 100644
index 0000000..045b764
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.1.adm
@@ -0,0 +1,34 @@
+{ "p_brand": "Brand#11", "p_type": "PROMO ANODIZED TIN", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#11", "p_type": "SMALL PLATED COPPER", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#11", "p_type": "STANDARD POLISHED TIN", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#13", "p_type": "MEDIUM ANODIZED STEEL", "p_size": 36, "supplier_cnt": 4 }
+{ "p_brand": "Brand#13", "p_type": "SMALL BRUSHED NICKEL", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#14", "p_type": "SMALL ANODIZED NICKEL", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#15", "p_type": "LARGE ANODIZED BRASS", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#21", "p_type": "LARGE BURNISHED COPPER", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#23", "p_type": "ECONOMY BRUSHED COPPER", "p_size": 9, "supplier_cnt": 4 }
+{ "p_brand": "Brand#24", "p_type": "MEDIUM PLATED STEEL", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#25", "p_type": "MEDIUM PLATED BRASS", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#31", "p_type": "ECONOMY PLATED STEEL", "p_size": 23, "supplier_cnt": 4 }
+{ "p_brand": "Brand#31", "p_type": "PROMO POLISHED TIN", "p_size": 23, "supplier_cnt": 4 }
+{ "p_brand": "Brand#32", "p_type": "MEDIUM BURNISHED BRASS", "p_size": 49, "supplier_cnt": 4 }
+{ "p_brand": "Brand#33", "p_type": "LARGE BRUSHED TIN", "p_size": 36, "supplier_cnt": 4 }
+{ "p_brand": "Brand#33", "p_type": "SMALL BURNISHED NICKEL", "p_size": 3, "supplier_cnt": 4 }
+{ "p_brand": "Brand#34", "p_type": "LARGE PLATED BRASS", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#34", "p_type": "MEDIUM BRUSHED COPPER", "p_size": 9, "supplier_cnt": 4 }
+{ "p_brand": "Brand#34", "p_type": "SMALL PLATED BRASS", "p_size": 14, "supplier_cnt": 4 }
+{ "p_brand": "Brand#35", "p_type": "STANDARD ANODIZED STEEL", "p_size": 23, "supplier_cnt": 4 }
+{ "p_brand": "Brand#43", "p_type": "MEDIUM ANODIZED BRASS", "p_size": 14, "supplier_cnt": 4 }
+{ "p_brand": "Brand#43", "p_type": "PROMO POLISHED BRASS", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#43", "p_type": "SMALL BRUSHED NICKEL", "p_size": 9, "supplier_cnt": 4 }
+{ "p_brand": "Brand#44", "p_type": "SMALL PLATED COPPER", "p_size": 19, "supplier_cnt": 4 }
+{ "p_brand": "Brand#51", "p_type": "ECONOMY POLISHED STEEL", "p_size": 49, "supplier_cnt": 4 }
+{ "p_brand": "Brand#52", "p_type": "MEDIUM BURNISHED TIN", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#52", "p_type": "SMALL BURNISHED NICKEL", "p_size": 14, "supplier_cnt": 4 }
+{ "p_brand": "Brand#53", "p_type": "LARGE BURNISHED NICKEL", "p_size": 23, "supplier_cnt": 4 }
+{ "p_brand": "Brand#53", "p_type": "MEDIUM BRUSHED COPPER", "p_size": 3, "supplier_cnt": 4 }
+{ "p_brand": "Brand#53", "p_type": "STANDARD PLATED STEEL", "p_size": 45, "supplier_cnt": 4 }
+{ "p_brand": "Brand#54", "p_type": "ECONOMY ANODIZED BRASS", "p_size": 9, "supplier_cnt": 4 }
+{ "p_brand": "Brand#55", "p_type": "STANDARD ANODIZED BRASS", "p_size": 36, "supplier_cnt": 4 }
+{ "p_brand": "Brand#55", "p_type": "STANDARD BRUSHED COPPER", "p_size": 3, "supplier_cnt": 4 }
+{ "p_brand": "Brand#25", "p_type": "SMALL BURNISHED COPPER", "p_size": 3, "supplier_cnt": 3 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.3.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.3.adm
new file mode 100644
index 0000000..a109ef1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.3.adm
@@ -0,0 +1,200 @@
+{ "t_partkey": 1, "t_count": 35, "t_avg_quantity": 5.28d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 23786.4d, "t_avg_discount": 0.044000000000000004d, "t_avg_tax": 0.049142857142857155d, "t_max_shipdate": "1997-08-08", "t_min_commitdate": "1992-04-02", "t_min_receiptdate": "1992-02-28", "t_max_comment": "y ironic requests. bold, final ideas a" }
+{ "t_partkey": 2, "t_count": 34, "t_avg_quantity": 4.347058823529411d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 19605.235294117647d, "t_avg_discount": 0.049705882352941176d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-05-31", "t_min_commitdate": "1992-07-12", "t_min_receiptdate": "1992-07-08", "t_max_comment": "yly final dolphins? quickly ironic frets" }
+{ "t_partkey": 3, "t_count": 27, "t_avg_quantity": 4.896296296296296d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 22106.777777777777d, "t_avg_discount": 0.05481481481481482d, "t_avg_tax": 0.04185185185185186d, "t_max_shipdate": "1998-05-22", "t_min_commitdate": "1992-03-20", "t_min_receiptdate": "1992-05-04", "t_max_comment": "yly blithely pending packages" }
+{ "t_partkey": 4, "t_count": 26, "t_avg_quantity": 4.2615384615384615d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 19262.153846153848d, "t_avg_discount": 0.056538461538461544d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-08-26", "t_min_commitdate": "1992-03-21", "t_min_receiptdate": "1992-05-27", "t_max_comment": "y regular packages haggle furiously alongs" }
+{ "t_partkey": 5, "t_count": 32, "t_avg_quantity": 5.4750000000000005d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24774.375d, "t_avg_discount": 0.04125d, "t_avg_tax": 0.0390625d, "t_max_shipdate": "1998-07-19", "t_min_commitdate": "1992-05-12", "t_min_receiptdate": "1992-05-10", "t_max_comment": "y. careful" }
+{ "t_partkey": 6, "t_count": 34, "t_avg_quantity": 5.2058823529411775d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23582.647058823528d, "t_avg_discount": 0.05676470588235293d, "t_avg_tax": 0.04176470588235294d, "t_max_shipdate": "1998-09-05", "t_min_commitdate": "1992-04-24", "t_min_receiptdate": "1992-04-08", "t_max_comment": "yly express " }
+{ "t_partkey": 7, "t_count": 22, "t_avg_quantity": 4.7d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 21314.5d, "t_avg_discount": 0.05772727272727273d, "t_avg_tax": 0.041818181818181824d, "t_max_shipdate": "1998-07-27", "t_min_commitdate": "1992-05-31", "t_min_receiptdate": "1992-04-21", "t_max_comment": "ss the ironic, regular asymptotes cajole " }
+{ "t_partkey": 8, "t_count": 24, "t_avg_quantity": 4.783333333333334d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 21716.333333333332d, "t_avg_discount": 0.055d, "t_avg_tax": 0.04958333333333333d, "t_max_shipdate": "1998-07-04", "t_min_commitdate": "1992-10-24", "t_min_receiptdate": "1992-10-11", "t_max_comment": "uctions. furiously regular ins" }
+{ "t_partkey": 9, "t_count": 29, "t_avg_quantity": 5.331034482758621d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24229.55172413793d, "t_avg_discount": 0.04206896551724139d, "t_avg_tax": 0.03896551724137932d, "t_max_shipdate": "1998-06-12", "t_min_commitdate": "1992-03-30", "t_min_receiptdate": "1992-05-23", "t_max_comment": "yly ironic" }
+{ "t_partkey": 10, "t_count": 31, "t_avg_quantity": 5.509677419354839d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 25069.307741935485d, "t_avg_discount": 0.052903225806451626d, "t_avg_tax": 0.04548387096774194d, "t_max_shipdate": "1998-10-02", "t_min_commitdate": "1992-07-21", "t_min_receiptdate": "1992-05-18", "t_max_comment": "y quickly ironic accounts." }
+{ "t_partkey": 11, "t_count": 28, "t_avg_quantity": 5.521428571428572d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25150.383214285714d, "t_avg_discount": 0.05d, "t_avg_tax": 0.046071428571428576d, "t_max_shipdate": "1998-07-12", "t_min_commitdate": "1992-03-15", "t_min_receiptdate": "1992-02-26", "t_max_comment": "ven dependencies x-ray. quic" }
+{ "t_partkey": 12, "t_count": 24, "t_avg_quantity": 4.966666666666667d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 22648.248333333333d, "t_avg_discount": 0.04791666666666667d, "t_avg_tax": 0.05083333333333334d, "t_max_shipdate": "1998-04-14", "t_min_commitdate": "1992-05-03", "t_min_receiptdate": "1992-07-29", "t_max_comment": "xpress grouc" }
+{ "t_partkey": 13, "t_count": 26, "t_avg_quantity": 5.038461538461539d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23000.828846153847d, "t_avg_discount": 0.04153846153846154d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-10-04", "t_min_commitdate": "1992-03-31", "t_min_receiptdate": "1992-04-21", "t_max_comment": "wake at the carefully speci" }
+{ "t_partkey": 14, "t_count": 25, "t_avg_quantity": 4.5840000000000005d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 20949.1092d, "t_avg_discount": 0.055600000000000004d, "t_avg_tax": 0.0436d, "t_max_shipdate": "1998-10-17", "t_min_commitdate": "1992-07-16", "t_min_receiptdate": "1992-08-05", "t_max_comment": "thely. furio" }
+{ "t_partkey": 15, "t_count": 21, "t_avg_quantity": 5.133333333333334d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23485.256666666664d, "t_avg_discount": 0.051428571428571435d, "t_avg_tax": 0.03142857142857143d, "t_max_shipdate": "1998-02-14", "t_min_commitdate": "1992-04-01", "t_min_receiptdate": "1992-05-26", "t_max_comment": "ymptotes nag furiously slyly even inst" }
+{ "t_partkey": 16, "t_count": 29, "t_avg_quantity": 4.731034482758621d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 21668.37448275862d, "t_avg_discount": 0.049310344827586214d, "t_avg_tax": 0.034482758620689655d, "t_max_shipdate": "1998-11-02", "t_min_commitdate": "1992-08-06", "t_min_receiptdate": "1992-09-12", "t_max_comment": "yly blithely stealthy deposits. carefu" }
+{ "t_partkey": 17, "t_count": 31, "t_avg_quantity": 5.270967741935484d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 24167.650645161288d, "t_avg_discount": 0.05387096774193549d, "t_avg_tax": 0.04709677419354839d, "t_max_shipdate": "1998-10-04", "t_min_commitdate": "1992-08-07", "t_min_receiptdate": "1992-08-13", "t_max_comment": "uriously thin pinto beans " }
+{ "t_partkey": 18, "t_count": 32, "t_avg_quantity": 5.4437500000000005d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 24987.0846875d, "t_avg_discount": 0.05500000000000001d, "t_avg_tax": 0.039375d, "t_max_shipdate": "1998-11-13", "t_min_commitdate": "1992-04-14", "t_min_receiptdate": "1992-04-13", "t_max_comment": "y special packages. carefully ironic instru" }
+{ "t_partkey": 19, "t_count": 29, "t_avg_quantity": 5.151724137931034d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23672.43d, "t_avg_discount": 0.05275862068965517d, "t_avg_tax": 0.03896551724137932d, "t_max_shipdate": "1998-08-04", "t_min_commitdate": "1992-07-07", "t_min_receiptdate": "1992-08-15", "t_max_comment": "y along the excuses." }
+{ "t_partkey": 20, "t_count": 27, "t_avg_quantity": 4.955555555555556d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 22796.05111111111d, "t_avg_discount": 0.042222222222222223d, "t_avg_tax": 0.035555555555555556d, "t_max_shipdate": "1998-06-11", "t_min_commitdate": "1992-07-13", "t_min_receiptdate": "1992-06-21", "t_max_comment": "y. blithely r" }
+{ "t_partkey": 21, "t_count": 26, "t_avg_quantity": 4.730769230769231d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 21785.665384615386d, "t_avg_discount": 0.054615384615384614d, "t_avg_tax": 0.04076923076923077d, "t_max_shipdate": "1998-02-27", "t_min_commitdate": "1992-09-11", "t_min_receiptdate": "1992-08-08", "t_max_comment": "ymptotes haggle across the ca" }
+{ "t_partkey": 22, "t_count": 28, "t_avg_quantity": 5.300000000000001d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 24433.53d, "t_avg_discount": 0.057857142857142864d, "t_avg_tax": 0.045d, "t_max_shipdate": "1998-09-03", "t_min_commitdate": "1992-05-23", "t_min_receiptdate": "1992-07-12", "t_max_comment": "y final gifts are. carefully pe" }
+{ "t_partkey": 23, "t_count": 23, "t_avg_quantity": 5.22608695652174d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 24118.913913043478d, "t_avg_discount": 0.051304347826086956d, "t_avg_tax": 0.03173913043478261d, "t_max_shipdate": "1998-09-25", "t_min_commitdate": "1992-04-05", "t_min_receiptdate": "1992-05-02", "t_max_comment": "y unusual foxe" }
+{ "t_partkey": 24, "t_count": 35, "t_avg_quantity": 5.154285714285715d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23813.31542857143d, "t_avg_discount": 0.046d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-06-23", "t_min_commitdate": "1992-05-07", "t_min_receiptdate": "1992-04-21", "t_max_comment": "the slyly ironic pinto beans. fi" }
+{ "t_partkey": 25, "t_count": 26, "t_avg_quantity": 5.061538461538461d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23410.121538461535d, "t_avg_discount": 0.054615384615384614d, "t_avg_tax": 0.034999999999999996d, "t_max_shipdate": "1998-06-26", "t_min_commitdate": "1992-03-18", "t_min_receiptdate": "1992-02-24", "t_max_comment": "y alongside of the special requests." }
+{ "t_partkey": 26, "t_count": 23, "t_avg_quantity": 4.6521739130434785d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21540.030434782606d, "t_avg_discount": 0.03956521739130436d, "t_avg_tax": 0.043043478260869565d, "t_max_shipdate": "1998-10-09", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-03-20", "t_max_comment": "y special pinto beans cajole " }
+{ "t_partkey": 27, "t_count": 18, "t_avg_quantity": 5.9222222222222225d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 27450.092222222225d, "t_avg_discount": 0.061111111111111116d, "t_avg_tax": 0.045000000000000005d, "t_max_shipdate": "1998-09-19", "t_min_commitdate": "1992-06-12", "t_min_receiptdate": "1992-07-31", "t_max_comment": "y regular foxes. slyly ironic deposits " }
+{ "t_partkey": 28, "t_count": 21, "t_avg_quantity": 5.476190476190476d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 25410.071428571428d, "t_avg_discount": 0.04285714285714286d, "t_avg_tax": 0.032857142857142856d, "t_max_shipdate": "1998-01-02", "t_min_commitdate": "1992-05-31", "t_min_receiptdate": "1992-04-05", "t_max_comment": "ular accounts about" }
+{ "t_partkey": 29, "t_count": 35, "t_avg_quantity": 5.171428571428572d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24021.802857142855d, "t_avg_discount": 0.05657142857142857d, "t_avg_tax": 0.03942857142857143d, "t_max_shipdate": "1998-11-17", "t_min_commitdate": "1992-05-19", "t_min_receiptdate": "1992-06-06", "t_max_comment": "xcuses? quickly stealthy dependenci" }
+{ "t_partkey": 30, "t_count": 22, "t_avg_quantity": 4.754545454545455d, "t_max_suppkey": 9, "t_max_linenumber": 5, "t_avg_extendedprice": 22109.349545454545d, "t_avg_discount": 0.04727272727272727d, "t_avg_tax": 0.03318181818181818d, "t_max_shipdate": "1998-07-18", "t_min_commitdate": "1992-04-06", "t_min_receiptdate": "1992-05-01", "t_max_comment": "y. fluffily pending d" }
+{ "t_partkey": 31, "t_count": 31, "t_avg_quantity": 5.858064516129033d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 27270.16903225807d, "t_avg_discount": 0.050645161290322586d, "t_avg_tax": 0.035483870967741936d, "t_max_shipdate": "1998-08-08", "t_min_commitdate": "1992-05-23", "t_min_receiptdate": "1992-07-25", "t_max_comment": "xpress ideas detect b" }
+{ "t_partkey": 32, "t_count": 28, "t_avg_quantity": 5.050000000000001d, "t_max_suppkey": 8, "t_max_linenumber": 5, "t_avg_extendedprice": 23533.7575d, "t_avg_discount": 0.05249999999999999d, "t_avg_tax": 0.03321428571428571d, "t_max_shipdate": "1998-03-22", "t_min_commitdate": "1992-07-21", "t_min_receiptdate": "1992-09-27", "t_max_comment": "yers. accounts affix somet" }
+{ "t_partkey": 33, "t_count": 25, "t_avg_quantity": 5.04d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 23512.356d, "t_avg_discount": 0.044000000000000004d, "t_avg_tax": 0.03440000000000001d, "t_max_shipdate": "1998-08-01", "t_min_commitdate": "1992-04-26", "t_min_receiptdate": "1992-04-16", "t_max_comment": "yly enticing requ" }
+{ "t_partkey": 34, "t_count": 33, "t_avg_quantity": 4.575757575757576d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 21369.474242424243d, "t_avg_discount": 0.04666666666666667d, "t_avg_tax": 0.04363636363636364d, "t_max_shipdate": "1998-10-22", "t_min_commitdate": "1992-05-10", "t_min_receiptdate": "1992-07-24", "t_max_comment": "warthogs wake carefully acro" }
+{ "t_partkey": 35, "t_count": 26, "t_avg_quantity": 4.753846153846154d, "t_max_suppkey": 6, "t_max_linenumber": 6, "t_avg_extendedprice": 22224.94384615385d, "t_avg_discount": 0.05615384615384615d, "t_avg_tax": 0.04307692307692308d, "t_max_shipdate": "1998-08-13", "t_min_commitdate": "1992-04-12", "t_min_receiptdate": "1992-03-30", "t_max_comment": "y pending packages sleep blithely regular r" }
+{ "t_partkey": 36, "t_count": 25, "t_avg_quantity": 4.192d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 19619.188800000004d, "t_avg_discount": 0.054000000000000006d, "t_avg_tax": 0.034d, "t_max_shipdate": "1998-05-07", "t_min_commitdate": "1992-03-24", "t_min_receiptdate": "1992-03-20", "t_max_comment": "y slyly express deposits. final i" }
+{ "t_partkey": 37, "t_count": 17, "t_avg_quantity": 4.564705882352942d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 21386.331764705883d, "t_avg_discount": 0.06058823529411765d, "t_avg_tax": 0.05d, "t_max_shipdate": "1998-08-30", "t_min_commitdate": "1992-07-25", "t_min_receiptdate": "1992-09-10", "t_max_comment": "unts promise across the requests. blith" }
+{ "t_partkey": 38, "t_count": 26, "t_avg_quantity": 6.0076923076923086d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 28176.978076923075d, "t_avg_discount": 0.05653846153846154d, "t_avg_tax": 0.030384615384615385d, "t_max_shipdate": "1998-06-07", "t_min_commitdate": "1992-02-24", "t_min_receiptdate": "1992-04-26", "t_max_comment": "yly. blithely bold theodolites wa" }
+{ "t_partkey": 39, "t_count": 22, "t_avg_quantity": 4.454545454545455d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 20914.75909090909d, "t_avg_discount": 0.05318181818181819d, "t_avg_tax": 0.034999999999999996d, "t_max_shipdate": "1998-08-31", "t_min_commitdate": "1992-05-25", "t_min_receiptdate": "1992-06-03", "t_max_comment": "y. furiously ironic ideas gr" }
+{ "t_partkey": 40, "t_count": 34, "t_avg_quantity": 4.61764705882353d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 21703.864705882355d, "t_avg_discount": 0.0511764705882353d, "t_avg_tax": 0.03735294117647059d, "t_max_shipdate": "1998-06-12", "t_min_commitdate": "1992-03-04", "t_min_receiptdate": "1992-02-10", "t_max_comment": "y special a" }
+{ "t_partkey": 41, "t_count": 25, "t_avg_quantity": 5.936d, "t_max_suppkey": 10, "t_max_linenumber": 5, "t_avg_extendedprice": 27930.0672d, "t_avg_discount": 0.0484d, "t_avg_tax": 0.0444d, "t_max_shipdate": "1998-09-18", "t_min_commitdate": "1992-11-13", "t_min_receiptdate": "1993-01-09", "t_max_comment": "uffily even accounts. packages sleep blithe" }
+{ "t_partkey": 42, "t_count": 31, "t_avg_quantity": 3.7806451612903227d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 17807.594838709676d, "t_avg_discount": 0.05193548387096774d, "t_avg_tax": 0.0364516129032258d, "t_max_shipdate": "1998-08-12", "t_min_commitdate": "1992-10-29", "t_min_receiptdate": "1992-11-02", "t_max_comment": "y final platelets sublate among the " }
+{ "t_partkey": 43, "t_count": 32, "t_avg_quantity": 6.03125d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 28438.550000000003d, "t_avg_discount": 0.045000000000000005d, "t_avg_tax": 0.047812499999999994d, "t_max_shipdate": "1998-11-01", "t_min_commitdate": "1992-07-09", "t_min_receiptdate": "1992-07-07", "t_max_comment": "y regular packages. b" }
+{ "t_partkey": 44, "t_count": 23, "t_avg_quantity": 5.852173913043479d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 27623.43130434783d, "t_avg_discount": 0.05565217391304349d, "t_avg_tax": 0.04391304347826087d, "t_max_shipdate": "1998-08-12", "t_min_commitdate": "1992-02-16", "t_min_receiptdate": "1992-03-01", "t_max_comment": "unts. furiously silent" }
+{ "t_partkey": 45, "t_count": 34, "t_avg_quantity": 5.305882352941177d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25071.35529411765d, "t_avg_discount": 0.05147058823529413d, "t_avg_tax": 0.039411764705882354d, "t_max_shipdate": "1998-09-09", "t_min_commitdate": "1992-05-07", "t_min_receiptdate": "1992-07-23", "t_max_comment": "y. bold pinto beans use " }
+{ "t_partkey": 46, "t_count": 34, "t_avg_quantity": 4.405882352941177d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 20840.704705882352d, "t_avg_discount": 0.05823529411764706d, "t_avg_tax": 0.0411764705882353d, "t_max_shipdate": "1998-10-25", "t_min_commitdate": "1992-04-21", "t_min_receiptdate": "1992-05-18", "t_max_comment": "xpress pinto beans. accounts a" }
+{ "t_partkey": 47, "t_count": 31, "t_avg_quantity": 5.129032258064516d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24286.993548387094d, "t_avg_discount": 0.05064516129032258d, "t_avg_tax": 0.03967741935483871d, "t_max_shipdate": "1998-07-31", "t_min_commitdate": "1992-04-09", "t_min_receiptdate": "1992-04-05", "t_max_comment": "y ironic requests above the fluffily d" }
+{ "t_partkey": 48, "t_count": 37, "t_avg_quantity": 4.8756756756756765d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23111.67783783784d, "t_avg_discount": 0.04054054054054054d, "t_avg_tax": 0.03918918918918919d, "t_max_shipdate": "1998-08-17", "t_min_commitdate": "1992-05-30", "t_min_receiptdate": "1992-05-11", "t_max_comment": "y according to " }
+{ "t_partkey": 49, "t_count": 28, "t_avg_quantity": 5.4071428571428575d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 25657.97428571429d, "t_avg_discount": 0.0475d, "t_avg_tax": 0.04107142857142857d, "t_max_shipdate": "1998-09-03", "t_min_commitdate": "1992-02-27", "t_min_receiptdate": "1992-05-26", "t_max_comment": "unts alongs" }
+{ "t_partkey": 50, "t_count": 39, "t_avg_quantity": 4.4974358974358974d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21363.944871794873d, "t_avg_discount": 0.04820512820512821d, "t_avg_tax": 0.04025641025641026d, "t_max_shipdate": "1998-09-12", "t_min_commitdate": "1992-05-13", "t_min_receiptdate": "1992-04-29", "t_max_comment": "yly pending theodolites." }
+{ "t_partkey": 51, "t_count": 35, "t_avg_quantity": 4.908571428571429d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23341.484285714283d, "t_avg_discount": 0.04914285714285715d, "t_avg_tax": 0.039428571428571424d, "t_max_shipdate": "1998-08-01", "t_min_commitdate": "1992-03-30", "t_min_receiptdate": "1992-03-31", "t_max_comment": "y ironic pin" }
+{ "t_partkey": 52, "t_count": 32, "t_avg_quantity": 5.91875d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 28174.7296875d, "t_avg_discount": 0.051250000000000004d, "t_avg_tax": 0.049375d, "t_max_shipdate": "1998-09-09", "t_min_commitdate": "1992-05-09", "t_min_receiptdate": "1992-06-02", "t_max_comment": "y pending orbits boost after the slyly" }
+{ "t_partkey": 53, "t_count": 24, "t_avg_quantity": 5.175000000000001d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 24660.16875d, "t_avg_discount": 0.04875000000000001d, "t_avg_tax": 0.04583333333333333d, "t_max_shipdate": "1998-11-10", "t_min_commitdate": "1992-02-23", "t_min_receiptdate": "1992-01-25", "t_max_comment": "y orbits. final depos" }
+{ "t_partkey": 54, "t_count": 34, "t_avg_quantity": 5.01764705882353d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 23935.430882352943d, "t_avg_discount": 0.05205882352941177d, "t_avg_tax": 0.04147058823529412d, "t_max_shipdate": "1998-05-26", "t_min_commitdate": "1992-03-28", "t_min_receiptdate": "1992-04-09", "t_max_comment": "y pending notornis ab" }
+{ "t_partkey": 55, "t_count": 30, "t_avg_quantity": 6.553333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 31293.805d, "t_avg_discount": 0.050666666666666665d, "t_avg_tax": 0.03933333333333334d, "t_max_shipdate": "1998-06-06", "t_min_commitdate": "1992-03-12", "t_min_receiptdate": "1992-02-06", "t_max_comment": "yly regular i" }
+{ "t_partkey": 56, "t_count": 24, "t_avg_quantity": 4.825d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 23064.70625d, "t_avg_discount": 0.05583333333333334d, "t_avg_tax": 0.037916666666666675d, "t_max_shipdate": "1998-07-22", "t_min_commitdate": "1992-03-01", "t_min_receiptdate": "1992-02-06", "t_max_comment": "ts. ironic, fina" }
+{ "t_partkey": 57, "t_count": 37, "t_avg_quantity": 5.5297297297297305d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 26461.139189189194d, "t_avg_discount": 0.05297297297297297d, "t_avg_tax": 0.03945945945945946d, "t_max_shipdate": "1998-08-16", "t_min_commitdate": "1992-03-20", "t_min_receiptdate": "1992-01-17", "t_max_comment": "y. doggedly pend" }
+{ "t_partkey": 58, "t_count": 28, "t_avg_quantity": 4.764285714285715d, "t_max_suppkey": 10, "t_max_linenumber": 5, "t_avg_extendedprice": 22822.119642857146d, "t_avg_discount": 0.05571428571428571d, "t_avg_tax": 0.04535714285714286d, "t_max_shipdate": "1998-11-27", "t_min_commitdate": "1992-02-23", "t_min_receiptdate": "1992-05-17", "t_max_comment": "xpress, bo" }
+{ "t_partkey": 59, "t_count": 37, "t_avg_quantity": 5.567567567567568d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 26697.87837837838d, "t_avg_discount": 0.042702702702702704d, "t_avg_tax": 0.049459459459459454d, "t_max_shipdate": "1998-07-12", "t_min_commitdate": "1992-02-26", "t_min_receiptdate": "1992-02-11", "t_max_comment": "y. ironic deposits haggle sl" }
+{ "t_partkey": 60, "t_count": 28, "t_avg_quantity": 5.0d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 24001.5d, "t_avg_discount": 0.05428571428571429d, "t_avg_tax": 0.042499999999999996d, "t_max_shipdate": "1998-07-08", "t_min_commitdate": "1992-03-02", "t_min_receiptdate": "1992-03-02", "t_max_comment": "y across the express accounts. fluff" }
+{ "t_partkey": 61, "t_count": 29, "t_avg_quantity": 5.593103448275862d, "t_max_suppkey": 10, "t_max_linenumber": 5, "t_avg_extendedprice": 26876.539999999997d, "t_avg_discount": 0.04931034482758621d, "t_avg_tax": 0.04103448275862069d, "t_max_shipdate": "1998-08-06", "t_min_commitdate": "1993-06-25", "t_min_receiptdate": "1993-08-03", "t_max_comment": "y even asymptotes. courts are unusual pa" }
+{ "t_partkey": 62, "t_count": 24, "t_avg_quantity": 5.175000000000001d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 24893.3025d, "t_avg_discount": 0.048749999999999995d, "t_avg_tax": 0.04d, "t_max_shipdate": "1998-05-27", "t_min_commitdate": "1992-02-17", "t_min_receiptdate": "1992-02-08", "t_max_comment": "yly final accounts hag" }
+{ "t_partkey": 63, "t_count": 26, "t_avg_quantity": 4.992307692307692d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24039.45923076923d, "t_avg_discount": 0.052307692307692305d, "t_avg_tax": 0.04884615384615386d, "t_max_shipdate": "1998-05-08", "t_min_commitdate": "1992-03-07", "t_min_receiptdate": "1992-02-19", "t_max_comment": "y special packages wak" }
+{ "t_partkey": 64, "t_count": 31, "t_avg_quantity": 4.838709677419356d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23324.032258064515d, "t_avg_discount": 0.050645161290322586d, "t_avg_tax": 0.03709677419354839d, "t_max_shipdate": "1998-10-10", "t_min_commitdate": "1992-02-05", "t_min_receiptdate": "1992-02-29", "t_max_comment": "uietly regular foxes wake quick" }
+{ "t_partkey": 65, "t_count": 36, "t_avg_quantity": 5.033333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24287.343333333338d, "t_avg_discount": 0.049166666666666664d, "t_avg_tax": 0.04083333333333334d, "t_max_shipdate": "1998-06-17", "t_min_commitdate": "1992-04-14", "t_min_receiptdate": "1992-03-13", "t_max_comment": "y unusual packages. packages" }
+{ "t_partkey": 66, "t_count": 29, "t_avg_quantity": 4.23448275862069d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 20453.82206896552d, "t_avg_discount": 0.05068965517241379d, "t_avg_tax": 0.051034482758620686d, "t_max_shipdate": "1998-05-23", "t_min_commitdate": "1992-06-18", "t_min_receiptdate": "1992-05-10", "t_max_comment": "y. pinto beans haggle after the" }
+{ "t_partkey": 67, "t_count": 21, "t_avg_quantity": 4.523809523809525d, "t_max_suppkey": 8, "t_max_linenumber": 5, "t_avg_extendedprice": 21873.976190476194d, "t_avg_discount": 0.05428571428571429d, "t_avg_tax": 0.04476190476190477d, "t_max_shipdate": "1998-08-27", "t_min_commitdate": "1992-06-07", "t_min_receiptdate": "1992-05-26", "t_max_comment": "theodolite" }
+{ "t_partkey": 68, "t_count": 36, "t_avg_quantity": 4.388888888888888d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21243.53888888889d, "t_avg_discount": 0.059444444444444446d, "t_avg_tax": 0.04305555555555555d, "t_max_shipdate": "1998-09-10", "t_min_commitdate": "1992-06-03", "t_min_receiptdate": "1992-05-11", "t_max_comment": "y final ac" }
+{ "t_partkey": 69, "t_count": 24, "t_avg_quantity": 4.708333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 22813.287499999995d, "t_avg_discount": 0.059166666666666666d, "t_avg_tax": 0.03958333333333333d, "t_max_shipdate": "1998-09-02", "t_min_commitdate": "1992-06-04", "t_min_receiptdate": "1992-06-03", "t_max_comment": "yly furiously even id" }
+{ "t_partkey": 70, "t_count": 34, "t_avg_quantity": 5.029411764705883d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 24394.407352941176d, "t_avg_discount": 0.04558823529411765d, "t_avg_tax": 0.04352941176470588d, "t_max_shipdate": "1998-07-19", "t_min_commitdate": "1992-04-10", "t_min_receiptdate": "1992-04-29", "t_max_comment": "ts affix slyly accordi" }
+{ "t_partkey": 71, "t_count": 33, "t_avg_quantity": 5.024242424242424d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24394.455454545456d, "t_avg_discount": 0.04515151515151515d, "t_avg_tax": 0.03818181818181819d, "t_max_shipdate": "1998-10-03", "t_min_commitdate": "1992-10-19", "t_min_receiptdate": "1992-12-05", "t_max_comment": "y regular foxes wake among the final" }
+{ "t_partkey": 72, "t_count": 36, "t_avg_quantity": 4.833333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23491.691666666666d, "t_avg_discount": 0.053888888888888896d, "t_avg_tax": 0.038055555555555565d, "t_max_shipdate": "1998-07-21", "t_min_commitdate": "1992-09-04", "t_min_receiptdate": "1992-10-14", "t_max_comment": "yly along the ironic, fi" }
+{ "t_partkey": 73, "t_count": 27, "t_avg_quantity": 4.5851851851851855d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 22308.530740740738d, "t_avg_discount": 0.04481481481481482d, "t_avg_tax": 0.03333333333333333d, "t_max_shipdate": "1998-10-12", "t_min_commitdate": "1992-03-01", "t_min_receiptdate": "1992-01-09", "t_max_comment": "y even packages promise" }
+{ "t_partkey": 74, "t_count": 25, "t_avg_quantity": 6.016d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 29300.025600000004d, "t_avg_discount": 0.0528d, "t_avg_tax": 0.0388d, "t_max_shipdate": "1998-03-23", "t_min_commitdate": "1992-03-22", "t_min_receiptdate": "1992-03-25", "t_max_comment": "uests. blithely unus" }
+{ "t_partkey": 75, "t_count": 29, "t_avg_quantity": 5.131034482758621d, "t_max_suppkey": 6, "t_max_linenumber": 6, "t_avg_extendedprice": 25015.58896551724d, "t_avg_discount": 0.06310344827586208d, "t_avg_tax": 0.02896551724137931d, "t_max_shipdate": "1998-10-19", "t_min_commitdate": "1992-02-18", "t_min_receiptdate": "1992-03-31", "t_max_comment": "usly across the slyly busy accounts! fin" }
+{ "t_partkey": 76, "t_count": 21, "t_avg_quantity": 4.9714285714285715d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 24262.31142857143d, "t_avg_discount": 0.04d, "t_avg_tax": 0.041428571428571426d, "t_max_shipdate": "1998-05-31", "t_min_commitdate": "1992-08-25", "t_min_receiptdate": "1992-11-16", "t_max_comment": "y even accounts thrash care" }
+{ "t_partkey": 77, "t_count": 20, "t_avg_quantity": 6.08d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 29702.927999999996d, "t_avg_discount": 0.053500000000000006d, "t_avg_tax": 0.037d, "t_max_shipdate": "1998-06-16", "t_min_commitdate": "1992-09-20", "t_min_receiptdate": "1992-08-19", "t_max_comment": "usly at the blithely pending pl" }
+{ "t_partkey": 78, "t_count": 35, "t_avg_quantity": 4.485714285714286d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21936.71285714286d, "t_avg_discount": 0.05942857142857143d, "t_avg_tax": 0.042285714285714295d, "t_max_shipdate": "1998-08-03", "t_min_commitdate": "1992-03-24", "t_min_receiptdate": "1992-03-21", "t_max_comment": "yly after the fluffily regul" }
+{ "t_partkey": 79, "t_count": 37, "t_avg_quantity": 5.65945945945946d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27705.03486486486d, "t_avg_discount": 0.04810810810810811d, "t_avg_tax": 0.042432432432432436d, "t_max_shipdate": "1998-10-09", "t_min_commitdate": "1992-05-23", "t_min_receiptdate": "1992-08-24", "t_max_comment": "y slyly final" }
+{ "t_partkey": 80, "t_count": 29, "t_avg_quantity": 6.172413793103448d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 30247.296551724135d, "t_avg_discount": 0.04655172413793104d, "t_avg_tax": 0.03413793103448276d, "t_max_shipdate": "1998-10-08", "t_min_commitdate": "1992-07-01", "t_min_receiptdate": "1992-06-07", "t_max_comment": "yly ironic frets. pending foxes after " }
+{ "t_partkey": 81, "t_count": 21, "t_avg_quantity": 5.371428571428572d, "t_max_suppkey": 2, "t_max_linenumber": 7, "t_avg_extendedprice": 26349.005714285708d, "t_avg_discount": 0.044285714285714296d, "t_avg_tax": 0.04095238095238095d, "t_max_shipdate": "1998-06-02", "t_min_commitdate": "1992-04-18", "t_min_receiptdate": "1992-04-22", "t_max_comment": "yly even accounts. spe" }
+{ "t_partkey": 82, "t_count": 23, "t_avg_quantity": 4.3130434782608695d, "t_max_suppkey": 3, "t_max_linenumber": 7, "t_avg_extendedprice": 21178.768695652176d, "t_avg_discount": 0.05260869565217391d, "t_avg_tax": 0.043043478260869565d, "t_max_shipdate": "1998-04-09", "t_min_commitdate": "1992-08-17", "t_min_receiptdate": "1992-07-22", "t_max_comment": "ut the carefully special foxes. idle," }
+{ "t_partkey": 83, "t_count": 33, "t_avg_quantity": 5.115151515151515d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 25143.01575757576d, "t_avg_discount": 0.05303030303030303d, "t_avg_tax": 0.043030303030303044d, "t_max_shipdate": "1998-10-12", "t_min_commitdate": "1992-07-05", "t_min_receiptdate": "1992-06-25", "t_max_comment": "yly. slyly regular courts use silentl" }
+{ "t_partkey": 84, "t_count": 28, "t_avg_quantity": 5.585714285714285d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 27483.948571428573d, "t_avg_discount": 0.05464285714285715d, "t_avg_tax": 0.039999999999999994d, "t_max_shipdate": "1998-10-03", "t_min_commitdate": "1992-08-25", "t_min_receiptdate": "1992-09-16", "t_max_comment": "yly brave theod" }
+{ "t_partkey": 85, "t_count": 28, "t_avg_quantity": 4.121428571428572d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 20299.684285714284d, "t_avg_discount": 0.041785714285714294d, "t_avg_tax": 0.041785714285714294d, "t_max_shipdate": "1998-07-23", "t_min_commitdate": "1992-04-24", "t_min_receiptdate": "1992-03-10", "t_max_comment": "y. enticingly final depos" }
+{ "t_partkey": 86, "t_count": 36, "t_avg_quantity": 5.427777777777778d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 26761.115555555552d, "t_avg_discount": 0.049999999999999996d, "t_avg_tax": 0.04555555555555556d, "t_max_shipdate": "1998-07-10", "t_min_commitdate": "1992-04-14", "t_min_receiptdate": "1992-06-23", "t_max_comment": "unts. furiously express accounts w" }
+{ "t_partkey": 87, "t_count": 34, "t_avg_quantity": 4.658823529411765d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 22993.157647058822d, "t_avg_discount": 0.052352941176470595d, "t_avg_tax": 0.036470588235294116d, "t_max_shipdate": "1998-09-18", "t_min_commitdate": "1992-10-18", "t_min_receiptdate": "1992-10-15", "t_max_comment": "y final de" }
+{ "t_partkey": 88, "t_count": 29, "t_avg_quantity": 4.613793103448276d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 22793.983448275863d, "t_avg_discount": 0.04724137931034483d, "t_avg_tax": 0.039655172413793106d, "t_max_shipdate": "1998-10-27", "t_min_commitdate": "1992-06-03", "t_min_receiptdate": "1992-05-16", "t_max_comment": "y slyly ironic accounts. foxes haggle slyl" }
+{ "t_partkey": 89, "t_count": 28, "t_avg_quantity": 4.864285714285715d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24055.838571428576d, "t_avg_discount": 0.04642857142857143d, "t_avg_tax": 0.05035714285714286d, "t_max_shipdate": "1998-10-23", "t_min_commitdate": "1992-03-18", "t_min_receiptdate": "1992-05-07", "t_max_comment": "y carefully final ideas. f" }
+{ "t_partkey": 90, "t_count": 48, "t_avg_quantity": 5.4d, "t_max_suppkey": 1, "t_max_linenumber": 7, "t_avg_extendedprice": 26732.430000000004d, "t_avg_discount": 0.044583333333333336d, "t_avg_tax": 0.04229166666666667d, "t_max_shipdate": "1998-10-09", "t_min_commitdate": "1992-04-25", "t_min_receiptdate": "1992-03-17", "t_max_comment": "y regular notornis k" }
+{ "t_partkey": 91, "t_count": 28, "t_avg_quantity": 4.1571428571428575d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 20600.513571428568d, "t_avg_discount": 0.055714285714285716d, "t_avg_tax": 0.04107142857142858d, "t_max_shipdate": "1998-09-07", "t_min_commitdate": "1992-06-08", "t_min_receiptdate": "1992-06-20", "t_max_comment": "ven deposits about the regular, ironi" }
+{ "t_partkey": 92, "t_count": 30, "t_avg_quantity": 5.466666666666667d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 27117.126666666667d, "t_avg_discount": 0.060666666666666674d, "t_avg_tax": 0.044000000000000004d, "t_max_shipdate": "1997-11-30", "t_min_commitdate": "1992-03-15", "t_min_receiptdate": "1992-02-14", "t_max_comment": "warhorses wake never for the care" }
+{ "t_partkey": 93, "t_count": 31, "t_avg_quantity": 5.219354838709678d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 25916.445483870968d, "t_avg_discount": 0.05903225806451613d, "t_avg_tax": 0.04096774193548387d, "t_max_shipdate": "1998-11-25", "t_min_commitdate": "1992-05-29", "t_min_receiptdate": "1992-06-02", "t_max_comment": "ut the slyly bold pinto beans; fi" }
+{ "t_partkey": 94, "t_count": 32, "t_avg_quantity": 5.7d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 28331.565d, "t_avg_discount": 0.05d, "t_avg_tax": 0.040625d, "t_max_shipdate": "1998-03-09", "t_min_commitdate": "1992-04-09", "t_min_receiptdate": "1992-05-23", "t_max_comment": "y furious depen" }
+{ "t_partkey": 95, "t_count": 31, "t_avg_quantity": 4.7290322580645165d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23529.063548387097d, "t_avg_discount": 0.050967741935483875d, "t_avg_tax": 0.038387096774193545d, "t_max_shipdate": "1998-10-07", "t_min_commitdate": "1992-02-14", "t_min_receiptdate": "1992-03-23", "t_max_comment": "y final excuses. ironic, special requests a" }
+{ "t_partkey": 96, "t_count": 38, "t_avg_quantity": 5.368421052631579d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26737.15263157895d, "t_avg_discount": 0.04315789473684212d, "t_avg_tax": 0.04026315789473684d, "t_max_shipdate": "1998-11-03", "t_min_commitdate": "1992-05-16", "t_min_receiptdate": "1992-07-02", "t_max_comment": "y. slyly iron" }
+{ "t_partkey": 97, "t_count": 39, "t_avg_quantity": 4.774358974358974d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 23802.327948717946d, "t_avg_discount": 0.04717948717948718d, "t_avg_tax": 0.03794871794871795d, "t_max_shipdate": "1998-05-15", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-02-19", "t_max_comment": "y slyly express theodolites. slyly bo" }
+{ "t_partkey": 98, "t_count": 29, "t_avg_quantity": 4.441379310344828d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 22164.481379310342d, "t_avg_discount": 0.0506896551724138d, "t_avg_tax": 0.03862068965517241d, "t_max_shipdate": "1998-10-04", "t_min_commitdate": "1992-08-20", "t_min_receiptdate": "1992-10-08", "t_max_comment": "ven requests should sleep along " }
+{ "t_partkey": 99, "t_count": 22, "t_avg_quantity": 4.609090909090909d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 23024.48318181818d, "t_avg_discount": 0.05318181818181818d, "t_avg_tax": 0.038181818181818185d, "t_max_shipdate": "1998-02-16", "t_min_commitdate": "1992-03-03", "t_min_receiptdate": "1992-05-24", "t_max_comment": "yly pending excu" }
+{ "t_partkey": 100, "t_count": 41, "t_avg_quantity": 5.51219512195122d, "t_max_suppkey": 4, "t_max_linenumber": 6, "t_avg_extendedprice": 27563.731707317078d, "t_avg_discount": 0.05048780487804879d, "t_avg_tax": 0.04048780487804878d, "t_max_shipdate": "1998-06-24", "t_min_commitdate": "1992-03-06", "t_min_receiptdate": "1992-04-13", "t_max_comment": "xpress accounts sleep slyly re" }
+{ "t_partkey": 101, "t_count": 28, "t_avg_quantity": 5.707142857142857d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 28567.103571428568d, "t_avg_discount": 0.054285714285714284d, "t_avg_tax": 0.04571428571428572d, "t_max_shipdate": "1998-02-25", "t_min_commitdate": "1992-07-26", "t_min_receiptdate": "1992-08-20", "t_max_comment": "uses are care" }
+{ "t_partkey": 102, "t_count": 38, "t_avg_quantity": 4.263157894736842d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21360.552631578947d, "t_avg_discount": 0.05052631578947368d, "t_avg_tax": 0.04315789473684211d, "t_max_shipdate": "1998-09-01", "t_min_commitdate": "1992-09-09", "t_min_receiptdate": "1992-08-28", "t_max_comment": "y unusual packa" }
+{ "t_partkey": 103, "t_count": 25, "t_avg_quantity": 6.16d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 30895.48d, "t_avg_discount": 0.0408d, "t_avg_tax": 0.0432d, "t_max_shipdate": "1998-11-16", "t_min_commitdate": "1992-05-16", "t_min_receiptdate": "1992-04-20", "t_max_comment": "yly. unusu" }
+{ "t_partkey": 104, "t_count": 19, "t_avg_quantity": 5.178947368421053d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 26000.9052631579d, "t_avg_discount": 0.04263157894736842d, "t_avg_tax": 0.034210526315789476d, "t_max_shipdate": "1998-04-17", "t_min_commitdate": "1992-03-29", "t_min_receiptdate": "1992-04-13", "t_max_comment": "yly even gifts after the sl" }
+{ "t_partkey": 105, "t_count": 36, "t_avg_quantity": 5.194444444444445d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26104.68055555556d, "t_avg_discount": 0.05055555555555556d, "t_avg_tax": 0.03888888888888889d, "t_max_shipdate": "1998-08-25", "t_min_commitdate": "1992-03-19", "t_min_receiptdate": "1992-02-25", "t_max_comment": "yly into the carefully even " }
+{ "t_partkey": 106, "t_count": 27, "t_avg_quantity": 4.451851851851852d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 22395.040740740744d, "t_avg_discount": 0.039259259259259265d, "t_avg_tax": 0.039259259259259265d, "t_max_shipdate": "1998-07-25", "t_min_commitdate": "1992-05-18", "t_min_receiptdate": "1992-07-21", "t_max_comment": "y ironic foxes caj" }
+{ "t_partkey": 107, "t_count": 27, "t_avg_quantity": 4.733333333333333d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 23834.7d, "t_avg_discount": 0.04518518518518518d, "t_avg_tax": 0.037037037037037035d, "t_max_shipdate": "1998-09-29", "t_min_commitdate": "1992-06-25", "t_min_receiptdate": "1992-06-11", "t_max_comment": "y ruthless dolphins to " }
+{ "t_partkey": 108, "t_count": 28, "t_avg_quantity": 4.692857142857143d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 23654.346428571425d, "t_avg_discount": 0.05750000000000001d, "t_avg_tax": 0.046071428571428576d, "t_max_shipdate": "1998-09-07", "t_min_commitdate": "1992-06-14", "t_min_receiptdate": "1992-08-03", "t_max_comment": "y pending platelets x-ray ironically! pend" }
+{ "t_partkey": 109, "t_count": 35, "t_avg_quantity": 5.331428571428572d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26899.722857142857d, "t_avg_discount": 0.048571428571428564d, "t_avg_tax": 0.044571428571428574d, "t_max_shipdate": "1997-08-27", "t_min_commitdate": "1992-06-18", "t_min_receiptdate": "1992-07-05", "t_max_comment": "ts wake furiously " }
+{ "t_partkey": 110, "t_count": 29, "t_avg_quantity": 4.86896551724138d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 24590.95379310345d, "t_avg_discount": 0.05344827586206897d, "t_avg_tax": 0.03517241379310345d, "t_max_shipdate": "1998-05-03", "t_min_commitdate": "1992-10-29", "t_min_receiptdate": "1992-09-27", "t_max_comment": "xcuses sleep quickly along th" }
+{ "t_partkey": 111, "t_count": 26, "t_avg_quantity": 6.130769230769231d, "t_max_suppkey": 8, "t_max_linenumber": 5, "t_avg_extendedprice": 30994.410384615392d, "t_avg_discount": 0.05038461538461539d, "t_avg_tax": 0.03576923076923077d, "t_max_shipdate": "1998-06-18", "t_min_commitdate": "1992-05-11", "t_min_receiptdate": "1992-07-29", "t_max_comment": "usy pinto beans b" }
+{ "t_partkey": 112, "t_count": 28, "t_avg_quantity": 5.457142857142857d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 27616.144285714287d, "t_avg_discount": 0.038571428571428576d, "t_avg_tax": 0.041785714285714294d, "t_max_shipdate": "1998-10-18", "t_min_commitdate": "1992-10-23", "t_min_receiptdate": "1992-09-29", "t_max_comment": "zle carefully sauternes. quickly" }
+{ "t_partkey": 113, "t_count": 28, "t_avg_quantity": 5.078571428571429d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 25725.7575d, "t_avg_discount": 0.04785714285714287d, "t_avg_tax": 0.048571428571428564d, "t_max_shipdate": "1998-06-28", "t_min_commitdate": "1992-08-10", "t_min_receiptdate": "1992-06-14", "t_max_comment": "yly silent deposit" }
+{ "t_partkey": 114, "t_count": 24, "t_avg_quantity": 5.041666666666667d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25564.02291666667d, "t_avg_discount": 0.057916666666666665d, "t_avg_tax": 0.03958333333333334d, "t_max_shipdate": "1998-09-27", "t_min_commitdate": "1992-10-25", "t_min_receiptdate": "1992-12-04", "t_max_comment": "y unusual, ironic" }
+{ "t_partkey": 115, "t_count": 34, "t_avg_quantity": 4.594117647058823d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23317.673823529414d, "t_avg_discount": 0.045588235294117645d, "t_avg_tax": 0.03588235294117647d, "t_max_shipdate": "1998-04-27", "t_min_commitdate": "1992-04-19", "t_min_receiptdate": "1992-03-30", "t_max_comment": "y. final pearls kindle. accounts " }
+{ "t_partkey": 116, "t_count": 25, "t_avg_quantity": 5.5200000000000005d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 28044.635999999995d, "t_avg_discount": 0.0512d, "t_avg_tax": 0.046d, "t_max_shipdate": "1998-06-24", "t_min_commitdate": "1992-03-10", "t_min_receiptdate": "1992-04-14", "t_max_comment": "yly even epitaphs for the " }
+{ "t_partkey": 117, "t_count": 35, "t_avg_quantity": 5.337142857142858d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 27142.306857142856d, "t_avg_discount": 0.05742857142857143d, "t_avg_tax": 0.044285714285714296d, "t_max_shipdate": "1998-10-30", "t_min_commitdate": "1992-05-06", "t_min_receiptdate": "1992-05-11", "t_max_comment": "y ironic accounts. furiously even packa" }
+{ "t_partkey": 118, "t_count": 38, "t_avg_quantity": 4.321052631578947d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 21996.53447368421d, "t_avg_discount": 0.05342105263157895d, "t_avg_tax": 0.035526315789473684d, "t_max_shipdate": "1998-08-31", "t_min_commitdate": "1992-05-19", "t_min_receiptdate": "1992-07-02", "t_max_comment": "y. furiously even pinto be" }
+{ "t_partkey": 119, "t_count": 30, "t_avg_quantity": 5.4d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27515.970000000005d, "t_avg_discount": 0.058333333333333334d, "t_avg_tax": 0.043000000000000003d, "t_max_shipdate": "1998-08-15", "t_min_commitdate": "1992-05-19", "t_min_receiptdate": "1992-06-05", "t_max_comment": "y regular theodolites w" }
+{ "t_partkey": 120, "t_count": 36, "t_avg_quantity": 5.75d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 29328.449999999997d, "t_avg_discount": 0.05222222222222223d, "t_avg_tax": 0.045000000000000005d, "t_max_shipdate": "1998-08-25", "t_min_commitdate": "1992-04-04", "t_min_receiptdate": "1992-04-02", "t_max_comment": "yly regular p" }
+{ "t_partkey": 121, "t_count": 34, "t_avg_quantity": 4.576470588235295d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 23365.628235294116d, "t_avg_discount": 0.052352941176470595d, "t_avg_tax": 0.03470588235294118d, "t_max_shipdate": "1998-08-22", "t_min_commitdate": "1992-05-22", "t_min_receiptdate": "1992-05-03", "t_max_comment": "y quickly regular packages. car" }
+{ "t_partkey": 122, "t_count": 44, "t_avg_quantity": 4.677272727272728d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 23903.67d, "t_avg_discount": 0.05113636363636364d, "t_avg_tax": 0.03977272727272727d, "t_max_shipdate": "1998-10-29", "t_min_commitdate": "1992-03-23", "t_min_receiptdate": "1992-04-07", "t_max_comment": "y bold package" }
+{ "t_partkey": 123, "t_count": 30, "t_avg_quantity": 5.213333333333334d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 26669.327999999994d, "t_avg_discount": 0.04466666666666666d, "t_avg_tax": 0.04066666666666666d, "t_max_shipdate": "1998-09-23", "t_min_commitdate": "1992-03-18", "t_min_receiptdate": "1992-02-29", "t_max_comment": "y quickly regular theodolites. final t" }
+{ "t_partkey": 124, "t_count": 32, "t_avg_quantity": 4.9375d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 25282.962499999998d, "t_avg_discount": 0.0553125d, "t_avg_tax": 0.043125d, "t_max_shipdate": "1998-11-15", "t_min_commitdate": "1992-07-21", "t_min_receiptdate": "1992-06-18", "t_max_comment": "y express ideas impress" }
+{ "t_partkey": 125, "t_count": 20, "t_avg_quantity": 6.07d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 31112.392000000003d, "t_avg_discount": 0.035500000000000004d, "t_avg_tax": 0.034d, "t_max_shipdate": "1998-05-05", "t_min_commitdate": "1992-04-24", "t_min_receiptdate": "1992-04-12", "t_max_comment": "y final deposits wake furiously! slyl" }
+{ "t_partkey": 126, "t_count": 31, "t_avg_quantity": 4.812903225806452d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 24693.08129032258d, "t_avg_discount": 0.04387096774193548d, "t_avg_tax": 0.03483870967741936d, "t_max_shipdate": "1998-01-30", "t_min_commitdate": "1992-07-09", "t_min_receiptdate": "1992-08-21", "t_max_comment": "x furiously bold packages. expres" }
+{ "t_partkey": 127, "t_count": 25, "t_avg_quantity": 4.744d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 24363.2864d, "t_avg_discount": 0.055600000000000004d, "t_avg_tax": 0.034d, "t_max_shipdate": "1998-05-25", "t_min_commitdate": "1992-06-30", "t_min_receiptdate": "1992-06-10", "t_max_comment": "ts integrate. courts haggl" }
+{ "t_partkey": 128, "t_count": 27, "t_avg_quantity": 5.155555555555556d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 26502.648888888885d, "t_avg_discount": 0.047407407407407405d, "t_avg_tax": 0.042222222222222223d, "t_max_shipdate": "1998-07-09", "t_min_commitdate": "1992-03-24", "t_min_receiptdate": "1992-03-15", "t_max_comment": "usly bold requests sleep dogge" }
+{ "t_partkey": 129, "t_count": 35, "t_avg_quantity": 5.262857142857143d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27080.557714285715d, "t_avg_discount": 0.05600000000000001d, "t_avg_tax": 0.03514285714285714d, "t_max_shipdate": "1998-08-25", "t_min_commitdate": "1992-04-17", "t_min_receiptdate": "1992-04-02", "t_max_comment": "ven theodolites nag quickly. fluffi" }
+{ "t_partkey": 130, "t_count": 28, "t_avg_quantity": 6.0d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 30903.9d, "t_avg_discount": 0.04464285714285714d, "t_avg_tax": 0.04357142857142858d, "t_max_shipdate": "1998-07-19", "t_min_commitdate": "1992-05-30", "t_min_receiptdate": "1992-04-05", "t_max_comment": "ven theodolites around the slyly" }
+{ "t_partkey": 131, "t_count": 33, "t_avg_quantity": 4.715151515151515d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 24309.67090909091d, "t_avg_discount": 0.04454545454545455d, "t_avg_tax": 0.03878787878787879d, "t_max_shipdate": "1998-08-20", "t_min_commitdate": "1992-02-24", "t_min_receiptdate": "1992-03-09", "t_max_comment": "usual pinto beans." }
+{ "t_partkey": 132, "t_count": 30, "t_avg_quantity": 4.0200000000000005d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 20745.813000000002d, "t_avg_discount": 0.04733333333333334d, "t_avg_tax": 0.03766666666666667d, "t_max_shipdate": "1998-07-21", "t_min_commitdate": "1992-02-12", "t_min_receiptdate": "1992-04-30", "t_max_comment": "yly ironic foxes. regular requests h" }
+{ "t_partkey": 133, "t_count": 28, "t_avg_quantity": 5.6000000000000005d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 28927.639999999996d, "t_avg_discount": 0.048571428571428564d, "t_avg_tax": 0.029285714285714283d, "t_max_shipdate": "1998-05-12", "t_min_commitdate": "1992-07-07", "t_min_receiptdate": "1992-07-08", "t_max_comment": "xcuses would boost against the fluffily eve" }
+{ "t_partkey": 134, "t_count": 32, "t_avg_quantity": 5.6312500000000005d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 29117.222812499997d, "t_avg_discount": 0.051875000000000004d, "t_avg_tax": 0.0346875d, "t_max_shipdate": "1998-07-22", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-06-06", "t_max_comment": "usly busy account" }
+{ "t_partkey": 135, "t_count": 29, "t_avg_quantity": 4.793103448275862d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 24807.42586206897d, "t_avg_discount": 0.054827586206896546d, "t_avg_tax": 0.03482758620689656d, "t_max_shipdate": "1998-08-03", "t_min_commitdate": "1992-04-10", "t_min_receiptdate": "1992-05-14", "t_max_comment": "y; excuses use. ironic, close instru" }
+{ "t_partkey": 136, "t_count": 35, "t_avg_quantity": 5.16d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 26732.154000000002d, "t_avg_discount": 0.04542857142857143d, "t_avg_tax": 0.036d, "t_max_shipdate": "1998-08-06", "t_min_commitdate": "1992-04-24", "t_min_receiptdate": "1992-05-24", "t_max_comment": "y final pinto " }
+{ "t_partkey": 137, "t_count": 38, "t_avg_quantity": 5.736842105263158d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 29749.2552631579d, "t_avg_discount": 0.04026315789473685d, "t_avg_tax": 0.04421052631578948d, "t_max_shipdate": "1997-08-19", "t_min_commitdate": "1992-06-29", "t_min_receiptdate": "1992-06-19", "t_max_comment": "uests cajole carefully." }
+{ "t_partkey": 138, "t_count": 42, "t_avg_quantity": 5.666666666666667d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 29413.68333333333d, "t_avg_discount": 0.05452380952380952d, "t_avg_tax": 0.03928571428571429d, "t_max_shipdate": "1998-08-29", "t_min_commitdate": "1992-04-12", "t_min_receiptdate": "1992-07-09", "t_max_comment": "yly idle deposits. final, final fox" }
+{ "t_partkey": 139, "t_count": 34, "t_avg_quantity": 5.364705882352942d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27873.13411764706d, "t_avg_discount": 0.050588235294117656d, "t_avg_tax": 0.047058823529411764d, "t_max_shipdate": "1998-03-01", "t_min_commitdate": "1992-04-15", "t_min_receiptdate": "1992-04-28", "t_max_comment": "y express accounts above the exp" }
+{ "t_partkey": 140, "t_count": 35, "t_avg_quantity": 5.034285714285715d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 26181.809714285715d, "t_avg_discount": 0.054571428571428576d, "t_avg_tax": 0.04257142857142857d, "t_max_shipdate": "1998-06-24", "t_min_commitdate": "1992-04-14", "t_min_receiptdate": "1992-03-21", "t_max_comment": "y among the furiously special" }
+{ "t_partkey": 141, "t_count": 38, "t_avg_quantity": 5.5473684210526315d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 28877.935789473686d, "t_avg_discount": 0.037368421052631585d, "t_avg_tax": 0.052105263157894745d, "t_max_shipdate": "1998-10-26", "t_min_commitdate": "1992-02-26", "t_min_receiptdate": "1992-01-20", "t_max_comment": "yly silent ideas affix furiousl" }
+{ "t_partkey": 142, "t_count": 26, "t_avg_quantity": 6.138461538461539d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 31985.681538461537d, "t_avg_discount": 0.05d, "t_avg_tax": 0.047692307692307694d, "t_max_shipdate": "1998-06-06", "t_min_commitdate": "1992-12-21", "t_min_receiptdate": "1992-10-16", "t_max_comment": "usly bold instructions affix idly unusual, " }
+{ "t_partkey": 143, "t_count": 36, "t_avg_quantity": 4.95d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 25817.715000000004d, "t_avg_discount": 0.045000000000000005d, "t_avg_tax": 0.03972222222222222d, "t_max_shipdate": "1998-07-16", "t_min_commitdate": "1992-04-26", "t_min_receiptdate": "1992-05-17", "t_max_comment": "y pending foxes nag blithely " }
+{ "t_partkey": 144, "t_count": 32, "t_avg_quantity": 4.91875d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 25679.318125d, "t_avg_discount": 0.0465625d, "t_avg_tax": 0.0434375d, "t_max_shipdate": "1998-09-22", "t_min_commitdate": "1992-07-19", "t_min_receiptdate": "1992-07-30", "t_max_comment": "ve the fluffily " }
+{ "t_partkey": 145, "t_count": 24, "t_avg_quantity": 5.566666666666666d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 29089.73d, "t_avg_discount": 0.04541666666666667d, "t_avg_tax": 0.03666666666666666d, "t_max_shipdate": "1998-07-23", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-01-27", "t_max_comment": "yly even platelets wake. " }
+{ "t_partkey": 146, "t_count": 27, "t_avg_quantity": 4.792592592592593d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 25068.614074074078d, "t_avg_discount": 0.05925925925925926d, "t_avg_tax": 0.04407407407407408d, "t_max_shipdate": "1998-07-09", "t_min_commitdate": "1992-05-18", "t_min_receiptdate": "1992-05-27", "t_max_comment": "ut the slyly specia" }
+{ "t_partkey": 147, "t_count": 31, "t_avg_quantity": 4.625806451612903d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24219.334838709678d, "t_avg_discount": 0.05451612903225806d, "t_avg_tax": 0.04741935483870968d, "t_max_shipdate": "1998-06-18", "t_min_commitdate": "1992-07-06", "t_min_receiptdate": "1992-06-23", "t_max_comment": "yly special excuses. fluffily " }
+{ "t_partkey": 148, "t_count": 43, "t_avg_quantity": 5.158139534883722d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 27032.261860465118d, "t_avg_discount": 0.0516279069767442d, "t_avg_tax": 0.04093023255813954d, "t_max_shipdate": "1998-07-21", "t_min_commitdate": "1992-03-16", "t_min_receiptdate": "1992-01-27", "t_max_comment": "y special theodolites. carefully" }
+{ "t_partkey": 149, "t_count": 33, "t_avg_quantity": 4.363636363636363d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 22890.327272727274d, "t_avg_discount": 0.05d, "t_avg_tax": 0.03909090909090909d, "t_max_shipdate": "1998-06-06", "t_min_commitdate": "1992-03-06", "t_min_receiptdate": "1992-04-19", "t_max_comment": "y regular requests. furious" }
+{ "t_partkey": 150, "t_count": 29, "t_avg_quantity": 5.027586206896552d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 26398.598275862067d, "t_avg_discount": 0.05517241379310344d, "t_avg_tax": 0.04206896551724138d, "t_max_shipdate": "1998-08-06", "t_min_commitdate": "1992-05-26", "t_min_receiptdate": "1992-05-09", "t_max_comment": "thely around the bli" }
+{ "t_partkey": 151, "t_count": 24, "t_avg_quantity": 4.175d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 21942.756249999995d, "t_avg_discount": 0.045000000000000005d, "t_avg_tax": 0.03291666666666667d, "t_max_shipdate": "1998-08-09", "t_min_commitdate": "1992-02-05", "t_min_receiptdate": "1992-02-13", "t_max_comment": "y unusual foxes " }
+{ "t_partkey": 152, "t_count": 27, "t_avg_quantity": 4.970370370370371d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26147.875925925924d, "t_avg_discount": 0.050370370370370364d, "t_avg_tax": 0.03888888888888889d, "t_max_shipdate": "1998-04-20", "t_min_commitdate": "1992-05-10", "t_min_receiptdate": "1992-07-04", "t_max_comment": "ully. carefully final accounts accordi" }
+{ "t_partkey": 153, "t_count": 35, "t_avg_quantity": 5.514285714285715d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 29036.85d, "t_avg_discount": 0.045714285714285714d, "t_avg_tax": 0.03885714285714286d, "t_max_shipdate": "1998-08-17", "t_min_commitdate": "1992-02-18", "t_min_receiptdate": "1992-03-02", "t_max_comment": "y above the bli" }
+{ "t_partkey": 154, "t_count": 30, "t_avg_quantity": 4.54d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 23929.205d, "t_avg_discount": 0.04933333333333333d, "t_avg_tax": 0.041666666666666664d, "t_max_shipdate": "1998-09-29", "t_min_commitdate": "1992-03-06", "t_min_receiptdate": "1992-03-01", "t_max_comment": "vely ironic accounts. furiously unusual acc" }
+{ "t_partkey": 155, "t_count": 23, "t_avg_quantity": 6.069565217391305d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 32021.508695652174d, "t_avg_discount": 0.0508695652173913d, "t_avg_tax": 0.037391304347826095d, "t_max_shipdate": "1998-07-27", "t_min_commitdate": "1992-10-21", "t_min_receiptdate": "1992-09-30", "t_max_comment": "y regular requests haggle." }
+{ "t_partkey": 156, "t_count": 39, "t_avg_quantity": 5.333333333333334d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 28164.0d, "t_avg_discount": 0.0458974358974359d, "t_avg_tax": 0.04410256410256411d, "t_max_shipdate": "1998-08-09", "t_min_commitdate": "1992-02-18", "t_min_receiptdate": "1992-05-03", "t_max_comment": "y regular instructions doze furiously. reg" }
+{ "t_partkey": 157, "t_count": 28, "t_avg_quantity": 5.414285714285715d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 28618.560714285715d, "t_avg_discount": 0.05714285714285714d, "t_avg_tax": 0.03964285714285714d, "t_max_shipdate": "1997-11-27", "t_min_commitdate": "1992-06-30", "t_min_receiptdate": "1992-08-01", "t_max_comment": "y regular requests engage furiously final d" }
+{ "t_partkey": 158, "t_count": 25, "t_avg_quantity": 5.144d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27215.618000000002d, "t_avg_discount": 0.044000000000000004d, "t_avg_tax": 0.036800000000000006d, "t_max_shipdate": "1998-07-16", "t_min_commitdate": "1992-06-04", "t_min_receiptdate": "1992-08-07", "t_max_comment": "uctions cajole" }
+{ "t_partkey": 159, "t_count": 32, "t_avg_quantity": 4.9625d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 26280.159375000003d, "t_avg_discount": 0.0578125d, "t_avg_tax": 0.043125000000000004d, "t_max_shipdate": "1998-05-25", "t_min_commitdate": "1992-02-10", "t_min_receiptdate": "1992-05-20", "t_max_comment": "y special ideas. express packages pr" }
+{ "t_partkey": 160, "t_count": 42, "t_avg_quantity": 4.338095238095238d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 22995.37523809524d, "t_avg_discount": 0.04690476190476191d, "t_avg_tax": 0.03785714285714287d, "t_max_shipdate": "1998-08-14", "t_min_commitdate": "1992-04-07", "t_min_receiptdate": "1992-05-13", "t_max_comment": "yly silent deposits" }
+{ "t_partkey": 161, "t_count": 33, "t_avg_quantity": 5.109090909090909d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 27107.814545454545d, "t_avg_discount": 0.04666666666666667d, "t_avg_tax": 0.04606060606060606d, "t_max_shipdate": "1998-09-11", "t_min_commitdate": "1992-04-27", "t_min_receiptdate": "1992-04-09", "t_max_comment": "y ironic pin" }
+{ "t_partkey": 162, "t_count": 42, "t_avg_quantity": 4.895238095238096d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 25997.630476190476d, "t_avg_discount": 0.05833333333333335d, "t_avg_tax": 0.03547619047619048d, "t_max_shipdate": "1998-09-18", "t_min_commitdate": "1992-04-27", "t_min_receiptdate": "1992-04-14", "t_max_comment": "y asymptotes. regular depen" }
+{ "t_partkey": 163, "t_count": 28, "t_avg_quantity": 5.550000000000001d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 29502.690000000002d, "t_avg_discount": 0.045d, "t_avg_tax": 0.032499999999999994d, "t_max_shipdate": "1998-04-18", "t_min_commitdate": "1992-03-07", "t_min_receiptdate": "1992-03-09", "t_max_comment": "y fluffily stealt" }
+{ "t_partkey": 164, "t_count": 26, "t_avg_quantity": 4.915384615384616d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 26153.778461538463d, "t_avg_discount": 0.04076923076923077d, "t_avg_tax": 0.04115384615384616d, "t_max_shipdate": "1998-10-17", "t_min_commitdate": "1992-03-31", "t_min_receiptdate": "1992-04-04", "t_max_comment": "ymptotes boost. furiously bold p" }
+{ "t_partkey": 165, "t_count": 36, "t_avg_quantity": 5.561111111111112d, "t_max_suppkey": 10, "t_max_linenumber": 5, "t_avg_extendedprice": 29617.365555555552d, "t_avg_discount": 0.05277777777777778d, "t_avg_tax": 0.03777777777777778d, "t_max_shipdate": "1998-06-07", "t_min_commitdate": "1992-03-17", "t_min_receiptdate": "1992-04-07", "t_max_comment": "y unusual deposits prom" }
+{ "t_partkey": 166, "t_count": 33, "t_avg_quantity": 4.830303030303031d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 25749.37939393939d, "t_avg_discount": 0.04666666666666667d, "t_avg_tax": 0.03878787878787879d, "t_max_shipdate": "1998-08-11", "t_min_commitdate": "1992-06-07", "t_min_receiptdate": "1992-08-16", "t_max_comment": "uses detect spec" }
+{ "t_partkey": 167, "t_count": 31, "t_avg_quantity": 4.851612903225806d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25887.236129032255d, "t_avg_discount": 0.052258064516129035d, "t_avg_tax": 0.037096774193548385d, "t_max_shipdate": "1998-05-02", "t_min_commitdate": "1992-05-30", "t_min_receiptdate": "1992-06-08", "t_max_comment": "yly final packages according to the quickl" }
+{ "t_partkey": 168, "t_count": 36, "t_avg_quantity": 5.1722222222222225d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 27623.804444444442d, "t_avg_discount": 0.04944444444444445d, "t_avg_tax": 0.03666666666666667d, "t_max_shipdate": "1998-06-26", "t_min_commitdate": "1992-05-20", "t_min_receiptdate": "1992-05-07", "t_max_comment": "xpress requests haggle after the final, fi" }
+{ "t_partkey": 169, "t_count": 35, "t_avg_quantity": 5.822857142857143d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 31127.829714285715d, "t_avg_discount": 0.047999999999999994d, "t_avg_tax": 0.038857142857142854d, "t_max_shipdate": "1998-07-30", "t_min_commitdate": "1992-04-18", "t_min_receiptdate": "1992-04-18", "t_max_comment": "yly final theodolites. furi" }
+{ "t_partkey": 170, "t_count": 27, "t_avg_quantity": 4.874074074074074d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 26080.43925925926d, "t_avg_discount": 0.050740740740740746d, "t_avg_tax": 0.044814814814814814d, "t_max_shipdate": "1998-10-30", "t_min_commitdate": "1992-06-24", "t_min_receiptdate": "1992-08-13", "t_max_comment": "yly ironic " }
+{ "t_partkey": 171, "t_count": 18, "t_avg_quantity": 4.533333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24279.853333333333d, "t_avg_discount": 0.04055555555555555d, "t_avg_tax": 0.036666666666666674d, "t_max_shipdate": "1998-07-28", "t_min_commitdate": "1992-10-15", "t_min_receiptdate": "1992-11-11", "t_max_comment": "uriously ironic accounts. ironic, ir" }
+{ "t_partkey": 172, "t_count": 18, "t_avg_quantity": 5.1000000000000005d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 27340.335d, "t_avg_discount": 0.05222222222222222d, "t_avg_tax": 0.03722222222222223d, "t_max_shipdate": "1998-08-21", "t_min_commitdate": "1992-09-18", "t_min_receiptdate": "1992-09-26", "t_max_comment": "wake carefully alongside of " }
+{ "t_partkey": 173, "t_count": 34, "t_avg_quantity": 5.247058823529412d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 28154.930588235293d, "t_avg_discount": 0.054411764705882354d, "t_avg_tax": 0.048529411764705876d, "t_max_shipdate": "1998-09-17", "t_min_commitdate": "1992-06-20", "t_min_receiptdate": "1992-06-21", "t_max_comment": "uses. fluffily fina" }
+{ "t_partkey": 174, "t_count": 31, "t_avg_quantity": 5.3419354838709685d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 28690.734193548382d, "t_avg_discount": 0.05354838709677419d, "t_avg_tax": 0.046129032258064515d, "t_max_shipdate": "1998-05-31", "t_min_commitdate": "1992-09-05", "t_min_receiptdate": "1992-07-14", "t_max_comment": "y unusual packages thrash pinto " }
+{ "t_partkey": 175, "t_count": 31, "t_avg_quantity": 5.658064516129032d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 30416.906129032257d, "t_avg_discount": 0.04548387096774193d, "t_avg_tax": 0.03387096774193549d, "t_max_shipdate": "1998-09-06", "t_min_commitdate": "1992-09-30", "t_min_receiptdate": "1992-10-22", "t_max_comment": "yly special " }
+{ "t_partkey": 176, "t_count": 28, "t_avg_quantity": 6.078571428571429d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 32707.88107142857d, "t_avg_discount": 0.06d, "t_avg_tax": 0.03642857142857143d, "t_max_shipdate": "1998-11-11", "t_min_commitdate": "1992-02-28", "t_min_receiptdate": "1992-02-21", "t_max_comment": "y unusual foxes cajole ab" }
+{ "t_partkey": 177, "t_count": 29, "t_avg_quantity": 4.675862068965517d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 25183.491724137926d, "t_avg_discount": 0.045517241379310354d, "t_avg_tax": 0.04482758620689655d, "t_max_shipdate": "1998-08-24", "t_min_commitdate": "1992-04-05", "t_min_receiptdate": "1992-05-04", "t_max_comment": "y ironic instructions cajole" }
+{ "t_partkey": 178, "t_count": 41, "t_avg_quantity": 5.414634146341464d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 29189.480487804878d, "t_avg_discount": 0.04878048780487805d, "t_avg_tax": 0.038780487804878055d, "t_max_shipdate": "1998-11-11", "t_min_commitdate": "1992-06-01", "t_min_receiptdate": "1992-06-18", "t_max_comment": "yly ironic decoys; regular, iron" }
+{ "t_partkey": 179, "t_count": 19, "t_avg_quantity": 6.010526315789474d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 32431.898421052636d, "t_avg_discount": 0.04263157894736842d, "t_avg_tax": 0.02368421052631579d, "t_max_shipdate": "1997-06-03", "t_min_commitdate": "1992-04-18", "t_min_receiptdate": "1992-06-10", "t_max_comment": "y regular pain" }
+{ "t_partkey": 180, "t_count": 29, "t_avg_quantity": 4.096551724137931d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 22125.06620689655d, "t_avg_discount": 0.04758620689655172d, "t_avg_tax": 0.036551724137931035d, "t_max_shipdate": "1998-10-28", "t_min_commitdate": "1992-04-02", "t_min_receiptdate": "1992-03-18", "t_max_comment": "y final foxes by the sl" }
+{ "t_partkey": 181, "t_count": 26, "t_avg_quantity": 4.307692307692308d, "t_max_suppkey": 2, "t_max_linenumber": 6, "t_avg_extendedprice": 23286.953846153843d, "t_avg_discount": 0.05615384615384615d, "t_avg_tax": 0.05153846153846154d, "t_max_shipdate": "1998-10-23", "t_min_commitdate": "1992-07-25", "t_min_receiptdate": "1992-07-02", "t_max_comment": "ts across the even requests doze furiously" }
+{ "t_partkey": 182, "t_count": 23, "t_avg_quantity": 4.234782608695652d, "t_max_suppkey": 3, "t_max_linenumber": 7, "t_avg_extendedprice": 22913.985217391306d, "t_avg_discount": 0.03782608695652174d, "t_avg_tax": 0.036521739130434785d, "t_max_shipdate": "1998-11-04", "t_min_commitdate": "1992-04-21", "t_min_receiptdate": "1992-03-13", "t_max_comment": "yly. express ideas agai" }
+{ "t_partkey": 183, "t_count": 31, "t_avg_quantity": 4.851612903225806d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 26275.85032258064d, "t_avg_discount": 0.043225806451612905d, "t_avg_tax": 0.04064516129032259d, "t_max_shipdate": "1998-05-26", "t_min_commitdate": "1992-03-21", "t_min_receiptdate": "1992-05-02", "t_max_comment": "y. even excuses" }
+{ "t_partkey": 184, "t_count": 42, "t_avg_quantity": 5.380952380952381d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 29169.604761904764d, "t_avg_discount": 0.048809523809523817d, "t_avg_tax": 0.035d, "t_max_shipdate": "1998-07-14", "t_min_commitdate": "1992-04-23", "t_min_receiptdate": "1992-04-14", "t_max_comment": "y regular pinto beans. evenly regular packa" }
+{ "t_partkey": 185, "t_count": 21, "t_avg_quantity": 4.542857142857144d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 24649.088571428572d, "t_avg_discount": 0.04619047619047619d, "t_avg_tax": 0.042857142857142864d, "t_max_shipdate": "1998-06-16", "t_min_commitdate": "1992-02-11", "t_min_receiptdate": "1992-05-30", "t_max_comment": "unusual theodol" }
+{ "t_partkey": 186, "t_count": 30, "t_avg_quantity": 4.206666666666667d, "t_max_suppkey": 7, "t_max_linenumber": 7, "t_avg_extendedprice": 22845.986d, "t_avg_discount": 0.04766666666666667d, "t_avg_tax": 0.044666666666666674d, "t_max_shipdate": "1998-03-06", "t_min_commitdate": "1992-07-07", "t_min_receiptdate": "1992-08-04", "t_max_comment": "ymptotes could u" }
+{ "t_partkey": 187, "t_count": 29, "t_avg_quantity": 5.627586206896552d, "t_max_suppkey": 8, "t_max_linenumber": 6, "t_avg_extendedprice": 30590.99586206896d, "t_avg_discount": 0.048965517241379306d, "t_avg_tax": 0.04103448275862069d, "t_max_shipdate": "1998-11-11", "t_min_commitdate": "1992-05-01", "t_min_receiptdate": "1992-04-13", "t_max_comment": "y even forges. fluffily furious accounts" }
+{ "t_partkey": 188, "t_count": 31, "t_avg_quantity": 4.2129032258064525d, "t_max_suppkey": 9, "t_max_linenumber": 6, "t_avg_extendedprice": 22921.98516129032d, "t_avg_discount": 0.06483870967741935d, "t_avg_tax": 0.03483870967741936d, "t_max_shipdate": "1998-06-19", "t_min_commitdate": "1992-08-05", "t_min_receiptdate": "1992-10-05", "t_max_comment": "y regular asymptotes doz" }
+{ "t_partkey": 189, "t_count": 33, "t_avg_quantity": 4.533333333333334d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 24688.079999999998d, "t_avg_discount": 0.053333333333333344d, "t_avg_tax": 0.03757575757575757d, "t_max_shipdate": "1998-07-26", "t_min_commitdate": "1992-06-08", "t_min_receiptdate": "1992-07-03", "t_max_comment": "y sly theodolites. ironi" }
+{ "t_partkey": 190, "t_count": 39, "t_avg_quantity": 4.912820512820513d, "t_max_suppkey": 1, "t_max_linenumber": 7, "t_avg_extendedprice": 26779.538974358973d, "t_avg_discount": 0.04743589743589744d, "t_avg_tax": 0.03538461538461539d, "t_max_shipdate": "1998-09-24", "t_min_commitdate": "1992-05-02", "t_min_receiptdate": "1992-05-11", "t_max_comment": "y final foxes sleep blithely sl" }
+{ "t_partkey": 191, "t_count": 40, "t_avg_quantity": 5.5200000000000005d, "t_max_suppkey": 5, "t_max_linenumber": 7, "t_avg_extendedprice": 30116.844d, "t_avg_discount": 0.0475d, "t_avg_tax": 0.04025d, "t_max_shipdate": "1998-10-08", "t_min_commitdate": "1992-06-09", "t_min_receiptdate": "1992-08-09", "t_max_comment": "ys engage. th" }
+{ "t_partkey": 192, "t_count": 29, "t_avg_quantity": 4.655172413793103d, "t_max_suppkey": 6, "t_max_linenumber": 7, "t_avg_extendedprice": 25421.66379310345d, "t_avg_discount": 0.04724137931034483d, "t_avg_tax": 0.04586206896551724d, "t_max_shipdate": "1998-05-26", "t_min_commitdate": "1992-04-06", "t_min_receiptdate": "1992-03-02", "t_max_comment": "y. fluffily bold accounts grow. furio" }
+{ "t_partkey": 193, "t_count": 27, "t_avg_quantity": 4.4222222222222225d, "t_max_suppkey": 7, "t_max_linenumber": 6, "t_avg_extendedprice": 24171.64555555556d, "t_avg_discount": 0.044814814814814814d, "t_avg_tax": 0.02851851851851852d, "t_max_shipdate": "1998-08-19", "t_min_commitdate": "1992-05-05", "t_min_receiptdate": "1992-06-03", "t_max_comment": "y players sleep along the final, pending " }
+{ "t_partkey": 194, "t_count": 28, "t_avg_quantity": 4.457142857142857d, "t_max_suppkey": 8, "t_max_linenumber": 7, "t_avg_extendedprice": 24384.80571428571d, "t_avg_discount": 0.04071428571428572d, "t_avg_tax": 0.031785714285714285d, "t_max_shipdate": "1998-07-06", "t_min_commitdate": "1992-03-18", "t_min_receiptdate": "1992-02-23", "t_max_comment": "y silent requests. regular, even accounts" }
+{ "t_partkey": 195, "t_count": 30, "t_avg_quantity": 5.053333333333334d, "t_max_suppkey": 9, "t_max_linenumber": 7, "t_avg_extendedprice": 27671.800666666666d, "t_avg_discount": 0.04833333333333333d, "t_avg_tax": 0.045000000000000005d, "t_max_shipdate": "1998-01-21", "t_min_commitdate": "1992-02-12", "t_min_receiptdate": "1992-05-05", "t_max_comment": "yly pending packages snooz" }
+{ "t_partkey": 196, "t_count": 36, "t_avg_quantity": 5.011111111111112d, "t_max_suppkey": 10, "t_max_linenumber": 6, "t_avg_extendedprice": 27465.649444444443d, "t_avg_discount": 0.04972222222222223d, "t_avg_tax": 0.03944444444444444d, "t_max_shipdate": "1998-10-17", "t_min_commitdate": "1992-03-14", "t_min_receiptdate": "1992-03-27", "t_max_comment": "y quickly " }
+{ "t_partkey": 197, "t_count": 32, "t_avg_quantity": 5.2125d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 28595.514375d, "t_avg_discount": 0.0553125d, "t_avg_tax": 0.0378125d, "t_max_shipdate": "1998-05-19", "t_min_commitdate": "1993-09-09", "t_min_receiptdate": "1993-08-23", "t_max_comment": "warhorses slee" }
+{ "t_partkey": 198, "t_count": 31, "t_avg_quantity": 4.587096774193548d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 25187.519032258064d, "t_avg_discount": 0.03967741935483871d, "t_avg_tax": 0.035806451612903224d, "t_max_shipdate": "1998-10-06", "t_min_commitdate": "1992-02-23", "t_min_receiptdate": "1992-05-15", "t_max_comment": "y even accounts. quickly bold decoys" }
+{ "t_partkey": 199, "t_count": 32, "t_avg_quantity": 5.5062500000000005d, "t_max_suppkey": 10, "t_max_linenumber": 7, "t_avg_extendedprice": 30262.0746875d, "t_avg_discount": 0.052812500000000005d, "t_avg_tax": 0.043750000000000004d, "t_max_shipdate": "1998-08-14", "t_min_commitdate": "1992-05-13", "t_min_receiptdate": "1992-03-28", "t_max_comment": "y carefully ironi" }
+{ "t_partkey": 200, "t_count": 24, "t_avg_quantity": 5.458333333333334d, "t_max_suppkey": 4, "t_max_linenumber": 7, "t_avg_extendedprice": 30026.291666666668d, "t_avg_discount": 0.049166666666666664d, "t_avg_tax": 0.03375d, "t_max_shipdate": "1998-09-04", "t_min_commitdate": "1992-05-28", "t_min_receiptdate": "1992-05-12", "t_max_comment": "y silent foxes! carefully ruthless cour" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.adm
new file mode 100644
index 0000000..a09cde0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.1.adm
@@ -0,0 +1 @@
+863.2285714285715d
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.1.adm
new file mode 100644
index 0000000..453d5e2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.1.adm
@@ -0,0 +1,100 @@
+{ "c_name": "Customer#000000070", "c_custkey": 70, "o_orderkey": 2567, "o_orderdate": "1998-02-27", "o_totalprice": 263411.29d, "sum_quantity": 266 }
+{ "c_name": "Customer#000000010", "c_custkey": 10, "o_orderkey": 4421, "o_orderdate": "1997-04-04", "o_totalprice": 258779.02d, "sum_quantity": 255 }
+{ "c_name": "Customer#000000052", "c_custkey": 52, "o_orderkey": 5765, "o_orderdate": "1994-12-15", "o_totalprice": 249900.42d, "sum_quantity": 247 }
+{ "c_name": "Customer#000000082", "c_custkey": 82, "o_orderkey": 3460, "o_orderdate": "1995-10-03", "o_totalprice": 245976.74d, "sum_quantity": 254 }
+{ "c_name": "Customer#000000068", "c_custkey": 68, "o_orderkey": 2208, "o_orderdate": "1995-05-01", "o_totalprice": 245388.06d, "sum_quantity": 256 }
+{ "c_name": "Customer#000000028", "c_custkey": 28, "o_orderkey": 2306, "o_orderdate": "1995-07-26", "o_totalprice": 244704.23d, "sum_quantity": 235 }
+{ "c_name": "Customer#000000146", "c_custkey": 146, "o_orderkey": 5925, "o_orderdate": "1995-11-13", "o_totalprice": 242588.87d, "sum_quantity": 242 }
+{ "c_name": "Customer#000000029", "c_custkey": 29, "o_orderkey": 1121, "o_orderdate": "1997-01-13", "o_totalprice": 241837.88d, "sum_quantity": 242 }
+{ "c_name": "Customer#000000067", "c_custkey": 67, "o_orderkey": 3907, "o_orderdate": "1992-08-19", "o_totalprice": 240457.56d, "sum_quantity": 239 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 5158, "o_orderdate": "1997-01-21", "o_totalprice": 240284.95d, "sum_quantity": 248 }
+{ "c_name": "Customer#000000131", "c_custkey": 131, "o_orderkey": 4484, "o_orderdate": "1996-12-24", "o_totalprice": 237947.61d, "sum_quantity": 243 }
+{ "c_name": "Customer#000000115", "c_custkey": 115, "o_orderkey": 645, "o_orderdate": "1994-12-03", "o_totalprice": 234763.73d, "sum_quantity": 245 }
+{ "c_name": "Customer#000000049", "c_custkey": 49, "o_orderkey": 4294, "o_orderdate": "1992-08-15", "o_totalprice": 232194.74d, "sum_quantity": 225 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 1477, "o_orderdate": "1997-08-24", "o_totalprice": 231831.35d, "sum_quantity": 236 }
+{ "c_name": "Customer#000000044", "c_custkey": 44, "o_orderkey": 4645, "o_orderdate": "1994-09-20", "o_totalprice": 231012.22d, "sum_quantity": 248 }
+{ "c_name": "Customer#000000089", "c_custkey": 89, "o_orderkey": 5957, "o_orderdate": "1993-12-27", "o_totalprice": 230949.45d, "sum_quantity": 242 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 326, "o_orderdate": "1995-06-04", "o_totalprice": 229165.17d, "sum_quantity": 228 }
+{ "c_name": "Customer#000000067", "c_custkey": 67, "o_orderkey": 928, "o_orderdate": "1995-03-02", "o_totalprice": 228136.49d, "sum_quantity": 241 }
+{ "c_name": "Customer#000000079", "c_custkey": 79, "o_orderkey": 3808, "o_orderdate": "1994-04-24", "o_totalprice": 228054.01d, "sum_quantity": 227 }
+{ "c_name": "Customer#000000037", "c_custkey": 37, "o_orderkey": 5317, "o_orderdate": "1994-09-09", "o_totalprice": 228002.51d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000004", "c_custkey": 4, "o_orderkey": 358, "o_orderdate": "1993-09-20", "o_totalprice": 226806.66d, "sum_quantity": 223 }
+{ "c_name": "Customer#000000142", "c_custkey": 142, "o_orderkey": 5699, "o_orderdate": "1992-07-30", "o_totalprice": 226314.91d, "sum_quantity": 240 }
+{ "c_name": "Customer#000000121", "c_custkey": 121, "o_orderkey": 1888, "o_orderdate": "1993-10-31", "o_totalprice": 224724.11d, "sum_quantity": 225 }
+{ "c_name": "Customer#000000094", "c_custkey": 94, "o_orderkey": 2690, "o_orderdate": "1996-03-31", "o_totalprice": 224674.27d, "sum_quantity": 219 }
+{ "c_name": "Customer#000000094", "c_custkey": 94, "o_orderkey": 5413, "o_orderdate": "1997-10-17", "o_totalprice": 224382.57d, "sum_quantity": 212 }
+{ "c_name": "Customer#000000032", "c_custkey": 32, "o_orderkey": 5381, "o_orderdate": "1993-01-29", "o_totalprice": 223995.46d, "sum_quantity": 228 }
+{ "c_name": "Customer#000000145", "c_custkey": 145, "o_orderkey": 518, "o_orderdate": "1998-02-08", "o_totalprice": 223537.09d, "sum_quantity": 214 }
+{ "c_name": "Customer#000000029", "c_custkey": 29, "o_orderkey": 2945, "o_orderdate": "1996-01-03", "o_totalprice": 223507.72d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000007", "c_custkey": 7, "o_orderkey": 3654, "o_orderdate": "1992-06-03", "o_totalprice": 222653.54d, "sum_quantity": 222 }
+{ "c_name": "Customer#000000145", "c_custkey": 145, "o_orderkey": 807, "o_orderdate": "1993-11-24", "o_totalprice": 222392.53d, "sum_quantity": 216 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 3619, "o_orderdate": "1996-11-20", "o_totalprice": 222274.54d, "sum_quantity": 221 }
+{ "c_name": "Customer#000000070", "c_custkey": 70, "o_orderkey": 5472, "o_orderdate": "1993-04-11", "o_totalprice": 221636.83d, "sum_quantity": 217 }
+{ "c_name": "Customer#000000137", "c_custkey": 137, "o_orderkey": 4900, "o_orderdate": "1992-06-30", "o_totalprice": 221320.76d, "sum_quantity": 227 }
+{ "c_name": "Customer#000000106", "c_custkey": 106, "o_orderkey": 3778, "o_orderdate": "1993-05-26", "o_totalprice": 221036.31d, "sum_quantity": 225 }
+{ "c_name": "Customer#000000121", "c_custkey": 121, "o_orderkey": 1153, "o_orderdate": "1996-04-18", "o_totalprice": 220727.97d, "sum_quantity": 209 }
+{ "c_name": "Customer#000000070", "c_custkey": 70, "o_orderkey": 4004, "o_orderdate": "1993-05-07", "o_totalprice": 220715.14d, "sum_quantity": 228 }
+{ "c_name": "Customer#000000098", "c_custkey": 98, "o_orderkey": 768, "o_orderdate": "1996-08-20", "o_totalprice": 220636.82d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 5606, "o_orderdate": "1996-11-12", "o_totalprice": 219959.08d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000055", "c_custkey": 55, "o_orderkey": 484, "o_orderdate": "1997-01-03", "o_totalprice": 219920.62d, "sum_quantity": 224 }
+{ "c_name": "Customer#000000140", "c_custkey": 140, "o_orderkey": 4230, "o_orderdate": "1992-03-04", "o_totalprice": 219709.6d, "sum_quantity": 217 }
+{ "c_name": "Customer#000000082", "c_custkey": 82, "o_orderkey": 39, "o_orderdate": "1996-09-20", "o_totalprice": 219707.84d, "sum_quantity": 231 }
+{ "c_name": "Customer#000000037", "c_custkey": 37, "o_orderkey": 2789, "o_orderdate": "1998-03-14", "o_totalprice": 219123.27d, "sum_quantity": 218 }
+{ "c_name": "Customer#000000017", "c_custkey": 17, "o_orderkey": 3269, "o_orderdate": "1996-03-01", "o_totalprice": 218697.85d, "sum_quantity": 220 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 3590, "o_orderdate": "1995-05-13", "o_totalprice": 218482.7d, "sum_quantity": 210 }
+{ "c_name": "Customer#000000134", "c_custkey": 134, "o_orderkey": 614, "o_orderdate": "1992-12-01", "o_totalprice": 218116.21d, "sum_quantity": 204 }
+{ "c_name": "Customer#000000092", "c_custkey": 92, "o_orderkey": 4197, "o_orderdate": "1996-08-13", "o_totalprice": 217709.03d, "sum_quantity": 225 }
+{ "c_name": "Customer#000000133", "c_custkey": 133, "o_orderkey": 1156, "o_orderdate": "1996-10-19", "o_totalprice": 217682.81d, "sum_quantity": 218 }
+{ "c_name": "Customer#000000046", "c_custkey": 46, "o_orderkey": 453, "o_orderdate": "1997-05-26", "o_totalprice": 216826.73d, "sum_quantity": 226 }
+{ "c_name": "Customer#000000124", "c_custkey": 124, "o_orderkey": 3109, "o_orderdate": "1993-07-24", "o_totalprice": 216104.85d, "sum_quantity": 210 }
+{ "c_name": "Customer#000000043", "c_custkey": 43, "o_orderkey": 4994, "o_orderdate": "1996-06-29", "o_totalprice": 216071.76d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 3713, "o_orderdate": "1998-05-07", "o_totalprice": 215342.63d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000029", "c_custkey": 29, "o_orderkey": 68, "o_orderdate": "1998-04-18", "o_totalprice": 215135.72d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000013", "c_custkey": 13, "o_orderkey": 2438, "o_orderdate": "1993-07-15", "o_totalprice": 214494.39d, "sum_quantity": 210 }
+{ "c_name": "Customer#000000133", "c_custkey": 133, "o_orderkey": 4613, "o_orderdate": "1998-03-05", "o_totalprice": 212339.55d, "sum_quantity": 214 }
+{ "c_name": "Customer#000000106", "c_custkey": 106, "o_orderkey": 1761, "o_orderdate": "1993-12-24", "o_totalprice": 211925.95d, "sum_quantity": 218 }
+{ "c_name": "Customer#000000049", "c_custkey": 49, "o_orderkey": 1248, "o_orderdate": "1992-01-02", "o_totalprice": 210713.88d, "sum_quantity": 207 }
+{ "c_name": "Customer#000000005", "c_custkey": 5, "o_orderkey": 5859, "o_orderdate": "1997-04-23", "o_totalprice": 210643.96d, "sum_quantity": 211 }
+{ "c_name": "Customer#000000106", "c_custkey": 106, "o_orderkey": 1827, "o_orderdate": "1996-06-22", "o_totalprice": 210113.88d, "sum_quantity": 205 }
+{ "c_name": "Customer#000000085", "c_custkey": 85, "o_orderkey": 5184, "o_orderdate": "1998-07-20", "o_totalprice": 209155.48d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000133", "c_custkey": 133, "o_orderkey": 710, "o_orderdate": "1993-01-02", "o_totalprice": 208974.42d, "sum_quantity": 196 }
+{ "c_name": "Customer#000000052", "c_custkey": 52, "o_orderkey": 5186, "o_orderdate": "1996-08-03", "o_totalprice": 208892.63d, "sum_quantity": 210 }
+{ "c_name": "Customer#000000028", "c_custkey": 28, "o_orderkey": 2050, "o_orderdate": "1994-06-02", "o_totalprice": 208517.98d, "sum_quantity": 217 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 2180, "o_orderdate": "1996-09-14", "o_totalprice": 208481.57d, "sum_quantity": 212 }
+{ "c_name": "Customer#000000119", "c_custkey": 119, "o_orderkey": 3588, "o_orderdate": "1995-03-19", "o_totalprice": 207925.83d, "sum_quantity": 212 }
+{ "c_name": "Customer#000000134", "c_custkey": 134, "o_orderkey": 1444, "o_orderdate": "1994-12-06", "o_totalprice": 207907.6d, "sum_quantity": 205 }
+{ "c_name": "Customer#000000103", "c_custkey": 103, "o_orderkey": 742, "o_orderdate": "1994-12-23", "o_totalprice": 207632.55d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000017", "c_custkey": 17, "o_orderkey": 4099, "o_orderdate": "1992-08-21", "o_totalprice": 207364.8d, "sum_quantity": 208 }
+{ "c_name": "Customer#000000109", "c_custkey": 109, "o_orderkey": 1286, "o_orderdate": "1993-05-14", "o_totalprice": 207291.83d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000079", "c_custkey": 79, "o_orderkey": 5633, "o_orderdate": "1998-05-31", "o_totalprice": 207119.83d, "sum_quantity": 203 }
+{ "c_name": "Customer#000000062", "c_custkey": 62, "o_orderkey": 2022, "o_orderdate": "1992-03-15", "o_totalprice": 206742.11d, "sum_quantity": 209 }
+{ "c_name": "Customer#000000022", "c_custkey": 22, "o_orderkey": 4583, "o_orderdate": "1994-09-25", "o_totalprice": 206495.43d, "sum_quantity": 197 }
+{ "c_name": "Customer#000000148", "c_custkey": 148, "o_orderkey": 5185, "o_orderdate": "1997-07-25", "o_totalprice": 206179.68d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000044", "c_custkey": 44, "o_orderkey": 3175, "o_orderdate": "1994-07-15", "o_totalprice": 205282.63d, "sum_quantity": 215 }
+{ "c_name": "Customer#000000056", "c_custkey": 56, "o_orderkey": 2565, "o_orderdate": "1998-02-28", "o_totalprice": 204438.57d, "sum_quantity": 201 }
+{ "c_name": "Customer#000000149", "c_custkey": 149, "o_orderkey": 3747, "o_orderdate": "1996-08-20", "o_totalprice": 204355.65d, "sum_quantity": 195 }
+{ "c_name": "Customer#000000101", "c_custkey": 101, "o_orderkey": 4964, "o_orderdate": "1997-07-28", "o_totalprice": 204163.1d, "sum_quantity": 197 }
+{ "c_name": "Customer#000000062", "c_custkey": 62, "o_orderkey": 4992, "o_orderdate": "1992-05-10", "o_totalprice": 203904.8d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000010", "c_custkey": 10, "o_orderkey": 3751, "o_orderdate": "1994-04-27", "o_totalprice": 202917.72d, "sum_quantity": 204 }
+{ "c_name": "Customer#000000076", "c_custkey": 76, "o_orderkey": 2534, "o_orderdate": "1996-07-17", "o_totalprice": 202784.54d, "sum_quantity": 214 }
+{ "c_name": "Customer#000000001", "c_custkey": 1, "o_orderkey": 164, "o_orderdate": "1992-10-21", "o_totalprice": 202660.52d, "sum_quantity": 213 }
+{ "c_name": "Customer#000000118", "c_custkey": 118, "o_orderkey": 1283, "o_orderdate": "1996-08-30", "o_totalprice": 202623.92d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000010", "c_custkey": 10, "o_orderkey": 1890, "o_orderdate": "1996-12-18", "o_totalprice": 202364.58d, "sum_quantity": 207 }
+{ "c_name": "Customer#000000077", "c_custkey": 77, "o_orderkey": 1762, "o_orderdate": "1994-08-20", "o_totalprice": 202227.17d, "sum_quantity": 216 }
+{ "c_name": "Customer#000000106", "c_custkey": 106, "o_orderkey": 4196, "o_orderdate": "1998-05-15", "o_totalprice": 201455.98d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000064", "c_custkey": 64, "o_orderkey": 5895, "o_orderdate": "1997-01-01", "o_totalprice": 201419.83d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000008", "c_custkey": 8, "o_orderkey": 644, "o_orderdate": "1992-05-01", "o_totalprice": 201268.06d, "sum_quantity": 202 }
+{ "c_name": "Customer#000000047", "c_custkey": 47, "o_orderkey": 261, "o_orderdate": "1993-06-29", "o_totalprice": 201003.12d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000079", "c_custkey": 79, "o_orderkey": 4672, "o_orderdate": "1995-11-07", "o_totalprice": 199593.71d, "sum_quantity": 203 }
+{ "c_name": "Customer#000000131", "c_custkey": 131, "o_orderkey": 930, "o_orderdate": "1994-12-17", "o_totalprice": 199102.23d, "sum_quantity": 204 }
+{ "c_name": "Customer#000000118", "c_custkey": 118, "o_orderkey": 4161, "o_orderdate": "1993-08-21", "o_totalprice": 198995.21d, "sum_quantity": 211 }
+{ "c_name": "Customer#000000073", "c_custkey": 73, "o_orderkey": 4069, "o_orderdate": "1992-05-13", "o_totalprice": 198816.13d, "sum_quantity": 199 }
+{ "c_name": "Customer#000000142", "c_custkey": 142, "o_orderkey": 5696, "o_orderdate": "1995-05-04", "o_totalprice": 198723.3d, "sum_quantity": 198 }
+{ "c_name": "Customer#000000134", "c_custkey": 134, "o_orderkey": 3872, "o_orderdate": "1996-09-06", "o_totalprice": 198538.68d, "sum_quantity": 207 }
+{ "c_name": "Customer#000000127", "c_custkey": 127, "o_orderkey": 1059, "o_orderdate": "1994-02-27", "o_totalprice": 198360.22d, "sum_quantity": 194 }
+{ "c_name": "Customer#000000103", "c_custkey": 103, "o_orderkey": 4293, "o_orderdate": "1996-08-20", "o_totalprice": 198322.91d, "sum_quantity": 202 }
+{ "c_name": "Customer#000000080", "c_custkey": 80, "o_orderkey": 993, "o_orderdate": "1995-09-10", "o_totalprice": 198238.65d, "sum_quantity": 194 }
+{ "c_name": "Customer#000000091", "c_custkey": 91, "o_orderkey": 420, "o_orderdate": "1995-10-31", "o_totalprice": 198039.23d, "sum_quantity": 200 }
+{ "c_name": "Customer#000000092", "c_custkey": 92, "o_orderkey": 3333, "o_orderdate": "1992-09-16", "o_totalprice": 197973.22d, "sum_quantity": 195 }
+{ "c_name": "Customer#000000146", "c_custkey": 146, "o_orderkey": 4192, "o_orderdate": "1998-04-19", "o_totalprice": 197192.95d, "sum_quantity": 209 }
+{ "c_name": "Customer#000000145", "c_custkey": 145, "o_orderkey": 1575, "o_orderdate": "1995-09-13", "o_totalprice": 197031.52d, "sum_quantity": 204 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.1.adm
new file mode 100644
index 0000000..aea671f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.1.adm
@@ -0,0 +1 @@
+51515.7344d
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.1.adm
new file mode 100644
index 0000000..424ab59
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.1.adm
@@ -0,0 +1,10 @@
+{ "s_name": "Supplier#000000001", "s_address": " N kD4on9OM Ipw3,gf0JBoQDd7tgrzrddZ" }
+{ "s_name": "Supplier#000000002", "s_address": "89eJ5ksX3ImxJQBvxObC," }
+{ "s_name": "Supplier#000000003", "s_address": "q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3" }
+{ "s_name": "Supplier#000000004", "s_address": "Bk7ah4CK8SYQTepEmvMkkgMwg" }
+{ "s_name": "Supplier#000000005", "s_address": "Gcdm2rJRzl5qlTVzc" }
+{ "s_name": "Supplier#000000006", "s_address": "tQxuVm7s7CnK" }
+{ "s_name": "Supplier#000000007", "s_address": "s,4TicNGB4uO6PaSqNBUq" }
+{ "s_name": "Supplier#000000008", "s_address": "9Sq4bBH2FQEmaFOocY45sRTxo6yuoG" }
+{ "s_name": "Supplier#000000009", "s_address": "1KhUgZegwM3ua7dsYmekYBsK" }
+{ "s_name": "Supplier#000000010", "s_address": "Saygah3gYWMp72i PY" }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.adm
new file mode 100644
index 0000000..2ae0988
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.1.adm
@@ -0,0 +1,10 @@
+{ "s_name": "Supplier#000000007", "numwait": 431 }
+{ "s_name": "Supplier#000000005", "numwait": 417 }
+{ "s_name": "Supplier#000000001", "numwait": 403 }
+{ "s_name": "Supplier#000000009", "numwait": 373 }
+{ "s_name": "Supplier#000000004", "numwait": 367 }
+{ "s_name": "Supplier#000000002", "numwait": 364 }
+{ "s_name": "Supplier#000000010", "numwait": 358 }
+{ "s_name": "Supplier#000000003", "numwait": 349 }
+{ "s_name": "Supplier#000000008", "numwait": 347 }
+{ "s_name": "Supplier#000000006", "numwait": 343 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.1.adm
new file mode 100644
index 0000000..4f3cd97
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.1.adm
@@ -0,0 +1,23 @@
+{ "cntrycode": "10", "numcust": 3, "totacctbal": 20747.13d }
+{ "cntrycode": "11", "numcust": 5, "totacctbal": 35208.88d }
+{ "cntrycode": "12", "numcust": 2, "totacctbal": 13735.27d }
+{ "cntrycode": "13", "numcust": 2, "totacctbal": 13545.3d }
+{ "cntrycode": "14", "numcust": 1, "totacctbal": 9963.15d }
+{ "cntrycode": "15", "numcust": 2, "totacctbal": 14624.84d }
+{ "cntrycode": "16", "numcust": 2, "totacctbal": 11239.02d }
+{ "cntrycode": "17", "numcust": 1, "totacctbal": 9127.27d }
+{ "cntrycode": "18", "numcust": 3, "totacctbal": 22156.91d }
+{ "cntrycode": "19", "numcust": 6, "totacctbal": 43758.41d }
+{ "cntrycode": "20", "numcust": 3, "totacctbal": 23085.67d }
+{ "cntrycode": "21", "numcust": 3, "totacctbal": 19400.52d }
+{ "cntrycode": "22", "numcust": 3, "totacctbal": 20332.18d }
+{ "cntrycode": "23", "numcust": 3, "totacctbal": 25483.06d }
+{ "cntrycode": "25", "numcust": 3, "totacctbal": 19038.36d }
+{ "cntrycode": "26", "numcust": 5, "totacctbal": 38943.9d }
+{ "cntrycode": "27", "numcust": 2, "totacctbal": 13248.06d }
+{ "cntrycode": "28", "numcust": 5, "totacctbal": 42700.5d }
+{ "cntrycode": "29", "numcust": 4, "totacctbal": 36059.01d }
+{ "cntrycode": "30", "numcust": 2, "totacctbal": 17528.46d }
+{ "cntrycode": "31", "numcust": 3, "totacctbal": 23599.109999999997d }
+{ "cntrycode": "32", "numcust": 4, "totacctbal": 25754.22d }
+{ "cntrycode": "33", "numcust": 3, "totacctbal": 20359.59d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-ASTERIXDB-1127/query-ASTERIXDB-1127.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-ASTERIXDB-1127/query-ASTERIXDB-1127.1.adm
new file mode 100644
index 0000000..6407653
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-ASTERIXDB-1127/query-ASTERIXDB-1127.1.adm
@@ -0,0 +1,8 @@
+{ "l_orderkey": 1637, "revenue": 164224.9253d, "o_orderdate": "1995-02-08", "o_shippriority": 0i32 }
+{ "l_orderkey": 5191, "revenue": 49378.309400000006d, "o_orderdate": "1994-12-11", "o_shippriority": 0i32 }
+{ "l_orderkey": 742, "revenue": 43728.048d, "o_orderdate": "1994-12-23", "o_shippriority": 0i32 }
+{ "l_orderkey": 3492, "revenue": 43716.072400000005d, "o_orderdate": "1994-11-24", "o_shippriority": 0i32 }
+{ "l_orderkey": 2883, "revenue": 36666.9612d, "o_orderdate": "1995-01-23", "o_shippriority": 0i32 }
+{ "l_orderkey": 998, "revenue": 11785.548600000002d, "o_orderdate": "1994-11-26", "o_shippriority": 0i32 }
+{ "l_orderkey": 3430, "revenue": 4726.6775d, "o_orderdate": "1994-12-12", "o_shippriority": 0i32 }
+{ "l_orderkey": 4423, "revenue": 3055.9365d, "o_orderdate": "1995-02-17", "o_shippriority": 0i32 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue562/query-issue562.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue562/query-issue562.1.adm
new file mode 100644
index 0000000..aa7bb6b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue562/query-issue562.1.adm
@@ -0,0 +1,7 @@
+{ "cntrycode": "13", "numcust": 1, "totacctbal": 5679.84d }
+{ "cntrycode": "17", "numcust": 2, "totacctbal": 11309.79d }
+{ "cntrycode": "18", "numcust": 3, "totacctbal": 16076.24d }
+{ "cntrycode": "23", "numcust": 2, "totacctbal": 12652.16d }
+{ "cntrycode": "29", "numcust": 2, "totacctbal": 17195.08d }
+{ "cntrycode": "30", "numcust": 2, "totacctbal": 9662.279999999999d }
+{ "cntrycode": "31", "numcust": 3, "totacctbal": 18470.33d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue601/query-issue601.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue601/query-issue601.1.adm
new file mode 100644
index 0000000..7d83268
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue601/query-issue601.1.adm
@@ -0,0 +1,7 @@
+{ "l_linenumber": 6, "count_order": 432 }
+{ "l_linenumber": 1, "count_order": 1500 }
+{ "l_linenumber": 2, "count_order": 1291 }
+{ "l_linenumber": 4, "count_order": 862 }
+{ "l_linenumber": 3, "count_order": 1077 }
+{ "l_linenumber": 5, "count_order": 632 }
+{ "l_linenumber": 7, "count_order": 211 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue785-2/query-issue785-2.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue785-2/query-issue785-2.1.adm
new file mode 100644
index 0000000..c6a683d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue785-2/query-issue785-2.1.adm
@@ -0,0 +1,10 @@
+{ "nation_key": 21, "sum_price": [ { "orderdate": "1994-02-27", "sum_price": 198360.22d }, { "orderdate": "1992-07-07", "sum_price": 180692.9d }, { "orderdate": "1996-06-28", "sum_price": 139915.23d } ] }
+{ "nation_key": 23, "sum_price": [ { "orderdate": "1993-06-08", "sum_price": 161307.05d }, { "orderdate": "1995-12-07", "sum_price": 153048.74d }, { "orderdate": "1994-08-22", "sum_price": 147071.86d } ] }
+{ "nation_key": 1, "sum_price": [ { "orderdate": "1993-05-26", "sum_price": 221036.31d }, { "orderdate": "1992-03-20", "sum_price": 216230.27000000002d }, { "orderdate": "1993-12-24", "sum_price": 211925.95d } ] }
+{ "nation_key": 2, "sum_price": [ { "orderdate": "1996-03-01", "sum_price": 218697.85d }, { "orderdate": "1996-08-13", "sum_price": 217709.03d }, { "orderdate": "1992-08-21", "sum_price": 207364.8d } ] }
+{ "nation_key": 4, "sum_price": [ { "orderdate": "1993-09-20", "sum_price": 226806.66d }, { "orderdate": "1992-03-04", "sum_price": 219709.6d }, { "orderdate": "1996-01-06", "sum_price": 190490.78d } ] }
+{ "nation_key": 19, "sum_price": [ { "orderdate": "1993-12-29", "sum_price": 328959.87d }, { "orderdate": "1997-08-04", "sum_price": 244636.7d }, { "orderdate": "1996-11-20", "sum_price": 222274.54d } ] }
+{ "nation_key": 20, "sum_price": [ { "orderdate": "1993-01-31", "sum_price": 190960.69d }, { "orderdate": "1998-07-17", "sum_price": 187156.38d }, { "orderdate": "1993-03-25", "sum_price": 167017.39d } ] }
+{ "nation_key": 22, "sum_price": [ { "orderdate": "1998-02-27", "sum_price": 263411.29d }, { "orderdate": "1993-04-11", "sum_price": 221636.83d }, { "orderdate": "1993-05-07", "sum_price": 220715.14d } ] }
+{ "nation_key": 0, "sum_price": [ { "orderdate": "1997-01-13", "sum_price": 241837.88d }, { "orderdate": "1997-01-21", "sum_price": 240284.95d }, { "orderdate": "1997-08-24", "sum_price": 231831.35d } ] }
+{ "nation_key": 3, "sum_price": [ { "orderdate": "1997-04-23", "sum_price": 351762.82999999996d }, { "orderdate": "1995-11-13", "sum_price": 242588.87d }, { "orderdate": "1993-07-15", "sum_price": 214494.39d } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue785/query-issue785.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue785/query-issue785.1.adm
new file mode 100644
index 0000000..216a8f6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue785/query-issue785.1.adm
@@ -0,0 +1,24 @@
+{ "nation_key": 6, "sum_price": [ { "orderdate": "1992-05-28", "sum_price": 335178.33d }, { "orderdate": "1997-05-26", "sum_price": 216826.73d }, { "orderdate": "1996-04-30", "sum_price": 180054.29d } ] }
+{ "nation_key": 11, "sum_price": [ { "orderdate": "1994-12-15", "sum_price": 249900.42d }, { "orderdate": "1996-12-24", "sum_price": 237947.61d }, { "orderdate": "1992-12-01", "sum_price": 218116.21d } ] }
+{ "nation_key": 12, "sum_price": [ { "orderdate": "1995-05-01", "sum_price": 245388.06d }, { "orderdate": "1997-02-17", "sum_price": 225518.72d }, { "orderdate": "1996-08-20", "sum_price": 220636.82d } ] }
+{ "nation_key": 14, "sum_price": [ { "orderdate": "1993-12-27", "sum_price": 230949.45d }, { "orderdate": "1992-04-26", "sum_price": 134333.33d }, { "orderdate": "1997-03-09", "sum_price": 132838.49d } ] }
+{ "nation_key": 21, "sum_price": [ { "orderdate": "1994-02-27", "sum_price": 198360.22d }, { "orderdate": "1992-07-07", "sum_price": 180692.9d }, { "orderdate": "1996-06-28", "sum_price": 139915.23d } ] }
+{ "nation_key": 23, "sum_price": [ { "orderdate": "1993-06-08", "sum_price": 161307.05d }, { "orderdate": "1995-12-07", "sum_price": 153048.74d }, { "orderdate": "1994-08-22", "sum_price": 147071.86d } ] }
+{ "nation_key": 1, "sum_price": [ { "orderdate": "1993-05-26", "sum_price": 221036.31d }, { "orderdate": "1992-03-20", "sum_price": 216230.27000000002d }, { "orderdate": "1993-12-24", "sum_price": 211925.95d } ] }
+{ "nation_key": 2, "sum_price": [ { "orderdate": "1996-03-01", "sum_price": 218697.85d }, { "orderdate": "1996-08-13", "sum_price": 217709.03d }, { "orderdate": "1992-08-21", "sum_price": 207364.8d } ] }
+{ "nation_key": 4, "sum_price": [ { "orderdate": "1993-09-20", "sum_price": 226806.66d }, { "orderdate": "1992-03-04", "sum_price": 219709.6d }, { "orderdate": "1996-01-06", "sum_price": 190490.78d } ] }
+{ "nation_key": 13, "sum_price": [ { "orderdate": "1998-02-08", "sum_price": 223537.09d }, { "orderdate": "1993-11-24", "sum_price": 222392.53d }, { "orderdate": "1995-09-13", "sum_price": 197031.52d } ] }
+{ "nation_key": 15, "sum_price": [ { "orderdate": "1998-05-31", "sum_price": 366291.52d }, { "orderdate": "1994-04-24", "sum_price": 228054.01d }, { "orderdate": "1993-01-29", "sum_price": 223995.46d } ] }
+{ "nation_key": 16, "sum_price": [ { "orderdate": "1994-09-20", "sum_price": 231012.22d }, { "orderdate": "1992-06-30", "sum_price": 221320.76d }, { "orderdate": "1993-05-14", "sum_price": 207291.83d } ] }
+{ "nation_key": 19, "sum_price": [ { "orderdate": "1993-12-29", "sum_price": 328959.87d }, { "orderdate": "1997-08-04", "sum_price": 244636.7d }, { "orderdate": "1996-11-20", "sum_price": 222274.54d } ] }
+{ "nation_key": 20, "sum_price": [ { "orderdate": "1993-01-31", "sum_price": 190960.69d }, { "orderdate": "1998-07-17", "sum_price": 187156.38d }, { "orderdate": "1993-03-25", "sum_price": 167017.39d } ] }
+{ "nation_key": 22, "sum_price": [ { "orderdate": "1998-02-27", "sum_price": 263411.29d }, { "orderdate": "1993-04-11", "sum_price": 221636.83d }, { "orderdate": "1993-05-07", "sum_price": 220715.14d } ] }
+{ "nation_key": 0, "sum_price": [ { "orderdate": "1997-01-13", "sum_price": 241837.88d }, { "orderdate": "1997-01-21", "sum_price": 240284.95d }, { "orderdate": "1997-08-24", "sum_price": 231831.35d } ] }
+{ "nation_key": 8, "sum_price": [ { "orderdate": "1995-07-26", "sum_price": 244704.23d }, { "orderdate": "1994-12-03", "sum_price": 234763.73d }, { "orderdate": "1994-09-09", "sum_price": 228002.51d } ] }
+{ "nation_key": 9, "sum_price": [ { "orderdate": "1992-08-19", "sum_price": 240457.56d }, { "orderdate": "1995-03-02", "sum_price": 228136.49d }, { "orderdate": "1992-07-30", "sum_price": 226314.91d } ] }
+{ "nation_key": 10, "sum_price": [ { "orderdate": "1992-08-15", "sum_price": 232194.74d }, { "orderdate": "1997-01-03", "sum_price": 219920.62d }, { "orderdate": "1992-01-02", "sum_price": 210713.88d } ] }
+{ "nation_key": 3, "sum_price": [ { "orderdate": "1997-04-23", "sum_price": 351762.82999999996d }, { "orderdate": "1995-11-13", "sum_price": 242588.87d }, { "orderdate": "1993-07-15", "sum_price": 214494.39d } ] }
+{ "nation_key": 5, "sum_price": [ { "orderdate": "1997-04-04", "sum_price": 258779.02d }, { "orderdate": "1998-07-20", "sum_price": 209155.48d }, { "orderdate": "1994-04-27", "sum_price": 202917.72d } ] }
+{ "nation_key": 7, "sum_price": [ { "orderdate": "1995-03-19", "sum_price": 207925.83d }, { "orderdate": "1992-03-15", "sum_price": 206742.11d }, { "orderdate": "1992-05-10", "sum_price": 203904.8d } ] }
+{ "nation_key": 17, "sum_price": [ { "orderdate": "1997-07-05", "sum_price": 233874.09d }, { "orderdate": "1993-10-31", "sum_price": 224724.11d }, { "orderdate": "1996-04-18", "sum_price": 220727.97d } ] }
+{ "nation_key": 18, "sum_price": [ { "orderdate": "1995-10-03", "sum_price": 245976.74d }, { "orderdate": "1992-06-03", "sum_price": 233161.66d }, { "orderdate": "1996-09-20", "sum_price": 219707.84d } ] }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue786/query-issue786.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue786/query-issue786.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue786/query-issue786.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue810-2/query-issue810-2.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue810-2/query-issue810-2.1.adm
new file mode 100644
index 0000000..d392ecf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue810-2/query-issue810-2.1.adm
@@ -0,0 +1,4 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "count_cheaps": 680, "total_charges": 3.7101416222424E7d }
+{ "l_returnflag": "N", "l_linestatus": "F", "count_cheaps": 12, "total_charges": 1036450.80228d }
+{ "l_returnflag": "N", "l_linestatus": "O", "count_cheaps": 1345, "total_charges": 7.4498798133073E7d }
+{ "l_returnflag": "R", "l_linestatus": "F", "count_cheaps": 679, "total_charges": 3.616906011219301E7d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue810-3/query-issue810-3.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue810-3/query-issue810-3.1.adm
new file mode 100644
index 0000000..d6dd75d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue810-3/query-issue810-3.1.adm
@@ -0,0 +1,4 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "count_cheaps": 680, "avg_expensive_discounts": 0.025714285714285662d, "sum_disc_prices": 3.5676192097E7d, "total_charges": 3.7101416222424E7d }
+{ "l_returnflag": "N", "l_linestatus": "F", "count_cheaps": 12, "avg_expensive_discounts": 0.024615384615384615d, "sum_disc_prices": 999060.898d, "total_charges": 1036450.80228d }
+{ "l_returnflag": "N", "l_linestatus": "O", "count_cheaps": 1345, "avg_expensive_discounts": 0.024699248120300644d, "sum_disc_prices": 7.165316630340001E7d, "total_charges": 7.4498798133073E7d }
+{ "l_returnflag": "R", "l_linestatus": "F", "count_cheaps": 679, "avg_expensive_discounts": 0.0244601542416452d, "sum_disc_prices": 3.473847287579999E7d, "total_charges": 3.616906011219301E7d }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue810/query-issue810.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue810/query-issue810.1.adm
new file mode 100644
index 0000000..a74e76f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue810/query-issue810.1.adm
@@ -0,0 +1,4 @@
+{ "l_returnflag": "A", "l_linestatus": "F", "count_cheaps": 680, "count_expensives": 798 }
+{ "l_returnflag": "N", "l_linestatus": "F", "count_cheaps": 12, "count_expensives": 26 }
+{ "l_returnflag": "N", "l_linestatus": "O", "count_cheaps": 1345, "count_expensives": 1596 }
+{ "l_returnflag": "R", "l_linestatus": "F", "count_cheaps": 679, "count_expensives": 778 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue827-2/query-issue827-2.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue827-2/query-issue827-2.1.adm
new file mode 100644
index 0000000..1b693a2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue827-2/query-issue827-2.1.adm
@@ -0,0 +1 @@
+{ "sum_qty_partial": 150194.0d, "sum_base_price": 1.5277439838000005E8d, "sum_disc_price": 1.4517182996390012E8d, "sum_charge": 1.51008955587289E8d, "ave_qty": 25.39634764964491d, "ave_price": 25441.198731057462d, "ave_disc": 0.05003164029975036d, "count_order": 6005 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue827/query-issue827.1.adm b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue827/query-issue827.1.adm
new file mode 100644
index 0000000..0a3b71c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch-with-index/query-issue827/query-issue827.1.adm
@@ -0,0 +1 @@
+{ "count_cheaps": 6005, "count_expensives": 1.5277439838000005E8d }
diff --git a/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 985cbcd..2d994df 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -5270,6 +5270,193 @@
             </compilation-unit>
         </test-case>
     </test-group>
+    <test-group name="tpch-with-index">
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="distinct_by">
+                <output-dir compare="Text">distinct_by</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="nest_aggregate">
+                <output-dir compare="Text">nest_aggregate</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="nest_aggregate2">
+                <output-dir compare="Text">nest_aggregate2</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue785">
+                <output-dir compare="Text">query-issue785</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue785-2">
+                <output-dir compare="Text">query-issue785-2</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue786">
+                <output-dir compare="Text">query-issue786</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue601">
+                <output-dir compare="Text">query-issue601</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q10_returned_item">
+                <output-dir compare="Text">q10_returned_item</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q10_returned_item_int64">
+                <output-dir compare="Text">q10_returned_item_int64</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q11_important_stock">
+                <output-dir compare="Text">q11_important_stock</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q12_shipping">
+                <output-dir compare="Text">q12_shipping</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q13_customer_distribution">
+                <output-dir compare="Text">q13_customer_distribution</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q14_promotion_effect">
+                <output-dir compare="Text">q14_promotion_effect</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q15_top_supplier">
+                <output-dir compare="Text">q15_top_supplier</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q16_parts_supplier_relationship">
+                <output-dir compare="Text">q16_parts_supplier_relationship</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q17_squantity_order_revenue">
+                <output-dir compare="Text">q17_small_quantity_order_revenue</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q17_large_gby_variant">
+                <output-dir compare="Text">q17_large_gby_variant</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q18_large_volume_customer">
+                <output-dir compare="Text">q18_large_volume_customer</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q19_discounted_revenue">
+                <output-dir compare="Text">q19_discounted_revenue</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q01_pricing_summary_report_nt">
+                <output-dir compare="Text">q01_pricing_summary_report_nt</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q20_potential_part_promotion">
+                <output-dir compare="Text">q20_potential_part_promotion</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q21_suppliers_who_kept_orders_waiting">
+                <output-dir compare="Text">q21_suppliers_who_kept_orders_waiting</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q22_global_sales_opportunity">
+                <output-dir compare="Text">q22_global_sales_opportunity</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q02_minimum_cost_supplier">
+                <output-dir compare="Text">q02_minimum_cost_supplier</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q03_shipping_priority_nt">
+                <output-dir compare="Text">q03_shipping_priority_nt</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q04_order_priority">
+                <output-dir compare="Text">q04_order_priority</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q05_local_supplier_volume">
+                <output-dir compare="Text">q05_local_supplier_volume</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q06_forecast_revenue_change">
+                <output-dir compare="Text">q06_forecast_revenue_change</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q07_volume_shipping">
+                <output-dir compare="Text">q07_volume_shipping</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q08_national_market_share">
+                <output-dir compare="Text">q08_national_market_share</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="q09_product_type_profit_nt">
+                <output-dir compare="Text">q09_product_type_profit_nt</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue562">
+                <output-dir compare="Text">query-issue562</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue810">
+                <output-dir compare="Text">query-issue810</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue810-2">
+                <output-dir compare="Text">query-issue810-2</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue810-3">
+                <output-dir compare="Text">query-issue810-3</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue827">
+                <output-dir compare="Text">query-issue827</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="tpch-with-index">
+            <compilation-unit name="query-issue827-2">
+                <output-dir compare="Text">query-issue827-2</output-dir>
+            </compilation-unit>
+        </test-case>
+    </test-group>
     <test-group name="tpch-sql-like">
         <test-case FilePath="tpch-sql-like">
             <compilation-unit name="query-issue638">