You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2016/03/28 22:18:58 UTC

[31/51] [partial] incubator-asterixdb git commit: ASTERIXDB-1226: implement SQL++ core group-by semantics and syntatic sugars.

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.3.query.sqlpp
new file mode 100644
index 0000000..2264407
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.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 issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+USE tpch;
+
+
+
+SELECT  nation.n_nationkey AS nation_key,
+        nation.n_name AS name,
+        (
+            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
+            ORDER BY sum(orders.o_totalprice)
+            LIMIT 3
+        ) AS aggregates
+from  Nation as nation,
+      SelectedNation as sn
+where (nation.n_nationkey /*+ indexnl */ = sn.n_nationkey)
+order by nation.n_nationkey
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp
new file mode 100644
index 0000000..8649a3b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.1.ddl.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.2.update.sqlpp
new file mode 100644
index 0000000..ffd9143
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/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 localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
new file mode 100644
index 0000000..c9e742d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+SELECT  l_returnflag AS l_returnflag,
+        l_linestatus AS l_linestatus,
+        sum(l.l_quantity) AS sum_qty,
+        sum(l.l_extendedprice) AS sum_base_price,
+        sum(l.l_extendedprice * (1 - l.l_discount)) AS sum_disc_price,
+        sum(l.l_extendedprice * (1 - l.l_discount) * (1 + l.l_tax)) AS sum_charge,
+        avg(l.l_quantity) AS ave_qty,
+        avg(l.l_extendedprice) AS ave_price,
+        avg(l.l_discount) AS ave_disc,
+        count(l) AS count_order
+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
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * 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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/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 localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
new file mode 100644
index 0000000..636fb04
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -0,0 +1,66 @@
+/*
+ * 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 q2_minimum_cost_supplier_tmp1 AS
+(select
+  s.s_acctbal AS s_acctbal,
+  s.s_name AS s_name,
+  n.n_name AS n_name,
+  p.p_partkey AS p_partkey,
+  ps.ps_supplycost AS ps_supplycost,
+  p.p_mfgr AS p_mfgr,
+  s.s_address AS s_address,
+  s.s_phone AS s_phone,
+  s.s_comment AS s_comment
+FROM
+  Nation n JOIN Region r
+  ON n.n_regionkey = r.r_regionkey and r.r_name = 'EUROPE'
+  JOIN Supplier s
+  ON s.s_nationkey = n.n_nationkey
+  JOIN Partsupp ps
+  ON s.s_suppkey = ps.ps_suppkey
+  JOIN Part p
+  ON p.p_partkey = ps.ps_partkey AND like(p.p_type, '%BRASS')
+),
+q2_minimum_cost_supplier_tmp2 AS
+(SELECT
+  p_partkey AS p_partkey, min(p.ps_supplycost) AS ps_min_supplycost
+ FROM
+  q2_minimum_cost_supplier_tmp1 p
+ GROUP BY p.p_partkey AS p_partkey
+)
+
+SELECT
+  t1.s_acctbal AS s_acctbal,
+  t1.s_name AS s_name,
+  t1.n_name AS n_name,
+  t1.p_partkey AS p_partkey,
+  t1.p_mfgr AS p_mfgr,
+  t1.s_address AS s_address,
+  t1.s_phone AS s_phone,
+  t1.s_comment AS s_comment
+FROM
+  q2_minimum_cost_supplier_tmp1 t1 JOIN q2_minimum_cost_supplier_tmp2 t2
+ON
+  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;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * 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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.2.update.sqlpp
new file mode 100644
index 0000000..07983f0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/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 localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
new file mode 100644
index 0000000..5e65cb7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE tpch;
+
+
+SELECT l_orderkey AS l_orderkey,
+       sum(l.l_extendedprice * (1 - l.l_discount)) AS revenue,
+       o_orderdate AS o_orderdate,
+       o_shippriority AS 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
+ORDER BY revenue DESC,o_orderdate
+LIMIT 10
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.1.ddl.sqlpp
new file mode 100644
index 0000000..907be7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * 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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/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 localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.3.query.sqlpp
new file mode 100644
index 0000000..41b94e0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q04_order_priority/q04_order_priority.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.
+ */
+
+use tpch;
+
+
+WITH tmp AS
+(
+    SELECT DISTINCT l.l_orderkey AS o_orderkey
+    FROM  LineItem AS l
+    WHERE l.l_commitdate < l.l_receiptdate
+)
+
+SELECT o_orderpriority AS order_priority,
+       count(o) AS count
+FROM Orders AS o
+JOIN 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
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * 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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/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 localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
new file mode 100644
index 0000000..7f84ccb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q05_local_supplier_volume/q05_local_supplier_volume.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  n_name AS n_name,
+        sum(o1.l_extendedprice * (1 - o1.l_discount)) AS revenue
+FROM
+  Customer c JOIN
+    ( SELECT l1.n_name AS n_name,
+             l1.l_extendedprice AS l_extendedprice,
+             l1.l_discount AS l_discount,
+             l1.s_nationkey AS s_nationkey,
+             o.o_custkey AS o_custkey
+      FROM Orders o JOIN
+      ( SELECT s1.n_name AS n_name,
+               l.l_extendedprice AS l_extendedprice,
+               l.l_discount AS l_discount,
+               l.l_orderkey AS l_orderkey,
+               s1.s_nationkey AS s_nationkey
+        FROM LineItem l JOIN
+            (   SELECT  n1.n_name AS n_name,
+                        s.s_suppkey AS s_suppkey,
+                        s.s_nationkey AS s_nationkey
+                FROM Supplier s JOIN
+                (   SELECT n.n_name AS n_name, n.n_nationkey AS n_nationkey
+                    FROM Nation n JOIN Region r
+                    ON n.n_regionkey = r.r_regionkey
+                ) n1 ON s.s_nationkey = n1.n_nationkey
+            ) s1
+        ON l.l_suppkey = s1.s_suppkey
+      ) l1 ON l1.l_orderkey = o.o_orderkey AND o.o_orderdate >= '1990-01-01'
+              AND o.o_orderdate < '1995-01-01'
+   ) o1
+ON c.c_nationkey = o1.s_nationkey AND c.c_custkey = o1.o_custkey
+GROUP BY o1.n_name AS n_name
+ORDER BY revenue DESC;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * 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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/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 localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
new file mode 100644
index 0000000..ba4f3e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q06_forecast_revenue_change/q06_forecast_revenue_change.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;
+
+
+{'revenue':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
+      )
+    )
+};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * 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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/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 localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
new file mode 100644
index 0000000..3ba3da8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
@@ -0,0 +1,75 @@
+/*
+ * 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 n1.n_name AS supp_nation,
+           n2.n_name AS cust_nation,
+           n1.n_nationkey AS s_nationkey,
+           n2.n_nationkey AS c_nationkey
+    from  Nation as n1,
+          Nation as n2
+    where n2.n_name = 'GERMANY' or n1.n_name = 'GERMANY'
+)
+}
+
+SELECT supp_nation AS supp_nation,
+       cust_nation AS cust_nation,
+       l_year AS l_year,
+       sum(shipping.volume) AS revenue
+FROM
+  (
+    SELECT
+      t.supp_nation AS supp_nation,
+      t.cust_nation AS cust_nation,
+      "get-year"(l3.l_shipdate) AS l_year,
+      l3.l_extendedprice * (1 - l3.l_discount) AS volume
+    FROM
+      q7_volume_shipping_tmp() AS t JOIN
+        (SELECT l2.l_shipdate AS l_shipdate,
+                l2.l_extendedprice AS l_extendedprice,
+                l2.l_discount AS l_discount,
+                l2.c_nationkey AS c_nationkey,
+                s.s_nationkey AS s_nationkey
+         FROM Supplier s JOIN
+           (SELECT l1.l_shipdate AS l_shipdate,
+                   l1.l_extendedprice AS l_extendedprice,
+                   l1.l_discount AS l_discount,
+                   l1.l_suppkey AS l_suppkey,
+                   c.c_nationkey AS c_nationkey
+            FROM Customer c JOIN
+              (SELECT l.l_shipdate AS l_shipdate,
+                      l.l_extendedprice AS l_extendedprice,
+                      l.l_discount AS l_discount,
+                      l.l_suppkey AS l_suppkey,
+                      o.o_custkey AS o_custkey
+               FROM Orders o JOIN LineItem l
+               ON o.o_orderkey = l.l_orderkey AND l.l_shipdate >= '1992-01-01'
+                  AND l.l_shipdate <= '1996-12-31'
+               ) l1 ON c.c_custkey = l1.o_custkey
+            ) l2 ON s.s_suppkey = l2.l_suppkey
+         ) l3 ON l3.c_nationkey = t.c_nationkey AND l3.s_nationkey = t.s_nationkey
+   ) shipping
+GROUP BY shipping.supp_nation AS supp_nation,
+         shipping.cust_nation AS cust_nation,
+         shipping.l_year AS l_year
+ORDER BY supp_nation, cust_nation, l_year;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * 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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/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 localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp
new file mode 100644
index 0000000..2d48b57
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp
@@ -0,0 +1,78 @@
+/*
+ * 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  year AS year,
+        sum( "switch-case"(t.s_name = 'BRAZIL', true, t.revenue, false, 0.0) )
+        / sum(t.revenue) AS mkt_share
+FROM  (
+        SELECT o_year AS year,
+               (slnrcop.l_extendedprice * (1 - slnrcop.l_discount)) AS revenue,
+               n2.n_name AS s_name
+        FROM  (
+                SELECT lnrcop.o_orderdate AS o_orderdate,
+                       lnrcop.l_discount AS l_discount,
+                       lnrcop.l_extendedprice AS l_extendedprice,
+                       lnrcop.l_suppkey AS l_suppkey,
+                       s.s_nationkey AS s_nationkey
+                FROM  Supplier AS s,
+                (
+                  SELECT lnrco.o_orderdate AS o_orderdate,
+                         lnrco.l_discount AS l_discount,
+                         lnrco.l_extendedprice AS l_extendedprice,
+                         lnrco.l_suppkey AS l_suppkey
+                  FROM  (
+                         SELECT nrco.o_orderdate AS o_orderdate,
+                                l.l_partkey AS l_partkey,
+                                l.l_discount AS l_discount,
+                                l.l_extendedprice AS l_extendedprice,
+                                l.l_suppkey AS l_suppkey
+                         FROM  LineItem AS l,
+                               (
+                                SELECT o.o_orderdate AS o_orderdate, o.o_orderkey AS o_orderkey
+                                FROM  Orders AS o,
+                                      (
+                                        SELECT c.c_custkey AS c_custkey
+                                        FROM  Customer AS c,
+                                              (
+                                                SELECT n1.n_nationkey AS 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
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * 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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.2.update.sqlpp
new file mode 100644
index 0000000..97a0b31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/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 localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Part using localfs (("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Partsupp using localfs (("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
new file mode 100644
index 0000000..2ede3c0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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 nation AS nation, o_year AS o_year, sum(profit.amount) AS sum_profit
+FROM
+  (
+    SELECT   l3.n_name AS nation,
+             "get-year"(o.o_orderdate) AS o_year,
+             l3.l_extendedprice * (1 - l3.l_discount) -  l3.ps_supplycost * l3.l_quantity AS amount
+    FROM
+      Orders o JOIN
+      (
+       SELECT l2.l_extendedprice AS l_extendedprice,
+              l2.l_discount AS l_discount,
+              l2.l_quantity AS l_quantity,
+              l2.l_orderkey AS l_orderkey,
+              l2.n_name AS n_name,
+              l2.ps_supplycost AS ps_supplycost
+       FROM Part p JOIN
+         (SELECT l1.l_extendedprice AS l_extendedprice,
+                 l1.l_discount AS l_discount,
+                 l1.l_quantity AS l_quantity,
+                 l1.l_partkey AS l_partkey,
+                 l1.l_orderkey AS l_orderkey,
+                 l1.n_name AS n_name,
+                 ps.ps_supplycost AS ps_supplycost
+          FROM Partsupp ps join
+            (SELECT l.l_suppkey AS l_suppkey,
+                    l.l_extendedprice AS l_extendedprice,
+                    l.l_discount AS l_discount,
+                    l.l_quantity AS l_quantity,
+                    l.l_partkey AS l_partkey,
+                    l.l_orderkey AS l_orderkey,
+                    s1.n_name AS n_name
+             FROM
+               (SELECT s.s_suppkey AS s_suppkey, n.n_name AS n_name
+                FROM Nation n join Supplier s on n.n_nationkey = s.s_nationkey
+               ) s1 JOIN LineItem l ON s1.s_suppkey = l.l_suppkey
+            ) l1 ON ((ps.ps_suppkey = l1.l_suppkey) and (ps.ps_partkey = l1.l_partkey))
+         ) l2 ON contains(p.p_name,'green') AND p.p_partkey = l2.l_partkey
+     ) l3 ON o.o_orderkey = l3.l_orderkey
+  ) profit
+GROUP BY profit.nation AS nation, profit.o_year AS o_year
+ORDER BY nation, o_year desc;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.1.ddl.sqlpp
new file mode 100644
index 0000000..176cdc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q10_returned_item/q10_returned_item.1.ddl.sqlpp
@@ -0,0 +1,134 @@
+/*
+ * 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;
+