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/04/05 05:40:44 UTC

[05/10] incubator-asterixdb git commit: Rewrite SQL++ functions.

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
index 3630541..109e5a9 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
@@ -27,11 +27,11 @@ declare function q22_customer_tmp() {
 )
 };
 
-WITH  avg AS avg((
-      SELECT ELEMENT c.c_acctbal
+WITH  avg AS (
+      SELECT ELEMENT AVG(c.c_acctbal)
       FROM  Customer AS c
       WHERE c.c_acctbal > 0.0
-  ))
+  )[0]
 SELECT  cntrycode AS cntrycode, count(ct) AS numcust, tpch.sum(ct.c_acctbal) AS totacctbal
 FROM  q22_customer_tmp() AS ct
 WHERE ct.c_acctbal > avg

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.3.query.sqlpp
index 753b5d3..3c99324 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue562/query-issue562.3.query.sqlpp
@@ -38,7 +38,7 @@ declare function q22_customer_tmp() {
 
 SELECT cntrycode AS cntrycode, count(ct) AS numcust, sum(ct.c_acctbal) AS totacctbal
 FROM  q22_customer_tmp() as ct
-WHERE count((
+WHERE coll_count((
                 SELECT ELEMENT o
                 FROM  Orders AS o
                 WHERE ct.c_custkey = o.o_custkey

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.3.query.sqlpp
index 5fe9965..af3421f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-2/query-issue810-2.3.query.sqlpp
@@ -28,7 +28,7 @@ use tpch;
 
 SELECT l_returnflag AS l_returnflag,
        l_linestatus AS l_linestatus,
-       count(cheaps) AS count_cheaps,
+       coll_count(cheaps) AS count_cheaps,
        total_charges AS total_charges
 FROM  LineItem as l
 WHERE l.l_shipdate <= '1998-09-02'

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.3.query.sqlpp
index db4a46c..dbb9b88 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810-3/query-issue810-3.3.query.sqlpp
@@ -28,8 +28,8 @@ USE tpch;
 
 SELECT  l_returnflag AS l_returnflag,
         l_linestatus AS l_linestatus,
-        count(cheaps) AS count_cheaps,
-        avg(expensives) AS avg_expensive_discounts,
+        coll_count(cheaps) AS count_cheaps,
+        coll_avg(expensives) AS avg_expensive_discounts,
         sum_disc_prices AS sum_disc_prices,
         total_charges AS total_charges
 FROM  LineItem AS l

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.3.query.sqlpp
index 7e5cb54..fc80184 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/query-issue810/query-issue810.3.query.sqlpp
@@ -28,8 +28,8 @@ USE tpch;
 
 SELECT l_returnflag AS l_returnflag,
        l_linestatus AS l_linestatus,
-       count(cheap) AS count_cheaps,
-       count(expensive) AS count_expensives
+       coll_count(cheap) AS count_cheaps,
+       coll_count(expensive) AS count_expensives
 FROM LineItem AS l
 WHERE l.l_shipdate <= '1998-09-02'
 /* +hash */

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate/nest_aggregate.3.query.sqlpp
----------------------------------------------------------------------
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
index 3a015ae..8efcb7f 100644
--- 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
@@ -32,7 +32,7 @@ select element {'nation_key':nation.n_nationkey,'name':nation.n_name,'aggregates
               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((
+        with  sum as tpch.coll_sum((
               select element o.o_totalprice
               from  orders as o
           ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/nest_aggregate2/nest_aggregate2.3.query.sqlpp
----------------------------------------------------------------------
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
index 1aa687c..1b70f0e 100644
--- 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
@@ -32,7 +32,7 @@ select element {'nation_key':nation.n_nationkey,'name':nation.n_name,'aggregates
               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((
+        with  sum as tpch.coll_sum((
               select element o.o_totalprice
               from  orders as o
           ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/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-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
index 94b313f..a971652 100644
--- 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
@@ -22,25 +22,25 @@ use tpch;
 
 set "import-private-functions" "true";
 
-select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'sum_qty':tpch.sum((
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'sum_qty':tpch.coll_sum((
         select element i.l_quantity
         from  l as i
-    )),'sum_base_price':tpch.sum((
+    )),'sum_base_price':tpch.coll_sum((
         select element i.l_extendedprice
         from  l as i
-    )),'sum_disc_price':tpch.sum((
+    )),'sum_disc_price':tpch.coll_sum((
         select element (i.l_extendedprice * (1 - i.l_discount))
         from  l as i
-    )),'sum_charge':tpch.sum((
+    )),'sum_charge':tpch.coll_sum((
         select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
         from  l as i
-    )),'ave_qty':tpch.avg((
+    )),'ave_qty':tpch.coll_avg((
         select element i.l_quantity
         from  l as i
-    )),'ave_price':tpch.avg((
+    )),'ave_price':tpch.coll_avg((
         select element i.l_extendedprice
         from  l as i
-    )),'ave_disc':tpch.avg((
+    )),'ave_disc':tpch.coll_avg((
         select element i.l_discount
         from  l as i
     )),'count_order':tpch.count(l)}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
----------------------------------------------------------------------
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
index a55c74d..499899d 100644
--- 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
@@ -45,7 +45,7 @@ declare function tmp1() {
 };
 declare function tmp2() {
 (
-    select element {'p_partkey':p_partkey,'ps_min_supplycost':tpch.min((
+    select element {'p_partkey':p_partkey,'ps_min_supplycost':tpch.coll_min((
             select element i.ps_supplycost
             from  pssrn as i
         ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
----------------------------------------------------------------------
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
index d30c6d3..bddbb53 100644
--- 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
@@ -27,7 +27,7 @@ from  Customer as c,
 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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  l as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
----------------------------------------------------------------------
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
index 150e4b1..9050001 100644
--- 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
@@ -46,7 +46,7 @@ from  Customer as c,
 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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  o1 as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
----------------------------------------------------------------------
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
index 9dee61f..e1012b1 100644
--- 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
@@ -20,7 +20,7 @@
 use tpch;
 
 
-{'revenue':tpch.sum((
+{'revenue':tpch.coll_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/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
----------------------------------------------------------------------
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
index 74d3b5a..f2838d7 100644
--- 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
@@ -49,7 +49,7 @@ from  (
 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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  locs as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.3.query.sqlpp
----------------------------------------------------------------------
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
index 77d3881..a221b8e 100644
--- 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
@@ -20,10 +20,10 @@
 use tpch;
 
 
-select element {'year':year,'mkt_share':(tpch.sum((
+select element {'year':year,'mkt_share':(tpch.coll_sum((
           select element tpch."switch-case"((i.s_name = 'BRAZIL'),true,i.revenue,false,0.0)
           from  t as i
-      )) / tpch.sum((
+      )) / tpch.coll_sum((
           select element i.revenue
           from  t as i
       )))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/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-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
index b7e5e4b..a76e49e 100644
--- 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
@@ -20,7 +20,7 @@
 use tpch;
 
 
-select element {'nation':nation,'o_year':o_year,'sum_profit':tpch.sum((
+select element {'nation':nation,'o_year':o_year,'sum_profit':tpch.coll_sum((
         select element pr.amount
         from  profit as pr
     ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item/q10_returned_item.3.query.sqlpp
----------------------------------------------------------------------
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
index 50fb6c3..7278f81 100644
--- 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
@@ -34,7 +34,7 @@ from  (
     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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  locn as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
----------------------------------------------------------------------
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
index 50fb6c3..7278f81 100644
--- 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
@@ -34,7 +34,7 @@ from  (
     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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  locn as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q11_important_stock/q11_important_stock.3.query.sqlpp
----------------------------------------------------------------------
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
index ea3bd5a..073835c 100644
--- 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
@@ -20,7 +20,7 @@
 use tpch;
 
 
-with  sum as tpch.sum((
+with  sum as tpch.coll_sum((
       select element (ps.ps_supplycost * ps.ps_availqty)
       from  Partsupp as ps,
             (
@@ -33,7 +33,7 @@ with  sum as tpch.sum((
   ))
 select element {'partkey':t1.ps_partkey,'part_value':t1.part_value}
 from  (
-    select element {'ps_partkey':ps_partkey,'part_value':tpch.sum((
+    select element {'ps_partkey':ps_partkey,'part_value':tpch.coll_sum((
             select element (i.ps_supplycost * i.ps_availqty)
             from  ps as i
         ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.3.query.sqlpp
----------------------------------------------------------------------
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
index 61b685e..2bf33fc 100644
--- 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
@@ -20,10 +20,10 @@
 use tpch;
 
 
-select element {'l_shipmode':l_shipmode,'high_line_count':tpch.sum((
+select element {'l_shipmode':l_shipmode,'high_line_count':tpch.coll_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((
+    )),'low_line_count':tpch.coll_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
     ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
----------------------------------------------------------------------
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
index afa7c9b..d21e1f5 100644
--- 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
@@ -24,12 +24,12 @@ 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 {'c_custkey':c_custkey,'c_count':tpch.coll_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 {'c_custkey':c.c_custkey,'o_orderkey_count':coll_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%')))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
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
index a8f29d3..a376e45 100644
--- 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
@@ -20,10 +20,10 @@
 use tpch;
 
 
-select element (100.0 * tpch.sum((
+select element (100.0 * tpch.coll_sum((
       select element tpch."switch-case"(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
       from  lp as i
-  )) / tpch.sum((
+  )) / tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  lp as i
   )))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q15_top_supplier/q15_top_supplier.3.query.sqlpp
----------------------------------------------------------------------
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
index e21104b..fdc4fcc 100644
--- 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
@@ -22,7 +22,7 @@ use tpch;
 
 declare function revenue() {
 (
-    select element {'supplier_no':l_suppkey,'total_revenue':tpch.sum((
+    select element {'supplier_no':l_suppkey,'total_revenue':tpch.coll_sum((
             select element (i.l_extendedprice * (1 - i.l_discount))
             from  l as i
         ))}
@@ -31,7 +31,7 @@ declare function revenue() {
     group by l.l_suppkey as l_suppkey
 )
 };
-with  m as tpch.max((
+with  m as tpch.coll_max((
       select element r2.total_revenue
       from  tpch.revenue() as r2
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
----------------------------------------------------------------------
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
index cc4d01a..acf3281 100644
--- 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
@@ -41,7 +41,7 @@ from  (
     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((
+with  supplier_cnt as coll_count((
       select element i.ps_suppkey
       from  t2 as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
----------------------------------------------------------------------
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
index ada4f75..2e057d7 100644
--- 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
@@ -20,34 +20,34 @@
 use tpch;
 
 
-select element {'t_partkey':l_partkey,'t_count':tpch.count(l),'t_avg_quantity':(0.2 * tpch.avg((
+select element {'t_partkey':l_partkey,'t_count':tpch.count(l),'t_avg_quantity':(0.2 * tpch.coll_avg((
           select element i.l_quantity
           from  l as i
-      ))),'t_max_suppkey':tpch.max((
+      ))),'t_max_suppkey':tpch.coll_max((
         select element i.l_suppkey
         from  l as i
-    )),'t_max_linenumber':tpch.max((
+    )),'t_max_linenumber':tpch.coll_max((
         select element i.l_linenumber
         from  l as i
-    )),'t_avg_extendedprice':tpch.avg((
+    )),'t_avg_extendedprice':tpch.coll_avg((
         select element i.l_extendedprice
         from  l as i
-    )),'t_avg_discount':tpch.avg((
+    )),'t_avg_discount':tpch.coll_avg((
         select element i.l_discount
         from  l as i
-    )),'t_avg_tax':tpch.avg((
+    )),'t_avg_tax':tpch.coll_avg((
         select element i.l_tax
         from  l as i
-    )),'t_max_shipdate':tpch.max((
+    )),'t_max_shipdate':tpch.coll_max((
         select element i.l_shipdate
         from  l as i
-    )),'t_min_commitdate':tpch.min((
+    )),'t_min_commitdate':tpch.coll_min((
         select element i.l_commitdate
         from  l as i
-    )),'t_min_receiptdate':tpch.min((
+    )),'t_min_receiptdate':tpch.coll_min((
         select element i.l_receiptdate
         from  l as i
-    )),'t_max_comment':tpch.max((
+    )),'t_max_comment':tpch.coll_max((
         select element i.l_comment
         from  l as i
     ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
----------------------------------------------------------------------
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
index 79c397c..ddbbecc 100644
--- 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
@@ -22,7 +22,7 @@ use tpch;
 
 declare function tmp() {
 (
-    select element {'t_partkey':l_partkey,'t_avg_quantity':(0.2 * tpch.avg((
+    select element {'t_partkey':l_partkey,'t_avg_quantity':(0.2 * tpch.coll_avg((
               select element i.l_quantity
               from  l as i
           )))}
@@ -31,7 +31,7 @@ declare function tmp() {
 )
 };
 
-select element (tpch.sum((
+select element (tpch.coll_sum((
       select element l.l_extendedprice
       from  tpch.tmp() as t,
             LineItem as l,

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
----------------------------------------------------------------------
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
index 89ff8f8..e0976a0 100644
--- 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
@@ -20,14 +20,14 @@
 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 {'c_name':c_name,'c_custkey':c_custkey,'o_orderkey':o_orderkey,'o_orderdate':o_orderdate,'o_totalprice':o_totalprice,'sum_quantity':tpch.coll_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 {'l_orderkey':l_orderkey,'t_sum_quantity':tpch.coll_sum((
             select element i.l_quantity
             from  l as i
         ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
----------------------------------------------------------------------
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
index 7065f87..f245189 100644
--- 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
@@ -22,7 +22,7 @@ use tpch;
 
 set "import-private-functions" "true";
 
-select element tpch.sum((
+select element tpch.coll_sum((
     select element (l.l_extendedprice * (1 - l.l_discount))
     from  LineItem as l,
           Part as p

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
----------------------------------------------------------------------
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
index 0657ad3..82e38bf 100644
--- 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
@@ -24,7 +24,7 @@ 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 {'l_partkey':l_partkey,'l_suppkey':l_suppkey,'sum_quantity':(0.5 * tpch.coll_sum((
                   select element i.l_quantity
                   from  l as i
               )))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/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
----------------------------------------------------------------------
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
index f91068d..3ccb9b8 100644
--- 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
@@ -22,10 +22,10 @@ use tpch;
 
 declare function tmp1() {
 (
-    select element {'l_orderkey':l_orderkey,'count_suppkey':tpch.count((
+    select element {'l_orderkey':l_orderkey,'count_suppkey':coll_count((
             select element i.l_suppkey
             from  l2 as i
-        )),'max_suppkey':tpch.max((
+        )),'max_suppkey':tpch.coll_max((
             select element i.l_suppkey
             from  l2 as i
         ))}
@@ -39,10 +39,10 @@ declare function tmp1() {
 };
 declare function tmp2() {
 (
-    select element {'l_orderkey':l_orderkey,'count_suppkey':tpch.count((
+    select element {'l_orderkey':l_orderkey,'count_suppkey':coll_count((
             select element i.l_suppkey
             from  l2 as i
-        )),'max_suppkey':tpch.max((
+        )),'max_suppkey':tpch.coll_max((
             select element i.l_suppkey
             from  l2 as i
         ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
----------------------------------------------------------------------
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
index 6136008..328c753 100644
--- 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
@@ -26,12 +26,12 @@ declare function q22_customer_tmp() {
     from  Customer as c
 )
 };
-with  avg as tpch.avg((
+with  avg as tpch.coll_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 {'cntrycode':cntrycode,'numcust':tpch.count(ct),'totacctbal':tpch.coll_sum((
         select element i.c_acctbal
         from  ct as i
     ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue562/query-issue562.3.query.sqlpp
----------------------------------------------------------------------
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
index ac54a30..eaac9ce 100644
--- 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
@@ -34,18 +34,18 @@ declare function q22_customer_tmp() {
     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((
+with  avg as tpch.coll_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 {'cntrycode':cntrycode,'numcust':tpch.count(ct),'totacctbal':tpch.coll_sum((
         select element i.c_acctbal
         from  ct as i
     ))}
 from  tpch.q22_customer_tmp() as ct
-where (tpch.count((
+where (coll_count((
     select element o
     from  Orders as o
     where (ct.c_custkey = o.o_custkey)

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785-2/query-issue785-2.3.query.sqlpp
----------------------------------------------------------------------
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
index 2cad6ea..de434ef 100644
--- 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
@@ -39,7 +39,7 @@ with  t as (
             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((
+      with  sum as tpch.coll_sum((
             select element o.o_totalprice
             from  orders as o
         ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue785/query-issue785.3.query.sqlpp
----------------------------------------------------------------------
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
index ed649ca..c7761f3 100644
--- 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
@@ -30,7 +30,7 @@ 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((
+        with  sum as tpch.coll_sum((
               select element s.sum_price
               from  i as s
           ))
@@ -38,7 +38,7 @@ select element {'nation_key':nation_key,'sum_price':(
         limit 3
     )}
 from  (
-    select element {'nation_key':nation_key,'order_date':orderdate,'sum_price':tpch.sum((
+    select element {'nation_key':nation_key,'order_date':orderdate,'sum_price':tpch.coll_sum((
             select element o.o_totalprice
             from  orders as o
         ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue786/query-issue786.3.query.sqlpp
----------------------------------------------------------------------
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
index dead643..37e3c92 100644
--- 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
@@ -32,7 +32,7 @@ select element {'nation_key':nation.n_nationkey,'name':nation.n_name,'aggregates
               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((
+        with  sum as tpch.coll_sum((
               select element o.o_totalprice
               from  orders as o
           ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-2/query-issue810-2.3.query.sqlpp
----------------------------------------------------------------------
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
index 16d3fe0..d75ea7b 100644
--- 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
@@ -26,7 +26,7 @@
 use tpch;
 
 
-select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':tpch.count(cheaps),'total_charges':tpch.sum(charges)}
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':coll_count(cheaps),'total_charges':tpch.coll_sum(charges)}
 from  LineItem as l
 where (l.l_shipdate <= '1998-09-02')
 /* +hash */

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810-3/query-issue810-3.3.query.sqlpp
----------------------------------------------------------------------
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
index 576192d..f2656ee 100644
--- 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
@@ -26,7 +26,7 @@
 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)}
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':coll_count(cheaps),'avg_expensive_discounts':tpch.coll_avg(expensives),'sum_disc_prices':tpch.coll_sum(disc_prices),'total_charges':tpch.coll_sum(charges)}
 from  LineItem as l
 where (l.l_shipdate <= '1998-09-02')
 /* +hash */

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue810/query-issue810.3.query.sqlpp
----------------------------------------------------------------------
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
index 01e1654..f4638f2 100644
--- 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
@@ -26,7 +26,7 @@
 use tpch;
 
 
-select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':tpch.count(cheap),'count_expensives':tpch.count(expensive)}
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_cheaps':coll_count(cheap),'count_expensives':coll_count(expensive)}
 from  LineItem as l
 where (l.l_shipdate <= '1998-09-02')
 /* +hash */

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827-2/query-issue827-2.3.query.sqlpp
----------------------------------------------------------------------
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
index 562f78f..aefe8a3 100644
--- 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
@@ -26,30 +26,30 @@
 use tpch;
 
 
-{'sum_qty_partial':tpch.sum((
+{'sum_qty_partial':tpch.coll_sum((
     select element i.l_quantity
     from  LineItem as i
     where (i.l_shipdate <= '1998-09-02')
-)),'sum_base_price':tpch.sum((
+)),'sum_base_price':tpch.coll_sum((
     select element i.l_extendedprice
     from  LineItem as i
-)),'sum_disc_price':tpch.sum((
+)),'sum_disc_price':tpch.coll_sum((
     select element (i.l_extendedprice * (1 - i.l_discount))
     from  LineItem as i
-)),'sum_charge':tpch.sum((
+)),'sum_charge':tpch.coll_sum((
     select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
     from  LineItem as i
-)),'ave_qty':tpch.avg((
+)),'ave_qty':tpch.coll_avg((
     select element i.l_quantity
     from  LineItem as i
     where (i.l_shipdate <= '1998-09-02')
-)),'ave_price':tpch.avg((
+)),'ave_price':tpch.coll_avg((
     select element i.l_extendedprice
     from  LineItem as i
-)),'ave_disc':tpch.avg((
+)),'ave_disc':tpch.coll_avg((
     select element i.l_discount
     from  LineItem as i
-)),'count_order':tpch.count((
+)),'count_order':coll_count((
     select element l
     from  LineItem as l
 ))};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/query-issue827/query-issue827.3.query.sqlpp
----------------------------------------------------------------------
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
index d056bcb..e735107 100644
--- 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
@@ -26,10 +26,10 @@
 use tpch;
 
 
-{'count_cheaps':tpch.count((
+{'count_cheaps':coll_count((
     select element l.l_quantity
     from  LineItem as l
-)),'count_expensives':tpch.sum((
+)),'count_expensives':tpch.coll_sum((
     select element e
     from  (
         select element l.l_extendedprice

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate/nest_aggregate.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate/nest_aggregate.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate/nest_aggregate.3.query.sqlpp
index 3a015ae..8efcb7f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate/nest_aggregate.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate/nest_aggregate.3.query.sqlpp
@@ -32,7 +32,7 @@ select element {'nation_key':nation.n_nationkey,'name':nation.n_name,'aggregates
               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((
+        with  sum as tpch.coll_sum((
               select element o.o_totalprice
               from  orders as o
           ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate2/nest_aggregate2.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate2/nest_aggregate2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate2/nest_aggregate2.3.query.sqlpp
index 1aa687c..1b70f0e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate2/nest_aggregate2.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/nest_aggregate2/nest_aggregate2.3.query.sqlpp
@@ -32,7 +32,7 @@ select element {'nation_key':nation.n_nationkey,'name':nation.n_name,'aggregates
               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((
+        with  sum as tpch.coll_sum((
               select element o.o_totalprice
               from  orders as o
           ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/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/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
index 94b313f..a971652 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
@@ -22,25 +22,25 @@ use tpch;
 
 set "import-private-functions" "true";
 
-select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'sum_qty':tpch.sum((
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'sum_qty':tpch.coll_sum((
         select element i.l_quantity
         from  l as i
-    )),'sum_base_price':tpch.sum((
+    )),'sum_base_price':tpch.coll_sum((
         select element i.l_extendedprice
         from  l as i
-    )),'sum_disc_price':tpch.sum((
+    )),'sum_disc_price':tpch.coll_sum((
         select element (i.l_extendedprice * (1 - i.l_discount))
         from  l as i
-    )),'sum_charge':tpch.sum((
+    )),'sum_charge':tpch.coll_sum((
         select element (i.l_extendedprice * (1 - i.l_discount) * (1 + i.l_tax))
         from  l as i
-    )),'ave_qty':tpch.avg((
+    )),'ave_qty':tpch.coll_avg((
         select element i.l_quantity
         from  l as i
-    )),'ave_price':tpch.avg((
+    )),'ave_price':tpch.coll_avg((
         select element i.l_extendedprice
         from  l as i
-    )),'ave_disc':tpch.avg((
+    )),'ave_disc':tpch.coll_avg((
         select element i.l_discount
         from  l as i
     )),'count_order':tpch.count(l)}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
index a55c74d..499899d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -45,7 +45,7 @@ declare function tmp1() {
 };
 declare function tmp2() {
 (
-    select element {'p_partkey':p_partkey,'ps_min_supplycost':tpch.min((
+    select element {'p_partkey':p_partkey,'ps_min_supplycost':tpch.coll_min((
             select element i.ps_supplycost
             from  pssrn as i
         ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
index d30c6d3..bddbb53 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
@@ -27,7 +27,7 @@ from  Customer as c,
 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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  l as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
index 150e4b1..9050001 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
@@ -46,7 +46,7 @@ from  Customer as c,
 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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  o1 as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
index 9dee61f..94ee1cd 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
@@ -20,8 +20,8 @@
 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))
-))};
+select sum(l.l_extendedprice * l.l_discount) as revenue
+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/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.4.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.4.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.4.query.sqlpp
new file mode 100644
index 0000000..1da2a8a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.4.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;
+
+
+select count(l) as count
+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/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
index 74d3b5a..f2838d7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
@@ -49,7 +49,7 @@ from  (
 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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  locs as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp
index 77d3881..a221b8e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp
@@ -20,10 +20,10 @@
 use tpch;
 
 
-select element {'year':year,'mkt_share':(tpch.sum((
+select element {'year':year,'mkt_share':(tpch.coll_sum((
           select element tpch."switch-case"((i.s_name = 'BRAZIL'),true,i.revenue,false,0.0)
           from  t as i
-      )) / tpch.sum((
+      )) / tpch.coll_sum((
           select element i.revenue
           from  t as i
       )))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/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/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
index b7e5e4b..a76e49e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
@@ -20,7 +20,7 @@
 use tpch;
 
 
-select element {'nation':nation,'o_year':o_year,'sum_profit':tpch.sum((
+select element {'nation':nation,'o_year':o_year,'sum_profit':tpch.coll_sum((
         select element pr.amount
         from  profit as pr
     ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item/q10_returned_item.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item/q10_returned_item.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item/q10_returned_item.3.query.sqlpp
index 50fb6c3..7278f81 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item/q10_returned_item.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item/q10_returned_item.3.query.sqlpp
@@ -34,7 +34,7 @@ from  (
     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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  locn as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
index 50fb6c3..7278f81 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
@@ -34,7 +34,7 @@ from  (
     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((
+with  revenue as tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  locn as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q11_important_stock/q11_important_stock.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q11_important_stock/q11_important_stock.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q11_important_stock/q11_important_stock.3.query.sqlpp
index ea3bd5a..073835c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q11_important_stock/q11_important_stock.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q11_important_stock/q11_important_stock.3.query.sqlpp
@@ -20,7 +20,7 @@
 use tpch;
 
 
-with  sum as tpch.sum((
+with  sum as tpch.coll_sum((
       select element (ps.ps_supplycost * ps.ps_availqty)
       from  Partsupp as ps,
             (
@@ -33,7 +33,7 @@ with  sum as tpch.sum((
   ))
 select element {'partkey':t1.ps_partkey,'part_value':t1.part_value}
 from  (
-    select element {'ps_partkey':ps_partkey,'part_value':tpch.sum((
+    select element {'ps_partkey':ps_partkey,'part_value':tpch.coll_sum((
             select element (i.ps_supplycost * i.ps_availqty)
             from  ps as i
         ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp
index 61b685e..2bf33fc 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp
@@ -20,10 +20,10 @@
 use tpch;
 
 
-select element {'l_shipmode':l_shipmode,'high_line_count':tpch.sum((
+select element {'l_shipmode':l_shipmode,'high_line_count':tpch.coll_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((
+    )),'low_line_count':tpch.coll_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
     ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
index afa7c9b..d21e1f5 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -24,12 +24,12 @@ 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 {'c_custkey':c_custkey,'c_count':tpch.coll_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 {'c_custkey':c.c_custkey,'o_orderkey_count':coll_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%')))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index a8f29d3..a376e45 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -20,10 +20,10 @@
 use tpch;
 
 
-select element (100.0 * tpch.sum((
+select element (100.0 * tpch.coll_sum((
       select element tpch."switch-case"(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
       from  lp as i
-  )) / tpch.sum((
+  )) / tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  lp as i
   )))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q15_top_supplier/q15_top_supplier.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q15_top_supplier/q15_top_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q15_top_supplier/q15_top_supplier.3.query.sqlpp
index e21104b..fdc4fcc 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q15_top_supplier/q15_top_supplier.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q15_top_supplier/q15_top_supplier.3.query.sqlpp
@@ -22,7 +22,7 @@ use tpch;
 
 declare function revenue() {
 (
-    select element {'supplier_no':l_suppkey,'total_revenue':tpch.sum((
+    select element {'supplier_no':l_suppkey,'total_revenue':tpch.coll_sum((
             select element (i.l_extendedprice * (1 - i.l_discount))
             from  l as i
         ))}
@@ -31,7 +31,7 @@ declare function revenue() {
     group by l.l_suppkey as l_suppkey
 )
 };
-with  m as tpch.max((
+with  m as tpch.coll_max((
       select element r2.total_revenue
       from  tpch.revenue() as r2
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
index cc4d01a..acf3281 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
@@ -41,7 +41,7 @@ from  (
     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((
+with  supplier_cnt as coll_count((
       select element i.ps_suppkey
       from  t2 as i
   ))

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
index ada4f75..2e057d7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
@@ -20,34 +20,34 @@
 use tpch;
 
 
-select element {'t_partkey':l_partkey,'t_count':tpch.count(l),'t_avg_quantity':(0.2 * tpch.avg((
+select element {'t_partkey':l_partkey,'t_count':tpch.count(l),'t_avg_quantity':(0.2 * tpch.coll_avg((
           select element i.l_quantity
           from  l as i
-      ))),'t_max_suppkey':tpch.max((
+      ))),'t_max_suppkey':tpch.coll_max((
         select element i.l_suppkey
         from  l as i
-    )),'t_max_linenumber':tpch.max((
+    )),'t_max_linenumber':tpch.coll_max((
         select element i.l_linenumber
         from  l as i
-    )),'t_avg_extendedprice':tpch.avg((
+    )),'t_avg_extendedprice':tpch.coll_avg((
         select element i.l_extendedprice
         from  l as i
-    )),'t_avg_discount':tpch.avg((
+    )),'t_avg_discount':tpch.coll_avg((
         select element i.l_discount
         from  l as i
-    )),'t_avg_tax':tpch.avg((
+    )),'t_avg_tax':tpch.coll_avg((
         select element i.l_tax
         from  l as i
-    )),'t_max_shipdate':tpch.max((
+    )),'t_max_shipdate':tpch.coll_max((
         select element i.l_shipdate
         from  l as i
-    )),'t_min_commitdate':tpch.min((
+    )),'t_min_commitdate':tpch.coll_min((
         select element i.l_commitdate
         from  l as i
-    )),'t_min_receiptdate':tpch.min((
+    )),'t_min_receiptdate':tpch.coll_min((
         select element i.l_receiptdate
         from  l as i
-    )),'t_max_comment':tpch.max((
+    )),'t_max_comment':tpch.coll_max((
         select element i.l_comment
         from  l as i
     ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
index 79c397c..ddbbecc 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
@@ -22,7 +22,7 @@ use tpch;
 
 declare function tmp() {
 (
-    select element {'t_partkey':l_partkey,'t_avg_quantity':(0.2 * tpch.avg((
+    select element {'t_partkey':l_partkey,'t_avg_quantity':(0.2 * tpch.coll_avg((
               select element i.l_quantity
               from  l as i
           )))}
@@ -31,7 +31,7 @@ declare function tmp() {
 )
 };
 
-select element (tpch.sum((
+select element (tpch.coll_sum((
       select element l.l_extendedprice
       from  tpch.tmp() as t,
             LineItem as l,

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
index 89ff8f8..e0976a0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
@@ -20,14 +20,14 @@
 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 {'c_name':c_name,'c_custkey':c_custkey,'o_orderkey':o_orderkey,'o_orderdate':o_orderdate,'o_totalprice':o_totalprice,'sum_quantity':tpch.coll_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 {'l_orderkey':l_orderkey,'t_sum_quantity':tpch.coll_sum((
             select element i.l_quantity
             from  l as i
         ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
index 7065f87..f245189 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
@@ -22,7 +22,7 @@ use tpch;
 
 set "import-private-functions" "true";
 
-select element tpch.sum((
+select element tpch.coll_sum((
     select element (l.l_extendedprice * (1 - l.l_discount))
     from  LineItem as l,
           Part as p

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
index 0657ad3..82e38bf 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
@@ -24,7 +24,7 @@ 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 {'l_partkey':l_partkey,'l_suppkey':l_suppkey,'sum_quantity':(0.5 * tpch.coll_sum((
                   select element i.l_quantity
                   from  l as i
               )))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/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/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp
index f91068d..3ccb9b8 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/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/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp
@@ -22,10 +22,10 @@ use tpch;
 
 declare function tmp1() {
 (
-    select element {'l_orderkey':l_orderkey,'count_suppkey':tpch.count((
+    select element {'l_orderkey':l_orderkey,'count_suppkey':coll_count((
             select element i.l_suppkey
             from  l2 as i
-        )),'max_suppkey':tpch.max((
+        )),'max_suppkey':tpch.coll_max((
             select element i.l_suppkey
             from  l2 as i
         ))}
@@ -39,10 +39,10 @@ declare function tmp1() {
 };
 declare function tmp2() {
 (
-    select element {'l_orderkey':l_orderkey,'count_suppkey':tpch.count((
+    select element {'l_orderkey':l_orderkey,'count_suppkey':coll_count((
             select element i.l_suppkey
             from  l2 as i
-        )),'max_suppkey':tpch.max((
+        )),'max_suppkey':tpch.coll_max((
             select element i.l_suppkey
             from  l2 as i
         ))}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/3dd80ec4/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
index 6136008..328c753 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
@@ -26,12 +26,12 @@ declare function q22_customer_tmp() {
     from  Customer as c
 )
 };
-with  avg as tpch.avg((
+with  avg as tpch.coll_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 {'cntrycode':cntrycode,'numcust':tpch.count(ct),'totacctbal':tpch.coll_sum((
         select element i.c_acctbal
         from  ct as i
     ))}