Rewrite SQL++ functions.

-Maps SQL function names to internal names.
-Allows SQL++ builtin functions to be case-insensitive.
-Rewrites SQL-92 global aggregates.
-Refactors SQL++ AST visitors.
-Cleans up semantics of COLL_AGG and SQL-92 AGG.

Change-Id: Idb5a7c6780669b27065b0928bec7e4700cfb53a9
Reviewed-on: https://asterix-gerrit.ics.uci.edu/759
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
index d6cf231..7f7fbb4 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
@@ -174,6 +174,7 @@
                         + "org.apache.asterix.lang.common.rewrites.LangRewritingContext)",
                 declaredFunctions, topExpr, metadataProvider, context);
         PA.invokeMethod(rewriter, "inlineColumnAlias()");
+        PA.invokeMethod(rewriter, "rewriteGlobalAggregations()");
         PA.invokeMethod(rewriter, "rewriteGroupBys()");
         PA.invokeMethod(rewriter, "variableCheckAndRewrite(boolean)", Boolean.TRUE);
     }
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/count-tweets.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/count-tweets.sqlpp
index a2ddf4b..0bea252 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/count-tweets.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/count-tweets.sqlpp
@@ -35,7 +35,7 @@
 create external  table TwitterData(Tweet) using localfs(("path"="asterix_nc1://data/twitter/smalltweets.txt"),("format"="adm"));
 
 write output to asterix_nc1:"/tmp/count-tweets.adm"
-select element {'word':tok,'count':twitter.count(token)}
+select element {'word':tok,'count':count(token)}
 from  TwitterData as t,
       tokens as token
 with  tokens as twitter."word-tokens"(t.text)
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/denorm-cust-order.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/denorm-cust-order.sqlpp
index b5fc4ea..d8e2b7a 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/denorm-cust-order.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/denorm-cust-order.sqlpp
@@ -53,7 +53,7 @@
   total : float
 }
 
-create  nodegroup group1 if not exists  on 
+create  nodegroup group1 if not exists  on
     asterix_nc1,
     asterix_nc2
 ;
@@ -62,7 +62,7 @@
 create  table Orders(OrderType) primary key oid on group1;
 
 write output to asterix_nc1:"/tmp/custorder.adm"
-select element {'cid':cid,'cust':cust,'cnt-orders':custorder.count(o),'orders':o}
+select element {'cid':cid,'cust':cust,'cnt-orders':count(o),'orders':o}
 from  Customers as c,
       Orders as o
 where (c.cid = o.cid)
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/distinct_aggregate.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/distinct_aggregate.sqlpp
index 877bb0f..6b95c9c 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/distinct_aggregate.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/distinct_aggregate.sqlpp
@@ -43,14 +43,14 @@
   l_comment : string
 }
 
-create  nodegroup group1 if not exists  on 
+create  nodegroup group1 if not exists  on
     asterix_nc1,
     asterix_nc2
 ;
 create  table LineItems_q1(LineItemType) primary key l_orderkey,l_linenumber on group1;
 
 write output to asterix_nc1:"rttest/tpch_q1_pricing_summary_report_nt.adm"
-select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_suppkey':tpch.count(g)}
+select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'count_suppkey':count(g)}
 from  (
     select element {'l_returnflag':l_returnflag,'l_linestatus':l_linestatus,'l_suppkey':l_suppkey}
     from  LineItems_q1 as l
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase1.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase1.sqlpp
index 4e274e5..f1d5086 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase1.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase1.sqlpp
@@ -56,7 +56,7 @@
           from  Users as user,
                 user.lottery_numbers as lottery_number
           group by lottery_number as item
-          with  count as rares03.count(user)
+          with  count as count(user)
           order by count desc
       ) as token at i
       where (lottery_number = token)
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase2-with-hints.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase2-with-hints.sqlpp
index 7850337..c82f62c 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase2-with-hints.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/fj-phase2-with-hints.sqlpp
@@ -51,7 +51,7 @@
                 fuzzyjoin_078."counthashed-word-tokens"(paper.title) as token
           /* +hash */
           group by token as tokenGroupped
-          order by fuzzyjoin_078.count(paper),tokenGroupped
+          order by count(paper),tokenGroupped
       ) as tokenRanked at i
       where (token = tokenRanked)
       order by i
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inlined_q18_large_volume_customer.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inlined_q18_large_volume_customer.sqlpp
index 10bf154..91680fe 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inlined_q18_large_volume_customer.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/inlined_q18_large_volume_customer.sqlpp
@@ -79,14 +79,14 @@
 create  table Customers(CustomerType) primary key c_custkey on group1;
 
 write output to asterix_nc1:"/tmp/inlined_q18_large_volume_customer.adm"
-select element {'c_name':c_name,'c_custkey':c_custkey,'o_orderkey':o_orderkey,'o_orderdate':o_orderdate,'o_totalprice':o_totalprice,'sum_quantity':inlined_q18_large_volume_customer.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':inlined_q18_large_volume_customer.coll_sum((
         select element j.l_quantity
         from  l as j
     ))}
 from  Customers as c,
       Orders as o,
       (
-    select element {'l_orderkey':l_orderkey,'t_sum_quantity':inlined_q18_large_volume_customer.sum((
+    select element {'l_orderkey':l_orderkey,'t_sum_quantity':inlined_q18_large_volume_customer.coll_sum((
             select element i.l_quantity
             from  l as i
         ))}
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nest_aggregate.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nest_aggregate.sqlpp
index 2b67f09..80fb9bc 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nest_aggregate.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/nest_aggregate.sqlpp
@@ -124,7 +124,7 @@
               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
           ))
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-aggreg.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-aggreg.sqlpp
index 4a6203a..c216c66 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-aggreg.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/orders-aggreg.sqlpp
@@ -33,17 +33,17 @@
   total : float
 }
 
-create  nodegroup group1 if not exists  on 
+create  nodegroup group1 if not exists  on
     asterix_nc1,
     asterix_nc2
 ;
 create  table Orders(OrderType) primary key oid on group1;
 
 write output to asterix_nc1:"/tmp/orders-aggreg.adm"
-select element {'cid':cid,'ordpercust':"orders-aggreg".count(o),'totalcust':"orders-aggreg".sum((
+select element {'cid':cid,'ordpercust':"orders-aggreg".coll_count(o),'totalcust':"orders-aggreg".coll_sum((
         select element i.total
         from  o as i
-    )),'avgcust':"orders-aggreg".avg((
+    )),'avgcust':"orders-aggreg".coll_avg((
         select element i.total
         from  o as i
     ))}
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q01_pricing_summary_report_nt.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q01_pricing_summary_report_nt.sqlpp
index c6c79b9..9642265 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q01_pricing_summary_report_nt.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q01_pricing_summary_report_nt.sqlpp
@@ -48,28 +48,28 @@
 load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
 
 write output to asterix_nc1:"rttest/tpch_q1_pricing_summary_report_nt.adm"
-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)}
+    )),'count_order':tpch.coll_count(l)}
 from  LineItem as l
 where (l.l_shipdate <= '1998-09-02')
 /* +hash */
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q03_shipping_priority.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q03_shipping_priority.sqlpp
index 7c05feb..6980bdd 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q03_shipping_priority.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q03_shipping_priority.sqlpp
@@ -86,7 +86,7 @@
 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 q3_shipping_priority.sum((
+with  revenue as q3_shipping_priority.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  l as i
   ))
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q05_local_supplier_volume.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q05_local_supplier_volume.sqlpp
index 58093e0..df9b375 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q05_local_supplier_volume.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q05_local_supplier_volume.sqlpp
@@ -137,7 +137,7 @@
 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 q5_local_supplier.sum((
+with  revenue as q5_local_supplier.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  o1 as i
   ))
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q2.sqlpp
index 74a8f59..5472ad0 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q2.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/q2.sqlpp
@@ -62,9 +62,9 @@
       event.sponsoring_sigs as sponsor
 with  es as {'event':event,'sponsor':sponsor}
 group by sponsor.sig_name as sig_name
-with  sig_sponsorship_count as events.count(es),
+with  sig_sponsorship_count as count(es),
       by_chapter as (
-      select element {'chapter_name':chapter_name,'escount':events.count(e)}
+      select element {'chapter_name':chapter_name,'escount':count(e)}
       from  es as e
       group by e.sponsor.chapter_name as chapter_name
   )
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue562.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue562.sqlpp
index 5fb9440..c87d0d0 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue562.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue562.sqlpp
@@ -86,18 +86,18 @@
     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.coll_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 (tpch.coll_count((
     select element o
     from  Orders as o
     where (ct.c_custkey = o.o_custkey)
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue601.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue601.sqlpp
index 5f60eb0..1c68428 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue601.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue601.sqlpp
@@ -51,7 +51,7 @@
 
 create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
 
-select element {'l_linenumber':l_linenumber,'count_order':tpch.count(l)}
+select element {'l_linenumber':l_linenumber,'count_order':count(l)}
 from  LineItem as l
 group by l.l_linenumber as l_linenumber
 ;
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue697.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue697.sqlpp
index 5d23126..813109a 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue697.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue697.sqlpp
@@ -37,7 +37,7 @@
 
 create  table test(TestType) primary key key1;
 
-select element {'gid':aid,'avg':test.avg((
+select element {'gid':aid,'avg':test.coll_avg((
         select element j."value"
         from  i as j
         where test.not(test."is-null"(j."value"))
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue785.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue785.sqlpp
index aecafb4..09bd754 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue785.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue785.sqlpp
@@ -105,7 +105,7 @@
             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
         ))
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810-2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810-2.sqlpp
index b2e4121..16655ff 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810-2.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810-2.sqlpp
@@ -51,7 +51,7 @@
 
 create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
 
-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':tpch.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 */
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810.sqlpp
index da41e12..50760dc 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue810.sqlpp
@@ -51,7 +51,7 @@
 
 create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
 
-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':tpch.coll_count(cheap),'count_expensives':tpch.coll_count(expensive)}
 from  LineItem as l
 where (l.l_shipdate <= '1998-09-02')
 /* +hash */
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue827-2.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue827-2.sqlpp
index c5ad063..f7c8ddf 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue827-2.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/query-issue827-2.sqlpp
@@ -51,30 +51,30 @@
 
 create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
 
-{'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':tpch.coll_count((
     select element l
     from  LineItem as l
 ))};
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization-above-join.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization-above-join.sqlpp
index 07ccedc..94bcbf1 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization-above-join.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization-above-join.sqlpp
@@ -54,7 +54,7 @@
               from  DBLP as paper,
                     fuzzyjoin."counthashed-word-tokens"(paper.title) as token
               group by token as tokenGroupped
-              order by fuzzyjoin.count(paper),tokenGroupped
+              order by count(paper),tokenGroupped
           ) as tokenRanked at i
           where (tokenUnranked = tokenRanked)
           order by i
@@ -68,7 +68,7 @@
               from  DBLP as paper,
                     fuzzyjoin."counthashed-word-tokens"(paper.title) as token
               group by token as tokenGroupped
-              order by fuzzyjoin.count(paper),tokenGroupped
+              order by count(paper),tokenGroupped
           ) as tokenRanked at i
           where (tokenUnranked = tokenRanked)
           order by i
diff --git a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization.sqlpp b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization.sqlpp
index 9f9d609..0cd244c 100644
--- a/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization.sqlpp
+++ b/asterix-app/src/test/resources/optimizerts/queries_sqlpp/split-materialization.sqlpp
@@ -45,12 +45,12 @@
 with  lonelyusers as (
       select element d
       from  FacebookUsers as d
-      where (TinySocial.count(d."friend-ids") < 2)
+      where (TinySocial.coll_count(d."friend-ids") < 2)
   ),
       lonelyusers2 as (
       select element d
       from  FacebookUsers as d
-      where (TinySocial.count(d."friend-ids") < 2)
+      where (TinySocial.coll_count(d."friend-ids") < 2)
   )
 select element {'user1':{'id':l1.id,'name':l1.name},'user2':{'id':l2.id,'name':l2.name}}
 from  lonelyusers as l1,
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null/agg_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null/agg_null.3.query.sqlpp
index 4529b3c..68c00f0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null/agg_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null/agg_null.3.query.sqlpp
@@ -22,4 +22,4 @@
 * Date         : Feb 7th 2014
 */
 
-{'sql-count1':"sql-count"([null]),'average1':"sql-avg"([null]),'sql-sum1':"sql-sum"([null]),'sql-min1':"sql-min"([null]),'sql-max1':"sql-max"([null]),'sql-count2':"sql-count"({{null,null}}),'average2':"sql-avg"({{null,null}}),'sql-sum2':"sql-sum"({{null,null}}),'sql-min2':"sql-min"({{null,null}}),'sql-max2':"sql-max"({{null,null}})};
+{'sql-count1':"coll_sql-count"([null]),'average1':"coll_sql-avg"([null]),'sql-sum1':"coll_sql-sum"([null]),'sql-min1':"coll_sql-min"([null]),'sql-max1':"coll_sql-max"([null]),'sql-count2':"coll_sql-count"({{null,null}}),'average2':"coll_sql-avg"({{null,null}}),'sql-sum2':"coll_sql-sum"({{null,null}}),'sql-min2':"coll_sql-min"({{null,null}}),'sql-max2':"coll_sql-max"({{null,null}})};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null_rec/agg_null_rec.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null_rec/agg_null_rec.3.query.sqlpp
index f720a2c..83037b7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null_rec/agg_null_rec.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null_rec/agg_null_rec.3.query.sqlpp
@@ -25,19 +25,19 @@
 use test;
 
 
-{'sql-count':test."sql-count"((
+{'sql-count':test."coll_sql-count"((
     select element t.valplus
     from  Test as t
-)),'average':test."sql-avg"((
+)),'average':test."coll_sql-avg"((
     select element t.valplus
     from  Test as t
-)),'sql-sum':test."sql-sum"((
+)),'sql-sum':test."coll_sql-sum"((
     select element t.valplus
     from  Test as t
-)),'sql-min':test."sql-min"((
+)),'sql-min':test."coll_sql-min"((
     select element t.valplus
     from  Test as t
-)),'sql-max':test."sql-max"((
+)),'sql-max':test."coll_sql-max"((
     select element t.valplus
     from  Test as t
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
index bec4d87..0f32271 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
@@ -25,28 +25,28 @@
 use test;
 
 
-{'sql-count':test."sql-count"((
+{'sql-count':test."coll_sql-count"((
     select element t
     from  Test as t
-)),'average':test."sql-avg"((
+)),'average':test."coll_sql-avg"((
     select element i.val
     from  (
         select element t
         from  Test as t
     ) as i
-)),'sql-sum':test."sql-sum"((
+)),'sql-sum':test."coll_sql-sum"((
     select element i.val
     from  (
         select element t
         from  Test as t
     ) as i
-)),'sql-min':test."sql-min"((
+)),'sql-min':test."coll_sql-min"((
     select element i.valplus
     from  (
         select element t
         from  Test as t
     ) as i
-)),'sql-max':test."sql-max"((
+)),'sql-max':test."coll_sql-max"((
     select element i.valplus
     from  (
         select element t
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_number/agg_number.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_number/agg_number.3.query.sqlpp
index dc464a5..4f13bd4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_number/agg_number.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_number/agg_number.3.query.sqlpp
@@ -22,4 +22,4 @@
 * Date         : Feb 7th 2014
 */
 
-{'sql-count1':"sql-count"([float('2.0'),double('3.0'),93847382783847382,1]),'average1':"sql-avg"([float('2.0'),double('3.0'),93847382783847382,1]),'sql-sum1':"sql-sum"([float('2.0'),double('3.0'),93847382783847382,1]),'sql-min1':"sql-min"([float('2.0'),double('3.0'),93847382783847382,1]),'sql-max1':"sql-max"([float('2.0'),double('3.0'),93847382783847382,1]),'sql-count2':"sql-count"({{float('2.0'),double('3.0'),93847382783847382,1}}),'average2':"sql-avg"({{float('2.0'),double('3.0'),93847382783847382,1}}),'sql-sum2':"sql-sum"({{float('2.0'),double('3.0'),93847382783847382,1}}),'sql-min2':"sql-min"({{float('2.0'),double('3.0'),93847382783847382,1}}),'sql-max2':"sql-max"({{float('2.0'),double('3.0'),93847382783847382,1}})};
+{'sql-count1':"coll_sql-count"([float('2.0'),double('3.0'),93847382783847382,1]),'average1':"coll_sql-avg"([float('2.0'),double('3.0'),93847382783847382,1]),'sql-sum1':"coll_sql-sum"([float('2.0'),double('3.0'),93847382783847382,1]),'sql-min1':"coll_sql-min"([float('2.0'),double('3.0'),93847382783847382,1]),'sql-max1':"coll_sql-max"([float('2.0'),double('3.0'),93847382783847382,1]),'sql-count2':"coll_sql-count"({{float('2.0'),double('3.0'),93847382783847382,1}}),'average2':"coll_sql-avg"({{float('2.0'),double('3.0'),93847382783847382,1}}),'sql-sum2':"coll_sql-sum"({{float('2.0'),double('3.0'),93847382783847382,1}}),'sql-min2':"coll_sql-min"({{float('2.0'),double('3.0'),93847382783847382,1}}),'sql-max2':"coll_sql-max"({{float('2.0'),double('3.0'),93847382783847382,1}})};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_number_rec/agg_number_rec.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_number_rec/agg_number_rec.3.query.sqlpp
index f57bba5..e93edc6 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_number_rec/agg_number_rec.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/agg_number_rec/agg_number_rec.3.query.sqlpp
@@ -25,19 +25,19 @@
 use test;
 
 
-{'sql-count':test."sql-count"((
+{'sql-count':test."coll_sql-count"((
     select element t.valplus
     from  Test as t
-)),'average':test."sql-avg"((
+)),'average':test."coll_sql-avg"((
     select element t.valplus
     from  Test as t
-)),'sql-sum':test."sql-sum"((
+)),'sql-sum':test."coll_sql-sum"((
     select element t.valplus
     from  Test as t
-)),'sql-min':test."sql-min"((
+)),'sql-min':test."coll_sql-min"((
     select element t.valplus
     from  Test as t
-)),'sql-max':test."sql-max"((
+)),'sql-max':test."coll_sql-max"((
     select element t.valplus
     from  Test as t
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.3.query.sqlpp
index f6db917..0971e7d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-select element "sql-avg"((
+select element "coll_sql-avg"((
     select element x
     from  [1.0,2.0,double('3.0')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.query.sqlpp
index 9f70bcb..192c5c4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test."sql-avg"((
+{'average':test."coll_sql-avg"((
     select element x.doubleField
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ddl.sqlpp
index a71e263..dd878f9 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-avg aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-avg aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.update.sqlpp
index ddc1233..d5b1944 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-avg aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-avg aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.query.sqlpp
index 47e1388..104ce93 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-avg aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-avg aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-avg"((
+select element test."coll_sql-avg"((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.1.ddl.sqlpp
index 360c6db..345dc40 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-avg aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-avg aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.2.update.sqlpp
index c0377fb..ca013ae 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-avg aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-avg aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.query.sqlpp
index 2163d70..e8a4500 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-avg aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-avg aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-avg"((
+select element test."coll_sql-avg"((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.3.query.sqlpp
index 211efca..fd5e040 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-avg"((
+select element test."coll_sql-avg"((
     select element x
     from  [test.float('1'),test.float('2'),test.float('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.query.sqlpp
index e2005b5..ad9089c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test."sql-avg"((
+{'average':test."coll_sql-avg"((
     select element x.floatField
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.3.query.sqlpp
index 36ee77a..0733772 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-avg"((
+select element test."coll_sql-avg"((
     select element x
     from  [test.int16('1'),test.int16('2'),test.int16('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.query.sqlpp
index 727455a..b3f76ed 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test."sql-avg"((
+{'average':test."coll_sql-avg"((
     select element x.int16Field
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.3.query.sqlpp
index f7837ea..cb91b1f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-avg"((
+select element test."coll_sql-avg"((
     select element x
     from  [test.int32('1'),test.int32('2'),test.int32('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.query.sqlpp
index 41faea7..90a8437 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test."sql-avg"((
+{'average':test."coll_sql-avg"((
     select element x.int32Field
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.3.query.sqlpp
index 6694f52..0fb0b98 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-avg"((
+select element test."coll_sql-avg"((
     select element x
     from  [test.int64('1'),test.int64('2'),test.int64('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.query.sqlpp
index bc44cba..fd4902c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test."sql-avg"((
+{'average':test."coll_sql-avg"((
     select element x.int64Field
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.3.query.sqlpp
index 7acc346..10e04d4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-avg"((
+select element test."coll_sql-avg"((
     select element x
     from  [test.int8('1'),test.int8('2'),test.int8('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.query.sqlpp
index 89f1dc9..8481f91 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test."sql-avg"((
+{'average':test."coll_sql-avg"((
     select element x.int8Field
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_mixed/avg_mixed.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_mixed/avg_mixed.1.ddl.sqlpp
index 5378c3e..fff702e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_mixed/avg_mixed.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_mixed/avg_mixed.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
-* Description  : Run sql-avg over an ordered list with mixed types
+* Description  : Run coll_sql-avg over an ordered list with mixed types
 * Expected Res : Failure
 * Date         : Feb 7th 2014
 */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_mixed/avg_mixed.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_mixed/avg_mixed.3.query.sqlpp
index f02d73b..5132c56 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_mixed/avg_mixed.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_mixed/avg_mixed.3.query.sqlpp
@@ -17,12 +17,12 @@
  * under the License.
  */
 /*
-* Description  : Run sql-avg over an ordered list with mixed types
+* Description  : Run coll_sql-avg over an ordered list with mixed types
 * Expected Res : Failure
 * Date         : Feb 7th 2014
 */
 
-select element "sql-avg"((
+select element "coll_sql-avg"((
     select element x
     from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_01/count_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_01/count_01.3.query.sqlpp
index 47ed1d8..bab28c3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_01/count_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_01/count_01.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-count"((
+select element test."coll_sql-count"((
     select element x
     from  [1,2,3] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.1.ddl.sqlpp
index 34b3e00..4682857 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-count aggregation correctly returns 0 for an empty stream,
+ * Description    : Tests that coll_sql-count aggregation correctly returns 0 for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.2.update.sqlpp
index b0903c6..dae5bfa 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-count aggregation correctly returns 0 for an empty stream,
+ * Description    : Tests that coll_sql-count aggregation correctly returns 0 for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.3.query.sqlpp
index 7038ffc..09e881e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_01/count_empty_01.3.query.sqlpp
@@ -17,12 +17,12 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-count aggregation correctly returns 0 for an empty stream,
+ * Description    : Tests that coll_sql-count aggregation correctly returns 0 for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
 
-select element "sql-count"((
+select element "coll_sql-count"((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.1.ddl.sqlpp
index 8450cbd..48286b2 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-count aggregation correctly returns 0 for an empty stream,
+ * Description    : Tests that coll_sql-count aggregation correctly returns 0 for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.2.update.sqlpp
index 2fe949f..df5c80a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-count aggregation correctly returns 0 for an empty stream,
+ * Description    : Tests that coll_sql-count aggregation correctly returns 0 for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.3.query.sqlpp
index a8cbd64..c9fdf7f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_empty_02/count_empty_02.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-count aggregation correctly returns 0 for an empty stream,
+ * Description    : Tests that coll_sql-count aggregation correctly returns 0 for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-count"((
+select element test."coll_sql-count"((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_null/count_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_null/count_null.3.query.sqlpp
index afb7f99..cfe5457 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_null/count_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_null/count_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'sql-count':test."sql-count"((
+{'sql-count':test."coll_sql-count"((
     select element x.doubleField
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue395/issue395.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue395/issue395.3.query.sqlpp
index 080fd11..a6726e2 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue395/issue395.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue395/issue395.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-count"((
+select element test."coll_sql-count"((
     select element l.name
     from  Employee as l
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue412_0/issue412_0.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue412_0/issue412_0.3.query.sqlpp
index 50aedcf..f17fc50 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue412_0/issue412_0.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue412_0/issue412_0.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-"sql-count"(['ASTERIX','Hyracks',null]);
+"coll_sql-count"(['ASTERIX','Hyracks',null]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue412_1/issue412_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue412_1/issue412_1.3.query.sqlpp
index 8ffe5f1..cf9a3ef 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue412_1/issue412_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue412_1/issue412_1.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-{'sql-count':"sql-count"([1,60,null]),'average':"sql-avg"([1,60,null]),'sql-sum':"sql-sum"([1,60,null]),'sql-min':"sql-min"([1,60,null]),'sql-max':"sql-max"([1,60,null])};
+{'sql-count':"coll_sql-count"([1,60,null]),'average':"coll_sql-avg"([1,60,null]),'sql-sum':"coll_sql-sum"([1,60,null]),'sql-min':"coll_sql-min"([1,60,null]),'sql-max':"coll_sql-max"([1,60,null])};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_min_hetero_list/issue425_min_hetero_list.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_min_hetero_list/issue425_min_hetero_list.3.query.sqlpp
index 1d0f51f..7df2200 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_min_hetero_list/issue425_min_hetero_list.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_min_hetero_list/issue425_min_hetero_list.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-"sql-min"([23,748374857483]);
+"coll_sql-min"([23,748374857483]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_min_hetero_list_1/issue425_min_hetero_list_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_min_hetero_list_1/issue425_min_hetero_list_1.3.query.sqlpp
index 8d6c63a..d4f04f0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_min_hetero_list_1/issue425_min_hetero_list_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_min_hetero_list_1/issue425_min_hetero_list_1.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-"sql-min"([748374857483,23,0.5]);
+"coll_sql-min"([748374857483,23,0.5]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_sum_hetero_list/issue425_sum_hetero_list.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_sum_hetero_list/issue425_sum_hetero_list.3.query.sqlpp
index a05abfe..11fd369 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_sum_hetero_list/issue425_sum_hetero_list.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_sum_hetero_list/issue425_sum_hetero_list.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-"sql-sum"([23,748374857483]);
+"coll_sql-sum"([23,748374857483]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_sum_hetero_list_1/issue425_sum_hetero_list_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_sum_hetero_list_1/issue425_sum_hetero_list_1.3.query.sqlpp
index 0435afa..6613ea0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_sum_hetero_list_1/issue425_sum_hetero_list_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue425_sum_hetero_list_1/issue425_sum_hetero_list_1.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-"sql-sum"([748374857483,23,0.5]);
+"coll_sql-sum"([748374857483,23,0.5]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.1.ddl.sqlpp
index d393206..2e8f728 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.1.ddl.sqlpp
@@ -17,9 +17,9 @@
  * under the License.
  */
 /**
- * issue531_string_sql-min_sql-max
+ * issue531_string_coll_sql-min_coll_sql-max
  *
- * Purpose: test the support of string values for sql-min and sql-max aggregation function
+ * Purpose: test the support of string values for coll_sql-min and coll_sql-max aggregation function
  * Result: success
  *
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.2.update.sqlpp
index da2154f..506302f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.2.update.sqlpp
@@ -17,9 +17,9 @@
  * under the License.
  */
 /**
- * issue531_string_sql-min_sql-max
+ * issue531_string_coll_sql-min_coll_sql-max
  *
- * Purpose: test the support of string values for sql-min and sql-max aggregation function
+ * Purpose: test the support of string values for coll_sql-min and coll_sql-max aggregation function
  * Result: success
  *
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.3.query.sqlpp
index 89d205a..abdbb1a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/issue531_string_min_max/issue531_string_min_max.3.query.sqlpp
@@ -17,9 +17,9 @@
  * under the License.
  */
 /**
- * issue531_string_sql-min_sql-max
+ * issue531_string_coll_sql-min_coll_sql-max
  *
- * Purpose: test the support of string values for sql-min and sql-max aggregation function
+ * Purpose: test the support of string values for coll_sql-min and coll_sql-max aggregation function
  * Result: success
  *
  */
@@ -27,10 +27,10 @@
 use test;
 
 
-select element {'sql-min':test."sql-min"((
+select element {'sql-min':test."coll_sql-min"((
         select element l.name
         from  t1 as l
-    )),'sql-max':test."sql-max"((
+    )),'sql-max':test."coll_sql-max"((
         select element l.name
         from  t1 as l
     ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.1.ddl.sqlpp
index d497b33..461e0df 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-max aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-max aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.2.update.sqlpp
index 7ed3258..e353b90 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-max aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-max aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.3.query.sqlpp
index a11559d..e60b4464 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_01/max_empty_01.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-max aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-max aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-max"((
+select element test."coll_sql-max"((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.1.ddl.sqlpp
index 98ceb13..01f9aa8 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-max aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-max aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.2.update.sqlpp
index 2599da6..405f886 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-max aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-max aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.3.query.sqlpp
index 0d1bd13..03f437e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_empty_02/max_empty_02.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-max aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-max aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-max"((
+select element test."coll_sql-max"((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.1.ddl.sqlpp
index 8574115d..fab2dc7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-min aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-min aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.2.update.sqlpp
index 0313677..959dacd 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-min aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-min aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.3.query.sqlpp
index d02d66e..11ee5b3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_01/min_empty_01.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-min aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-min aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-min"((
+select element test."coll_sql-min"((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.1.ddl.sqlpp
index 7ff9d0b..af822f7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-min aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-min aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.2.update.sqlpp
index 2c8ed44..2edf292 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-min aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-min aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.3.query.sqlpp
index 965dd90..48a033d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_empty_02/min_empty_02.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-min aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-min aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-min"((
+select element test."coll_sql-min"((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_mixed/min_mixed.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_mixed/min_mixed.1.ddl.sqlpp
index 21781b6..1c1a445 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_mixed/min_mixed.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_mixed/min_mixed.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
-* Description  : Run sql-min over an ordered list with mixed types
+* Description  : Run coll_sql-min over an ordered list with mixed types
 * Expected Res : Failure
 * Date         : Feb 7th 2014
 */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_mixed/min_mixed.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_mixed/min_mixed.3.query.sqlpp
index f4b95b7..05d6102 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_mixed/min_mixed.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_mixed/min_mixed.3.query.sqlpp
@@ -17,12 +17,12 @@
  * under the License.
  */
 /*
-* Description  : Run sql-min over an ordered list with mixed types
+* Description  : Run coll_sql-min over an ordered list with mixed types
 * Expected Res : Failure
 * Date         : Feb 7th 2014
 */
 
-select element "sql-min"((
+select element "coll_sql-min"((
     select element x
     from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/query-issue400/query-issue400.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/query-issue400/query-issue400.3.query.sqlpp
index 2df4a86..08a5659 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/query-issue400/query-issue400.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/query-issue400/query-issue400.3.query.sqlpp
@@ -17,6 +17,6 @@
  * under the License.
  */
 
-"sql-count"((select element i
+"coll_sql-count"((select element i
 from  [[1,2,3,4,5],[6,7,8,9]] as i
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.1.ddl.sqlpp
index e81a84a..d9e647a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-avg without nulls.
+ * Description    : Tests the scalar version of coll_sql-avg without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.2.update.sqlpp
index 5f90a36..1bc9abf 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-avg without nulls.
+ * Description    : Tests the scalar version of coll_sql-avg without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.3.query.sqlpp
index 820e906..0c854e8 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg/scalar_avg.3.query.sqlpp
@@ -17,19 +17,19 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-avg without nulls.
+ * Description    : Tests the scalar version of coll_sql-avg without nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-avg"([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test."sql-avg"([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test."sql-avg"([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test."sql-avg"([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test."sql-avg"([test.float('1'),test.float('2'),test.float('3')]),
-      d as test."sql-avg"([test.double('1'),test.double('2'),test.double('3')])
+with  i8 as test."coll_sql-avg"([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test."coll_sql-avg"([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test."coll_sql-avg"([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test."coll_sql-avg"([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test."coll_sql-avg"([test.float('1'),test.float('2'),test.float('3')]),
+      d as test."coll_sql-avg"([test.double('1'),test.double('2'),test.double('3')])
 select element i
 from  [i8,i16,i32,i64,f,d] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.1.ddl.sqlpp
index 9e6913c..a1e77be 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-avg with an empty list.
+ * Description    : Tests the scalar version of coll_sql-avg with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.2.update.sqlpp
index 0bcef8b..920731d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-avg with an empty list.
+ * Description    : Tests the scalar version of coll_sql-avg with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.3.query.sqlpp
index 5b372b5..6cf01bd 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_empty/scalar_avg_empty.3.query.sqlpp
@@ -17,8 +17,8 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-avg with an empty list.
+ * Description    : Tests the scalar version of coll_sql-avg with an empty list.
  * Success        : Yes
  */
 
-select element "sql-avg"([]);
+select element "coll_sql-avg"([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.1.ddl.sqlpp
index 1e717cf..0c78dd9 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-avg with nulls.
+ * Description    : Tests the scalar version of coll_sql-avg with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.2.update.sqlpp
index 5212ef1..7d72098 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-avg with nulls.
+ * Description    : Tests the scalar version of coll_sql-avg with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.3.query.sqlpp
index 325c738..49286b5 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_avg_null/scalar_avg_null.3.query.sqlpp
@@ -17,19 +17,19 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-avg with nulls.
+ * Description    : Tests the scalar version of coll_sql-avg with nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-avg"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test."sql-avg"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test."sql-avg"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test."sql-avg"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test."sql-avg"([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test."sql-avg"([test.double('1'),test.double('2'),test.double('3'),null])
+with  i8 as test."coll_sql-avg"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test."coll_sql-avg"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test."coll_sql-avg"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test."coll_sql-avg"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test."coll_sql-avg"([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test."coll_sql-avg"([test.double('1'),test.double('2'),test.double('3'),null])
 select element i
 from  [i8,i16,i32,i64,f,d] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.1.ddl.sqlpp
index 1e52a55..40d8ac4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-count without nulls.
+ * Description    : Tests the scalar version of coll_sql-count without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.2.update.sqlpp
index 2268b81..089102e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-count without nulls.
+ * Description    : Tests the scalar version of coll_sql-count without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.3.query.sqlpp
index b6a24fd..12a3607 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count/scalar_count.3.query.sqlpp
@@ -17,20 +17,20 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-count without nulls.
+ * Description    : Tests the scalar version of coll_sql-count without nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-count"([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test."sql-count"([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test."sql-count"([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test."sql-count"([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test."sql-count"([test.float('1'),test.float('2'),test.float('3')]),
-      d as test."sql-count"([test.double('1'),test.double('2'),test.double('3')]),
-      s as test."sql-count"(['a','b','c'])
+with  i8 as test."coll_sql-count"([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test."coll_sql-count"([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test."coll_sql-count"([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test."coll_sql-count"([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test."coll_sql-count"([test.float('1'),test.float('2'),test.float('3')]),
+      d as test."coll_sql-count"([test.double('1'),test.double('2'),test.double('3')]),
+      s as test."coll_sql-count"(['a','b','c'])
 select element i
 from  [i8,i16,i32,i64,f,d,s] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.1.ddl.sqlpp
index cefaca4..99cd2ae 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-count with an empty list.
+ * Description    : Tests the scalar version of coll_sql-count with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.2.update.sqlpp
index ba1e7ec..e297b5f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-count with an empty list.
+ * Description    : Tests the scalar version of coll_sql-count with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.3.query.sqlpp
index 5d37bc5..d2a5f86 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_empty/scalar_count_empty.3.query.sqlpp
@@ -17,11 +17,11 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-count with an empty list.
+ * Description    : Tests the scalar version of coll_sql-count with an empty list.
  * Success        : Yes
  */
 
 use test;
 
 
-select element test."sql-count"([]);
+select element test."coll_sql-count"([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.1.ddl.sqlpp
index 2185f6f..cf4cb87 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-count with nulls.
+ * Description    : Tests the scalar version of coll_sql-count with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.2.update.sqlpp
index d707601..be7acd0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-count with nulls.
+ * Description    : Tests the scalar version of coll_sql-count with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.3.query.sqlpp
index c0500e4..abd63d9 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_count_null/scalar_count_null.3.query.sqlpp
@@ -17,20 +17,20 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-count with nulls.
+ * Description    : Tests the scalar version of coll_sql-count with nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-count"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test."sql-count"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test."sql-count"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test."sql-count"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test."sql-count"([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test."sql-count"([test.double('1'),test.double('2'),test.double('3'),null]),
-      s as test."sql-count"(['a','b','c',null])
+with  i8 as test."coll_sql-count"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test."coll_sql-count"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test."coll_sql-count"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test."coll_sql-count"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test."coll_sql-count"([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test."coll_sql-count"([test.double('1'),test.double('2'),test.double('3'),null]),
+      s as test."coll_sql-count"(['a','b','c',null])
 select element i
 from  [i8,i16,i32,i64,f,d,s] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.1.ddl.sqlpp
index d95f53b..50cadbb 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-max without nulls.
+ * Description    : Tests the scalar version of coll_sql-max without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.2.update.sqlpp
index 2e50374..0582e1c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-max without nulls.
+ * Description    : Tests the scalar version of coll_sql-max without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.3.query.sqlpp
index ca96275..910128e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max/scalar_max.3.query.sqlpp
@@ -17,21 +17,21 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-max without nulls.
+ * Description    : Tests the scalar version of coll_sql-max without nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-max"([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test."sql-max"([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test."sql-max"([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test."sql-max"([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test."sql-max"([test.float('1'),test.float('2'),test.float('3')]),
-      d as test."sql-max"([test.double('1'),test.double('2'),test.double('3')]),
-      s as test."sql-max"(['foo','bar','world']),
-      dt as test."sql-max"([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z')])
+with  i8 as test."coll_sql-max"([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test."coll_sql-max"([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test."coll_sql-max"([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test."coll_sql-max"([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test."coll_sql-max"([test.float('1'),test.float('2'),test.float('3')]),
+      d as test."coll_sql-max"([test.double('1'),test.double('2'),test.double('3')]),
+      s as test."coll_sql-max"(['foo','bar','world']),
+      dt as test."coll_sql-max"([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z')])
 select element i
 from  [i8,i16,i32,i64,f,d,s,dt] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.1.ddl.sqlpp
index 1c9bfdd..14a7cce 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-max with an empty list.
+ * Description    : Tests the scalar version of coll_sql-max with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.2.update.sqlpp
index f4e1750..575f92d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-max with an empty list.
+ * Description    : Tests the scalar version of coll_sql-max with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.3.query.sqlpp
index 3535f66..8a16ce0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_empty/scalar_max_empty.3.query.sqlpp
@@ -17,11 +17,11 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-max with an empty list.
+ * Description    : Tests the scalar version of coll_sql-max with an empty list.
  * Success        : Yes
  */
 
 use test;
 
 
-select element test."sql-max"([]);
+select element test."coll_sql-max"([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.1.ddl.sqlpp
index 2673223..76d9682 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-max with nulls.
+ * Description    : Tests the scalar version of coll_sql-max with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.2.update.sqlpp
index a0de2d4..61fb2ed 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-max with nulls.
+ * Description    : Tests the scalar version of coll_sql-max with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.3.query.sqlpp
index 813307a..4f7b412 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_max_null/scalar_max_null.3.query.sqlpp
@@ -17,21 +17,21 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-max with nulls.
+ * Description    : Tests the scalar version of coll_sql-max with nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-max"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test."sql-max"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test."sql-max"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test."sql-max"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test."sql-max"([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test."sql-max"([test.double('1'),test.double('2'),test.double('3'),null]),
-      s as test."sql-max"(['foo','bar','world',null]),
-      dt as test."sql-max"([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z'),null])
+with  i8 as test."coll_sql-max"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test."coll_sql-max"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test."coll_sql-max"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test."coll_sql-max"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test."coll_sql-max"([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test."coll_sql-max"([test.double('1'),test.double('2'),test.double('3'),null]),
+      s as test."coll_sql-max"(['foo','bar','world',null]),
+      dt as test."coll_sql-max"([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z'),null])
 select element i
 from  [i8,i16,i32,i64,f,d,s,dt] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.1.ddl.sqlpp
index 7fec35a..dcbb75a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-min without nulls.
+ * Description    : Tests the scalar version of coll_sql-min without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.2.update.sqlpp
index b7f1259..0bcbe9c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-min without nulls.
+ * Description    : Tests the scalar version of coll_sql-min without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.3.query.sqlpp
index eb52dad..91f2393 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min/scalar_min.3.query.sqlpp
@@ -17,21 +17,21 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-min without nulls.
+ * Description    : Tests the scalar version of coll_sql-min without nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-min"([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test."sql-min"([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test."sql-min"([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test."sql-min"([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test."sql-min"([test.float('1'),test.float('2'),test.float('3')]),
-      d as test."sql-min"([test.double('1'),test.double('2'),test.double('3')]),
-      s as test."sql-min"(['foo','bar','world']),
-      dt as test."sql-min"([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z')])
+with  i8 as test."coll_sql-min"([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test."coll_sql-min"([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test."coll_sql-min"([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test."coll_sql-min"([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test."coll_sql-min"([test.float('1'),test.float('2'),test.float('3')]),
+      d as test."coll_sql-min"([test.double('1'),test.double('2'),test.double('3')]),
+      s as test."coll_sql-min"(['foo','bar','world']),
+      dt as test."coll_sql-min"([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z')])
 select element i
 from  [i8,i16,i32,i64,f,d,s,dt] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.1.ddl.sqlpp
index f473284..10bfbc3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-min with an empty list.
+ * Description    : Tests the scalar version of coll_sql-min with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.2.update.sqlpp
index bf0e2ec..e045685 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-min with an empty list.
+ * Description    : Tests the scalar version of coll_sql-min with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.3.query.sqlpp
index fb1ca8c..07c8619 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_empty/scalar_min_empty.3.query.sqlpp
@@ -17,11 +17,11 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-min with an empty list.
+ * Description    : Tests the scalar version of coll_sql-min with an empty list.
  * Success        : Yes
  */
 
 use test;
 
 
-select element test."sql-min"([]);
+select element test."coll_sql-min"([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.1.ddl.sqlpp
index e2059e6..5b21e8f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-min with nulls.
+ * Description    : Tests the scalar version of coll_sql-min with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.2.update.sqlpp
index 4fc7710..ae2d673 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-min with nulls.
+ * Description    : Tests the scalar version of coll_sql-min with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.3.query.sqlpp
index 290a1c2..9d30374 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_min_null/scalar_min_null.3.query.sqlpp
@@ -17,21 +17,21 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-min with nulls.
+ * Description    : Tests the scalar version of coll_sql-min with nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-min"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test."sql-min"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test."sql-min"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test."sql-min"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test."sql-min"([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test."sql-min"([test.double('1'),test.double('2'),test.double('3'),null]),
-      s as test."sql-min"(['foo','bar','world',null]),
-      dt as test."sql-min"([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z'),null])
+with  i8 as test."coll_sql-min"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test."coll_sql-min"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test."coll_sql-min"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test."coll_sql-min"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test."coll_sql-min"([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test."coll_sql-min"([test.double('1'),test.double('2'),test.double('3'),null]),
+      s as test."coll_sql-min"(['foo','bar','world',null]),
+      dt as test."coll_sql-min"([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z'),null])
 select element i
 from  [i8,i16,i32,i64,f,d,s,dt] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.1.ddl.sqlpp
index d6aa2ee..693c8d8 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-sum without nulls.
+ * Description    : Tests the scalar version of coll_sql-sum without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.2.update.sqlpp
index dc9de50..fe5a187 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-sum without nulls.
+ * Description    : Tests the scalar version of coll_sql-sum without nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.3.query.sqlpp
index 9f799ec..69f68a4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum/scalar_sum.3.query.sqlpp
@@ -17,19 +17,19 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-sum without nulls.
+ * Description    : Tests the scalar version of coll_sql-sum without nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-sum"([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test."sql-sum"([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test."sql-sum"([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test."sql-sum"([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test."sql-sum"([test.float('1'),test.float('2'),test.float('3')]),
-      d as test."sql-sum"([test.double('1'),test.double('2'),test.double('3')])
+with  i8 as test."coll_sql-sum"([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test."coll_sql-sum"([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test."coll_sql-sum"([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test."coll_sql-sum"([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test."coll_sql-sum"([test.float('1'),test.float('2'),test.float('3')]),
+      d as test."coll_sql-sum"([test.double('1'),test.double('2'),test.double('3')])
 select element i
 from  [i8,i16,i32,i64,f,d] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.1.ddl.sqlpp
index 4a58f94..8ec3c87 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-sum with an empty list.
+ * Description    : Tests the scalar version of coll_sql-sum with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.2.update.sqlpp
index cbf8790..eed803e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-sum with an empty list.
+ * Description    : Tests the scalar version of coll_sql-sum with an empty list.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.3.query.sqlpp
index b101b78..5030566 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_empty/scalar_sum_empty.3.query.sqlpp
@@ -17,11 +17,11 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-sum with an empty list.
+ * Description    : Tests the scalar version of coll_sql-sum with an empty list.
  * Success        : Yes
  */
 
 use test;
 
 
-select element test."sql-sum"([]);
+select element test."coll_sql-sum"([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.1.ddl.sqlpp
index a7d4b35..a661a36 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-sum with nulls.
+ * Description    : Tests the scalar version of coll_sql-sum with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.2.update.sqlpp
index 980a38e..f05913c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-sum with nulls.
+ * Description    : Tests the scalar version of coll_sql-sum with nulls.
  * Success        : Yes
  */
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.3.query.sqlpp
index 4bd7894..90020e5 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/scalar_sum_null/scalar_sum_null.3.query.sqlpp
@@ -17,19 +17,19 @@
  * under the License.
  */
 /*
- * Description    : Tests the scalar version of sql-sum with nulls.
+ * Description    : Tests the scalar version of coll_sql-sum with nulls.
  * Success        : Yes
  */
 
 use test;
 
 
-with  i8 as test."sql-sum"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test."sql-sum"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test."sql-sum"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test."sql-sum"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test."sql-sum"([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test."sql-sum"([test.double('1'),test.double('2'),test.double('3'),null])
+with  i8 as test."coll_sql-sum"([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test."coll_sql-sum"([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test."coll_sql-sum"([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test."coll_sql-sum"([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test."coll_sql-sum"([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test."coll_sql-sum"([test.double('1'),test.double('2'),test.double('3'),null])
 select element i
 from  [i8,i16,i32,i64,f,d] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_double/sum_double.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_double/sum_double.3.query.sqlpp
index 6bb46d1..498337c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_double/sum_double.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_double/sum_double.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x
     from  [1.0,2.0,3.0] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_double_null/sum_double_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_double_null/sum_double_null.3.query.sqlpp
index 30945ab..a4c12fc 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_double_null/sum_double_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_double_null/sum_double_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x.doubleField
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.1.ddl.sqlpp
index 5559c89..cc6f313 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-sum aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-sum aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.2.update.sqlpp
index 7f09a49..f0eaeca 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-sum aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-sum aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.3.query.sqlpp
index b20de6a..90ab5e5 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_01/sum_empty_01.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-sum aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-sum aggregation correctly returns null for an empty stream,
  *                  without an aggregate combiner.
  * Success        : Yes
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.1.ddl.sqlpp
index 6316d09..f3134a2 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-sum aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-sum aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.2.update.sqlpp
index f19da12..2ae8290 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-sum aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-sum aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.3.query.sqlpp
index 737f23f..0e02b18 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_empty_02/sum_empty_02.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description    : Tests that sql-sum aggregation correctly returns null for an empty stream,
+ * Description    : Tests that coll_sql-sum aggregation correctly returns null for an empty stream,
  *                  with an aggregate combiner.
  * Success        : Yes
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_float/sum_float.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_float/sum_float.3.query.sqlpp
index f84c73b..bd66bc0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_float/sum_float.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_float/sum_float.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x
     from  [test.float('1'),test.float('2'),test.float('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_float_null/sum_float_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_float_null/sum_float_null.3.query.sqlpp
index 367f251..50e1170 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_float_null/sum_float_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_float_null/sum_float_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x.floatField
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int16/sum_int16.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int16/sum_int16.3.query.sqlpp
index 317daf0..5e334c0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int16/sum_int16.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int16/sum_int16.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x
     from  [test.int16('1'),test.int16('2'),test.int16('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int16_null/sum_int16_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int16_null/sum_int16_null.3.query.sqlpp
index 6f269f3..57b9a1a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int16_null/sum_int16_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int16_null/sum_int16_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x.int16Field
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int32/sum_int32.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int32/sum_int32.3.query.sqlpp
index 7f85f31..54b403d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int32/sum_int32.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int32/sum_int32.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x
     from  [test.int32('1'),test.int32('2'),test.int32('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int32_null/sum_int32_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int32_null/sum_int32_null.3.query.sqlpp
index 8339998..ffcd051 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int32_null/sum_int32_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int32_null/sum_int32_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x.int32Field
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int64/sum_int64.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int64/sum_int64.3.query.sqlpp
index 57afbfc..c797118 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int64/sum_int64.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int64/sum_int64.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x
     from  [test.int64('1'),test.int64('2'),test.int64('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int64_null/sum_int64_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int64_null/sum_int64_null.3.query.sqlpp
index c555e24..2a6e4b0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int64_null/sum_int64_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int64_null/sum_int64_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x.int64Field
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int8/sum_int8.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int8/sum_int8.3.query.sqlpp
index 046bdd0..2bcfc28 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int8/sum_int8.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int8/sum_int8.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x
     from  [test.int8('1'),test.int8('2'),test.int8('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int8_null/sum_int8_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int8_null/sum_int8_null.3.query.sqlpp
index d2414d9..327ecfa 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int8_null/sum_int8_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_int8_null/sum_int8_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element x.int8Field
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.1.ddl.sqlpp
index 24bdd1c..bf05e6b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
-* Description  : Run sql-sum over an ordered list with mixed types
+* Description  : Run coll_sql-sum over an ordered list with mixed types
 * Expected Res : Failure
 * Date         : Feb 7th 2014
 */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.query.sqlpp
index d05df5c..76c5b86 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.query.sqlpp
@@ -17,12 +17,12 @@
  * under the License.
  */
 /*
-* Description  : Run sql-sum over an ordered list with mixed types
+* Description  : Run coll_sql-sum over an ordered list with mixed types
 * Expected Res : Failure
 * Date         : Feb 7th 2014
 */
 
-select element "sql-sum"((
+select element "coll_sql-sum"((
     select element x
     from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.1.ddl.sqlpp
index 3442fd4..810ce8e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.1.ddl.sqlpp
@@ -17,8 +17,8 @@
  * under the License.
  */
 /*
- * Description      :   sql-sum() aggregate function must return the numeric sql-sum, when non null values are given as input to sql-sum().
- *                  :   Get the sql-sum for those tuples which are non null for salary fields.
+ * Description      :   sql-coll_sum() aggregate function must return the numeric coll_sql-sum, when non null values are given as input to sql-coll_sum().
+ *                  :   Get the coll_sql-sum for those tuples which are non null for salary fields.
  * Expected result  :   Success
  * Date             :   July 20th 2012
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.2.update.sqlpp
index 5d723c8..a62c168 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.2.update.sqlpp
@@ -17,8 +17,8 @@
  * under the License.
  */
 /*
- * Description      :   sql-sum() aggregate function must return the numeric sql-sum, when non null values are given as input to sql-sum().
- *                  :   Get the sql-sum for those tuples which are non null for salary fields.
+ * Description      :   sql-coll_sum() aggregate function must return the numeric coll_sql-sum, when non null values are given as input to sql-coll_sum().
+ *                  :   Get the coll_sql-sum for those tuples which are non null for salary fields.
  * Expected result  :   Success
  * Date             :   July 20th 2012
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.3.query.sqlpp
index 6f538cc..e119cfa 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_null-with-pred/sum_null-with-pred.3.query.sqlpp
@@ -17,8 +17,8 @@
  * under the License.
  */
 /*
- * Description      :   sql-sum() aggregate function must return the numeric sql-sum, when non null values are given as input to sql-sum().
- *                  :   Get the sql-sum for those tuples which are non null for salary fields.
+ * Description      :   sql-coll_sum() aggregate function must return the numeric coll_sql-sum, when non null values are given as input to sql-coll_sum().
+ *                  :   Get the coll_sql-sum for those tuples which are non null for salary fields.
  * Expected result  :   Success
  * Date             :   July 20th 2012
  */
@@ -28,7 +28,7 @@
 
 set "import-private-functions" "true";
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element l.sal
     from  tdst as l
     where test.not(test."is-null"(l.sal))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.1.ddl.sqlpp
index 942e2a0..e01b778 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description      :   Add numeric values with a null value, sql-sum() aggregate function must return null.
+ * Description      :   Add numeric values with a null value, sql-coll_sum() aggregate function must return null.
  * Expected result  :   Success
  * Date             :   July 20th 2012
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.2.update.sqlpp
index 44cc106..00f93a4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description      :   Add numeric values with a null value, sql-sum() aggregate function must return null.
+ * Description      :   Add numeric values with a null value, sql-coll_sum() aggregate function must return null.
  * Expected result  :   Success
  * Date             :   July 20th 2012
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.3.query.sqlpp
index ed82deb..e603924 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_numeric_null/sum_numeric_null.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description      :   Add numeric values with a null value, sql-sum() aggregate function must return null.
+ * Description      :   Add numeric values with a null value, sql-coll_sum() aggregate function must return null.
  * Expected result  :   Success
  * Date             :   July 20th 2012
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test."sql-sum"((
+select element test."coll_sql-sum"((
     select element l.sal
     from  tdst as l
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null/agg_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null/agg_null.3.query.sqlpp
index dc3ef07..38c0972 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null/agg_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null/agg_null.3.query.sqlpp
@@ -22,4 +22,4 @@
 * Date         : Jun 2nd 2013
 */
 
-{'count1':count([null]),'average1':avg([null]),'sum1':sum([null]),'min1':min([null]),'max1':max([null]),'count2':count({{null,null}}),'average2':avg({{null,null}}),'sum2':sum({{null,null}}),'min2':min({{null,null}}),'max2':max({{null,null}})};
+{'count1':coll_count([null]),'average1':coll_avg([null]),'sum1':coll_sum([null]),'min1':coll_min([null]),'max1':coll_max([null]),'count2':coll_count({{null,null}}),'average2':coll_avg({{null,null}}),'sum2':coll_sum({{null,null}}),'min2':coll_min({{null,null}}),'max2':coll_max({{null,null}})};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.query.sqlpp
index ddd882e..9ada73b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.query.sqlpp
@@ -25,19 +25,19 @@
 use test;
 
 
-{'count':test.count((
+{'count':test.coll_count((
     select element t.valplus
     from  Test as t
-)),'average':test.avg((
+)),'average':test.coll_avg((
     select element t.valplus
     from  Test as t
-)),'sum':test.sum((
+)),'sum':test.coll_sum((
     select element t.valplus
     from  Test as t
-)),'min':test.min((
+)),'min':test.coll_min((
     select element t.valplus
     from  Test as t
-)),'max':test.max((
+)),'max':test.coll_max((
     select element t.valplus
     from  Test as t
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
index 6cf606d..3643901 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
@@ -25,28 +25,28 @@
 use test;
 
 
-{'count':test.count((
+{'count':test.coll_count((
     select element t
     from  Test as t
-)),'average':test.avg((
+)),'average':test.coll_avg((
     select element i.val
     from  (
         select element t
         from  Test as t
     ) as i
-)),'sum':test.sum((
+)),'sum':test.coll_sum((
     select element i.val
     from  (
         select element t
         from  Test as t
     ) as i
-)),'min':test.min((
+)),'min':test.coll_min((
     select element i.valplus
     from  (
         select element t
         from  Test as t
     ) as i
-)),'max':test.max((
+)),'max':test.coll_max((
     select element i.valplus
     from  (
         select element t
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number/agg_number.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number/agg_number.3.query.sqlpp
index 87f159f..c90641b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number/agg_number.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number/agg_number.3.query.sqlpp
@@ -22,4 +22,4 @@
 * Date         : Jun 2nd 2013
 */
 
-{'count1':count([float('2.0'),double('3.0'),93847382783847382,1]),'average1':avg([float('2.0'),double('3.0'),93847382783847382,1]),'sum1':sum([float('2.0'),double('3.0'),93847382783847382,1]),'min1':min([float('2.0'),double('3.0'),93847382783847382,1]),'max1':max([float('2.0'),double('3.0'),93847382783847382,1]),'count2':count({{float('2.0'),double('3.0'),93847382783847382,1}}),'average2':avg({{float('2.0'),double('3.0'),93847382783847382,1}}),'sum2':sum({{float('2.0'),double('3.0'),93847382783847382,1}}),'min2':min({{float('2.0'),double('3.0'),93847382783847382,1}}),'max2':max({{float('2.0'),double('3.0'),93847382783847382,1}})};
+{'count1':coll_count([float('2.0'),double('3.0'),93847382783847382,1]),'average1':coll_avg([float('2.0'),double('3.0'),93847382783847382,1]),'sum1':coll_sum([float('2.0'),double('3.0'),93847382783847382,1]),'min1':coll_min([float('2.0'),double('3.0'),93847382783847382,1]),'max1':coll_max([float('2.0'),double('3.0'),93847382783847382,1]),'count2':coll_count({{float('2.0'),double('3.0'),93847382783847382,1}}),'average2':coll_avg({{float('2.0'),double('3.0'),93847382783847382,1}}),'sum2':coll_sum({{float('2.0'),double('3.0'),93847382783847382,1}}),'min2':coll_min({{float('2.0'),double('3.0'),93847382783847382,1}}),'max2':coll_max({{float('2.0'),double('3.0'),93847382783847382,1}})};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.query.sqlpp
index 63ba0ad..42306d8 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.query.sqlpp
@@ -25,19 +25,19 @@
 use test;
 
 
-{'count':test.count((
+{'count':test.coll_count((
     select element t.valplus
     from  Test as t
-)),'average':test.avg((
+)),'average':test.coll_avg((
     select element t.valplus
     from  Test as t
-)),'sum':test.sum((
+)),'sum':test.coll_sum((
     select element t.valplus
     from  Test as t
-)),'min':test.min((
+)),'min':test.coll_min((
     select element t.valplus
     from  Test as t
-)),'max':test.max((
+)),'max':test.coll_max((
     select element t.valplus
     from  Test as t
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.3.query.sqlpp
index 12a1cfb..ae1b1eb 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-select element avg((
+select element coll_avg((
     select element x
     from  [1.0,2.0,double('3.0')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.3.query.sqlpp
index 2926232..4c10066 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test.avg((
+{'average':test.coll_avg((
     select element x.doubleField
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.query.sqlpp
index 10aa600..d7a5263 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.avg((
+select element test.coll_avg((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.query.sqlpp
index 7b6a34a..8d2359f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.avg((
+select element test.coll_avg((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.3.query.sqlpp
index 264ec2c..14c4bc5 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.avg((
+select element test.coll_avg((
     select element x
     from  [test.float('1'),test.float('2'),test.float('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.3.query.sqlpp
index bbc0d48..c8c3774 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test.avg((
+{'average':test.coll_avg((
     select element x.floatField
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.3.query.sqlpp
index d370467..a755219 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.avg((
+select element test.coll_avg((
     select element x
     from  [test.int16('1'),test.int16('2'),test.int16('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.query.sqlpp
index 2587a9d..d50b0d1 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test.avg((
+{'average':test.coll_avg((
     select element x.int16Field
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.3.query.sqlpp
index 769f3d0..a235c84 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.avg((
+select element test.coll_avg((
     select element x
     from  [1,2,3] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.query.sqlpp
index acb814e..9618d2d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test.avg((
+{'average':test.coll_avg((
     select element x.int32Field
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.3.query.sqlpp
index 1734f7f..f090f5b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.avg((
+select element test.coll_avg((
     select element x
     from  [test.int64('1'),test.int64('2'),test.int64('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.query.sqlpp
index b320332..8c063d3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test.avg((
+{'average':test.coll_avg((
     select element x.int64Field
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.3.query.sqlpp
index f2b9ac6..91ee6be 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.avg((
+select element test.coll_avg((
     select element x
     from  [test.int8('1'),test.int8('2'),test.int8('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.query.sqlpp
index 1753b77..74fb4c4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'average':test.avg((
+{'average':test.coll_avg((
     select element x.int8Field
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_mixed/avg_mixed.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_mixed/avg_mixed.3.query.sqlpp
index 988020f..4043084 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_mixed/avg_mixed.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_mixed/avg_mixed.3.query.sqlpp
@@ -22,7 +22,7 @@
 * Date         : Jun 2nd 2013
 */
 
-select element avg((
+select element coll_avg((
     select element x
     from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_01/count_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_01/count_01.3.query.sqlpp
index 5c81a50..fa90f85 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_01/count_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_01/count_01.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.count((
+select element test.coll_count((
     select element x
     from  [1,2,3] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_empty_01/count_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_empty_01/count_empty_01.3.query.sqlpp
index 4be4da7..383671d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_empty_01/count_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_empty_01/count_empty_01.3.query.sqlpp
@@ -22,7 +22,7 @@
  * Success        : Yes
  */
 
-select element count((
+select element coll_count((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_empty_02/count_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_empty_02/count_empty_02.3.query.sqlpp
index c36e99a..67e6e77 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_empty_02/count_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_empty_02/count_empty_02.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.count((
+select element test.coll_count((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_null/count_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_null/count_null.3.query.sqlpp
index 5d60f10..ec84f7c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_null/count_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_null/count_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-{'count':test.count((
+{'count':test.coll_count((
     select element x.doubleField
     from  Numeric as x
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue395/issue395.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue395/issue395.3.query.sqlpp
index 81aa828..feea992 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue395/issue395.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue395/issue395.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.count((
+select element test.coll_count((
     select element l.name
     from  Employee as l
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue412_0/issue412_0.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue412_0/issue412_0.3.query.sqlpp
index 5dcf622..deaa68a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue412_0/issue412_0.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue412_0/issue412_0.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-count(['ASTERIX','Hyracks',null]);
+coll_count(['ASTERIX','Hyracks',null]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue412_1/issue412_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue412_1/issue412_1.3.query.sqlpp
index 78c9164..9da7811 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue412_1/issue412_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue412_1/issue412_1.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-{'count':count([1,60,null]),'average':avg([1,60,null]),'sum':sum([1,60,null]),'min':min([1,60,null]),'max':max([1,60,null])};
+{'count':coll_count([1,60,null]),'average':coll_avg([1,60,null]),'sum':coll_sum([1,60,null]),'min':coll_min([1,60,null]),'max':coll_max([1,60,null])};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_min_hetero_list/issue425_min_hetero_list.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_min_hetero_list/issue425_min_hetero_list.3.query.sqlpp
index 40631ed..b2c6c66 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_min_hetero_list/issue425_min_hetero_list.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_min_hetero_list/issue425_min_hetero_list.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-min([23,748374857483]);
+coll_min([23,748374857483]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_min_hetero_list_1/issue425_min_hetero_list_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_min_hetero_list_1/issue425_min_hetero_list_1.3.query.sqlpp
index 8d438e3..e12e644 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_min_hetero_list_1/issue425_min_hetero_list_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_min_hetero_list_1/issue425_min_hetero_list_1.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-min([748374857483,23,0.5]);
+coll_min([748374857483,23,0.5]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_sum_hetero_list/issue425_sum_hetero_list.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_sum_hetero_list/issue425_sum_hetero_list.3.query.sqlpp
index 17fd1aa..770b7dc 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_sum_hetero_list/issue425_sum_hetero_list.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_sum_hetero_list/issue425_sum_hetero_list.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-sum([23,748374857483]);
+coll_sum([23,748374857483]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_sum_hetero_list_1/issue425_sum_hetero_list_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_sum_hetero_list_1/issue425_sum_hetero_list_1.3.query.sqlpp
index 41429b1..3932e23 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_sum_hetero_list_1/issue425_sum_hetero_list_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue425_sum_hetero_list_1/issue425_sum_hetero_list_1.3.query.sqlpp
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-sum([748374857483,23,0.5]);
+coll_sum([748374857483,23,0.5]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue531_string_min_max/issue531_string_min_max.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue531_string_min_max/issue531_string_min_max.3.query.sqlpp
index b5b9917..2a3312e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue531_string_min_max/issue531_string_min_max.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/issue531_string_min_max/issue531_string_min_max.3.query.sqlpp
@@ -27,10 +27,10 @@
 use test;
 
 
-select element {'min':test.min((
+select element {'min':test.coll_min((
         select element l.name
         from  t1 as l
-    )),'max':test.max((
+    )),'max':test.coll_max((
         select element l.name
         from  t1 as l
     ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_empty_01/max_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_empty_01/max_empty_01.3.query.sqlpp
index 8d565eb..fa419e6 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_empty_01/max_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_empty_01/max_empty_01.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.max((
+select element test.coll_max((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_empty_02/max_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_empty_02/max_empty_02.3.query.sqlpp
index 442f496..1ad7c2b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_empty_02/max_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_empty_02/max_empty_02.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.max((
+select element test.coll_max((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_empty_01/min_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_empty_01/min_empty_01.3.query.sqlpp
index d476fcf..aa84453 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_empty_01/min_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_empty_01/min_empty_01.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.min((
+select element test.coll_min((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_empty_02/min_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_empty_02/min_empty_02.3.query.sqlpp
index ad14ddd..bd686b6 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_empty_02/min_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_empty_02/min_empty_02.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.min((
+select element test.coll_min((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_mixed/min_mixed.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_mixed/min_mixed.3.query.sqlpp
index 0b5dced..1802fee 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_mixed/min_mixed.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_mixed/min_mixed.3.query.sqlpp
@@ -22,7 +22,7 @@
 * Date         : Jun 2nd 2013
 */
 
-select element min((
+select element coll_min((
     select element x
     from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/query-issue400/query-issue400.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/query-issue400/query-issue400.3.query.sqlpp
index d73c8ce..f910f12 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/query-issue400/query-issue400.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/query-issue400/query-issue400.3.query.sqlpp
@@ -23,6 +23,6 @@
  * Date         : 8th May 2013
  */
 
-count((select element i
+coll_count((select element i
 from  [[1,2,3,4,5],[6,7,8,9]] as i
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg/scalar_avg.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg/scalar_avg.3.query.sqlpp
index 8312274..e61b9df 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg/scalar_avg.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg/scalar_avg.3.query.sqlpp
@@ -24,12 +24,12 @@
 use test;
 
 
-with  i8 as test.avg([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test.avg([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test.avg([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test.avg([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test.avg([test.float('1'),test.float('2'),test.float('3')]),
-      d as test.avg([test.double('1'),test.double('2'),test.double('3')])
+with  i8 as test.coll_avg([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test.coll_avg([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test.coll_avg([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test.coll_avg([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test.coll_avg([test.float('1'),test.float('2'),test.float('3')]),
+      d as test.coll_avg([test.double('1'),test.double('2'),test.double('3')])
 select element i
 from  [i8,i16,i32,i64,f,d] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg_empty/scalar_avg_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg_empty/scalar_avg_empty.3.query.sqlpp
index 39344f6..d2655e4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg_empty/scalar_avg_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg_empty/scalar_avg_empty.3.query.sqlpp
@@ -21,4 +21,4 @@
  * Success        : Yes
  */
 
-select element avg([]);
+select element coll_avg([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg_null/scalar_avg_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg_null/scalar_avg_null.3.query.sqlpp
index 2e0293f..20f6a18 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg_null/scalar_avg_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_avg_null/scalar_avg_null.3.query.sqlpp
@@ -24,12 +24,12 @@
 use test;
 
 
-with  i8 as test.avg([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test.avg([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test.avg([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test.avg([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test.avg([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test.avg([test.double('1'),test.double('2'),test.double('3'),null])
+with  i8 as test.coll_avg([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test.coll_avg([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test.coll_avg([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test.coll_avg([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test.coll_avg([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test.coll_avg([test.double('1'),test.double('2'),test.double('3'),null])
 select element i
 from  [i8,i16,i32,i64,f,d] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count/scalar_count.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count/scalar_count.3.query.sqlpp
index bcaad9e..8576a74 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count/scalar_count.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count/scalar_count.3.query.sqlpp
@@ -24,13 +24,13 @@
 use test;
 
 
-with  i8 as test.count([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test.count([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test.count([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test.count([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test.count([test.float('1'),test.float('2'),test.float('3')]),
-      d as test.count([test.double('1'),test.double('2'),test.double('3')]),
-      s as test.count(['a','b','c'])
+with  i8 as test.coll_count([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test.coll_count([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test.coll_count([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test.coll_count([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test.coll_count([test.float('1'),test.float('2'),test.float('3')]),
+      d as test.coll_count([test.double('1'),test.double('2'),test.double('3')]),
+      s as test.coll_count(['a','b','c'])
 select element i
 from  [i8,i16,i32,i64,f,d,s] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count_empty/scalar_count_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count_empty/scalar_count_empty.3.query.sqlpp
index ce9798d..d2fff80 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count_empty/scalar_count_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count_empty/scalar_count_empty.3.query.sqlpp
@@ -24,4 +24,4 @@
 use test;
 
 
-select element test.count([]);
+select element test.coll_count([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count_null/scalar_count_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count_null/scalar_count_null.3.query.sqlpp
index 8cb1e66..14eeb83 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count_null/scalar_count_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_count_null/scalar_count_null.3.query.sqlpp
@@ -24,13 +24,13 @@
 use test;
 
 
-with  i8 as test.count([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test.count([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test.count([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test.count([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test.count([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test.count([test.double('1'),test.double('2'),test.double('3'),null]),
-      s as test.count(['a','b','c',null])
+with  i8 as test.coll_count([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test.coll_count([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test.coll_count([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test.coll_count([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test.coll_count([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test.coll_count([test.double('1'),test.double('2'),test.double('3'),null]),
+      s as test.coll_count(['a','b','c',null])
 select element i
 from  [i8,i16,i32,i64,f,d,s] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max/scalar_max.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max/scalar_max.3.query.sqlpp
index 0070b55..da37e7c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max/scalar_max.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max/scalar_max.3.query.sqlpp
@@ -24,14 +24,14 @@
 use test;
 
 
-with  i8 as test.max([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test.max([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test.max([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test.max([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test.max([test.float('1'),test.float('2'),test.float('3')]),
-      d as test.max([test.double('1'),test.double('2'),test.double('3')]),
-      s as test.max(['foo','bar','world']),
-      dt as test.max([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z')])
+with  i8 as test.coll_max([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test.coll_max([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test.coll_max([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test.coll_max([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test.coll_max([test.float('1'),test.float('2'),test.float('3')]),
+      d as test.coll_max([test.double('1'),test.double('2'),test.double('3')]),
+      s as test.coll_max(['foo','bar','world']),
+      dt as test.coll_max([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z')])
 select element i
 from  [i8,i16,i32,i64,f,d,s,dt] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max_empty/scalar_max_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max_empty/scalar_max_empty.3.query.sqlpp
index 3bbf7e5..7978919 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max_empty/scalar_max_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max_empty/scalar_max_empty.3.query.sqlpp
@@ -24,4 +24,4 @@
 use test;
 
 
-select element test.max([]);
+select element test.coll_max([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max_null/scalar_max_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max_null/scalar_max_null.3.query.sqlpp
index bccf473..036a5bb 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max_null/scalar_max_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_max_null/scalar_max_null.3.query.sqlpp
@@ -24,14 +24,14 @@
 use test;
 
 
-with  i8 as test.max([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test.max([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test.max([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test.max([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test.max([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test.max([test.double('1'),test.double('2'),test.double('3'),null]),
-      s as test.max(['foo','bar','world',null]),
-      dt as test.max([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z'),null])
+with  i8 as test.coll_max([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test.coll_max([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test.coll_max([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test.coll_max([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test.coll_max([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test.coll_max([test.double('1'),test.double('2'),test.double('3'),null]),
+      s as test.coll_max(['foo','bar','world',null]),
+      dt as test.coll_max([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z'),null])
 select element i
 from  [i8,i16,i32,i64,f,d,s,dt] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min/scalar_min.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min/scalar_min.3.query.sqlpp
index 89e07a1..783c168 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min/scalar_min.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min/scalar_min.3.query.sqlpp
@@ -24,14 +24,14 @@
 use test;
 
 
-with  i8 as test.min([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test.min([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test.min([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test.min([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test.min([test.float('1'),test.float('2'),test.float('3')]),
-      d as test.min([test.double('1'),test.double('2'),test.double('3')]),
-      s as test.min(['foo','bar','world']),
-      dt as test.min([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z')])
+with  i8 as test.coll_min([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test.coll_min([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test.coll_min([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test.coll_min([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test.coll_min([test.float('1'),test.float('2'),test.float('3')]),
+      d as test.coll_min([test.double('1'),test.double('2'),test.double('3')]),
+      s as test.coll_min(['foo','bar','world']),
+      dt as test.coll_min([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z')])
 select element i
 from  [i8,i16,i32,i64,f,d,s,dt] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min_empty/scalar_min_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min_empty/scalar_min_empty.3.query.sqlpp
index 2d1db86..8a9f7ec 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min_empty/scalar_min_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min_empty/scalar_min_empty.3.query.sqlpp
@@ -24,4 +24,4 @@
 use test;
 
 
-select element test.min([]);
+select element test.coll_min([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min_null/scalar_min_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min_null/scalar_min_null.3.query.sqlpp
index 71d04ee..4005624 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min_null/scalar_min_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_min_null/scalar_min_null.3.query.sqlpp
@@ -24,14 +24,14 @@
 use test;
 
 
-with  i8 as test.min([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test.min([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test.min([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test.min([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test.min([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test.min([test.double('1'),test.double('2'),test.double('3'),null]),
-      s as test.min(['foo','bar','world',null]),
-      dt as test.min([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z'),null])
+with  i8 as test.coll_min([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test.coll_min([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test.coll_min([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test.coll_min([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test.coll_min([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test.coll_min([test.double('1'),test.double('2'),test.double('3'),null]),
+      s as test.coll_min(['foo','bar','world',null]),
+      dt as test.coll_min([test.datetime('2012-03-01T00:00:00Z'),test.datetime('2012-01-01T00:00:00Z'),test.datetime('2012-02-01T00:00:00Z'),null])
 select element i
 from  [i8,i16,i32,i64,f,d,s,dt] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum/scalar_sum.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum/scalar_sum.3.query.sqlpp
index 08a1049..eb9fa28 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum/scalar_sum.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum/scalar_sum.3.query.sqlpp
@@ -24,12 +24,12 @@
 use test;
 
 
-with  i8 as test.sum([test.int8('1'),test.int8('2'),test.int8('3')]),
-      i16 as test.sum([test.int16('1'),test.int16('2'),test.int16('3')]),
-      i32 as test.sum([test.int32('1'),test.int32('2'),test.int32('3')]),
-      i64 as test.sum([test.int64('1'),test.int64('2'),test.int64('3')]),
-      f as test.sum([test.float('1'),test.float('2'),test.float('3')]),
-      d as test.sum([test.double('1'),test.double('2'),test.double('3')])
+with  i8 as test.coll_sum([test.int8('1'),test.int8('2'),test.int8('3')]),
+      i16 as test.coll_sum([test.int16('1'),test.int16('2'),test.int16('3')]),
+      i32 as test.coll_sum([test.int32('1'),test.int32('2'),test.int32('3')]),
+      i64 as test.coll_sum([test.int64('1'),test.int64('2'),test.int64('3')]),
+      f as test.coll_sum([test.float('1'),test.float('2'),test.float('3')]),
+      d as test.coll_sum([test.double('1'),test.double('2'),test.double('3')])
 select element i
 from  [i8,i16,i32,i64,f,d] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum_empty/scalar_sum_empty.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum_empty/scalar_sum_empty.3.query.sqlpp
index 8bd634e..a0d5516 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum_empty/scalar_sum_empty.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum_empty/scalar_sum_empty.3.query.sqlpp
@@ -24,4 +24,4 @@
 use test;
 
 
-select element test.sum([]);
+select element test.coll_sum([]);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum_null/scalar_sum_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum_null/scalar_sum_null.3.query.sqlpp
index 04ecae3..fcb058c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum_null/scalar_sum_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_sum_null/scalar_sum_null.3.query.sqlpp
@@ -24,12 +24,12 @@
 use test;
 
 
-with  i8 as test.sum([test.int8('1'),test.int8('2'),test.int8('3'),null]),
-      i16 as test.sum([test.int16('1'),test.int16('2'),test.int16('3'),null]),
-      i32 as test.sum([test.int32('1'),test.int32('2'),test.int32('3'),null]),
-      i64 as test.sum([test.int64('1'),test.int64('2'),test.int64('3'),null]),
-      f as test.sum([test.float('1'),test.float('2'),test.float('3'),null]),
-      d as test.sum([test.double('1'),test.double('2'),test.double('3'),null])
+with  i8 as test.coll_sum([test.int8('1'),test.int8('2'),test.int8('3'),null]),
+      i16 as test.coll_sum([test.int16('1'),test.int16('2'),test.int16('3'),null]),
+      i32 as test.coll_sum([test.int32('1'),test.int32('2'),test.int32('3'),null]),
+      i64 as test.coll_sum([test.int64('1'),test.int64('2'),test.int64('3'),null]),
+      f as test.coll_sum([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as test.coll_sum([test.double('1'),test.double('2'),test.double('3'),null])
 select element i
 from  [i8,i16,i32,i64,f,d] as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_double/sum_double.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_double/sum_double.3.query.sqlpp
index bd7092e..e8a1f4d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_double/sum_double.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_double/sum_double.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x
     from  [1.0,2.0,3.0] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_double_null/sum_double_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_double_null/sum_double_null.3.query.sqlpp
index ed194cf..7a17bab 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_double_null/sum_double_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_double_null/sum_double_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x.doubleField
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_empty_01/sum_empty_01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_empty_01/sum_empty_01.3.query.sqlpp
index a3cab15..bfc0e2c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_empty_01/sum_empty_01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_empty_01/sum_empty_01.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x
     from  [1,2,3] as x
     where (x > 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_empty_02/sum_empty_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_empty_02/sum_empty_02.3.query.sqlpp
index 181ff0d..ce6abf4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_empty_02/sum_empty_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_empty_02/sum_empty_02.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x.val
     from  Test as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_float/sum_float.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_float/sum_float.3.query.sqlpp
index a9bceb8..8f90964 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_float/sum_float.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_float/sum_float.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x
     from  [test.float('1'),test.float('2'),test.float('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_float_null/sum_float_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_float_null/sum_float_null.3.query.sqlpp
index 30ef69c..f4c25bb 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_float_null/sum_float_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_float_null/sum_float_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x.floatField
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int16/sum_int16.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int16/sum_int16.3.query.sqlpp
index 7f8b538..57381b6 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int16/sum_int16.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int16/sum_int16.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x
     from  [test.int16('1'),test.int16('2'),test.int16('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int16_null/sum_int16_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int16_null/sum_int16_null.3.query.sqlpp
index 7b86f76..e57c3f4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int16_null/sum_int16_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int16_null/sum_int16_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x.int16Field
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int32/sum_int32.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int32/sum_int32.3.query.sqlpp
index 9c136e2..6b37fec 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int32/sum_int32.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int32/sum_int32.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x
     from  [test.int32('1'),test.int32('2'),test.int32('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int32_null/sum_int32_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int32_null/sum_int32_null.3.query.sqlpp
index 61984d7..3c6841e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int32_null/sum_int32_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int32_null/sum_int32_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x.int32Field
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64/sum_int64.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64/sum_int64.3.query.sqlpp
index d35ab0f..dca4d44 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64/sum_int64.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64/sum_int64.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x
     from  [test.int64('1'),test.int64('2'),test.int64('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_null/sum_int64_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_null/sum_int64_null.3.query.sqlpp
index 189e9f3..857e15f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_null/sum_int64_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int64_null/sum_int64_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x.int64Field
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8/sum_int8.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8/sum_int8.3.query.sqlpp
index 536a03f..25ed1a4 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8/sum_int8.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8/sum_int8.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x
     from  [test.int8('1'),test.int8('2'),test.int8('3')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8_null/sum_int8_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8_null/sum_int8_null.3.query.sqlpp
index 98922f8..473bb1a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8_null/sum_int8_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_int8_null/sum_int8_null.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element x.int8Field
     from  Numeric as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_mixed/sum_mixed.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_mixed/sum_mixed.3.query.sqlpp
index f4e1265..b8c98ef 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_mixed/sum_mixed.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_mixed/sum_mixed.3.query.sqlpp
@@ -22,7 +22,7 @@
 * Date         : Jun 2nd 2013
 */
 
-select element sum((
+select element coll_sum((
     select element x
     from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as x
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.1.ddl.sqlpp
index 2405389..66c4b53 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description      :   sum() aggregate function must return the numeric sum, when non null values are given as input to sum().
+ * Description      :   coll_sum() aggregate function must return the numeric sum, when non null values are given as input to coll_sum().
  *                  :   Get the sum for those tuples which are non null for salary fields.
  * Expected result  :   Success
  * Date             :   July 20th 2012
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.2.update.sqlpp
index a3ac94f..fdc8b57 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description      :   sum() aggregate function must return the numeric sum, when non null values are given as input to sum().
+ * Description      :   coll_sum() aggregate function must return the numeric sum, when non null values are given as input to coll_sum().
  *                  :   Get the sum for those tuples which are non null for salary fields.
  * Expected result  :   Success
  * Date             :   July 20th 2012
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.3.query.sqlpp
index 4734f53..0664250 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_null-with-pred/sum_null-with-pred.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description      :   sum() aggregate function must return the numeric sum, when non null values are given as input to sum().
+ * Description      :   coll_sum() aggregate function must return the numeric sum, when non null values are given as input to coll_sum().
  *                  :   Get the sum for those tuples which are non null for salary fields.
  * Expected result  :   Success
  * Date             :   July 20th 2012
@@ -28,7 +28,7 @@
 
 set "import-private-functions" "true";
 
-select element test.sum((
+select element test.coll_sum((
     select element l.sal
     from  tdst as l
     where test.not(test."is-null"(l.sal))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.1.ddl.sqlpp
index ed8b33c..de795e7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.1.ddl.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.1.ddl.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description      :   Add numeric values with a null value, sum() aggregate function must return null.
+ * Description      :   Add numeric values with a null value, coll_sum() aggregate function must return null.
  * Expected result  :   Success
  * Date             :   July 20th 2012
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.2.update.sqlpp
index 7f6846b..10f6c7e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.2.update.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description      :   Add numeric values with a null value, sum() aggregate function must return null.
+ * Description      :   Add numeric values with a null value, coll_sum() aggregate function must return null.
  * Expected result  :   Success
  * Date             :   July 20th 2012
  */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.3.query.sqlpp
index aa3c3da..7b771d7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_numeric_null/sum_numeric_null.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description      :   Add numeric values with a null value, sum() aggregate function must return null.
+ * Description      :   Add numeric values with a null value, coll_sum() aggregate function must return null.
  * Expected result  :   Success
  * Date             :   July 20th 2012
  */
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.sum((
+select element test.coll_sum((
     select element l.sal
     from  tdst as l
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv03/cross-dv03.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv03/cross-dv03.3.query.sqlpp
index c43f41fc..4e09b53 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv03/cross-dv03.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv03/cross-dv03.3.query.sqlpp
@@ -26,7 +26,7 @@
  * Date         : 28th Aug 2012
  */
 
-select element count((
+select element coll_count((
     select element l
     from  "Metadata.Dataset" as l
     where ((l.DataverseName = 'student') or (l.DataverseName = 'teacher'))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/freq-clerk/freq-clerk.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/freq-clerk/freq-clerk.3.query.sqlpp
index 157efa5..8ffe029 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/freq-clerk/freq-clerk.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/freq-clerk/freq-clerk.3.query.sqlpp
@@ -24,6 +24,6 @@
 from  CustomerOrders as c,
       c.orders as o
 group by o.clerk as clerk
-with  count as test.count(o)
+with  count as count(o)
 order by count,clerk desc
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/join_q_06/join_q_06.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/join_q_06/join_q_06.3.query.sqlpp
index c9e9876..413ab84 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/join_q_06/join_q_06.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/join_q_06/join_q_06.3.query.sqlpp
@@ -24,7 +24,7 @@
 
 SELECT c.name AS cust_name,
        c.cashBack AS cust_cashBack
-FROM customer c JOIN [min((SELECT ELEMENT c.cashBack FROM customer c))] as min_cashBack
+FROM customer c JOIN [coll_min((SELECT ELEMENT c.cashBack FROM customer c))] as min_cashBack
      ON c.cashBack = min_cashBack
 ORDER BY c.cid, c.name
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/join_q_07/join_q_07.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/join_q_07/join_q_07.3.query.sqlpp
index 05c71c2..5f4f07f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/join_q_07/join_q_07.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/custord/join_q_07/join_q_07.3.query.sqlpp
@@ -29,7 +29,7 @@
 
 SELECT c.name AS cust_name,
        c.cashBack AS cust_cashBack
-FROM customer c JOIN [min((SELECT ELEMENT c.cashBack FROM c c))] as min_cashBack
+FROM customer c JOIN [coll_min((SELECT ELEMENT c.cashBack FROM c c))] as min_cashBack
      ON c.cashBack = min_cashBack
 ORDER BY c.cid, c.name
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2/q2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2/q2.3.query.sqlpp
index 3b64539..f88e846 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2/q2.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2/q2.3.query.sqlpp
@@ -25,9 +25,9 @@
       event.sponsoring_sigs as sponsor
 with  es as {'event':event,'sponsor':sponsor}
 group by sponsor.sig_id as sig_id
-with  sig_sponsorship_count as test.count(es),
+with  sig_sponsorship_count as count(es),
       by_chapter as (
-      select element {'chapter_name':chapter_name,'escount':test.count(e)}
+      select element {'chapter_name':chapter_name,'escount':count(e)}
       from  es as e
       group by e.sponsor.chapter_name as chapter_name
   )
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/dml/query-issue382/query-issue382.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/dml/query-issue382/query-issue382.3.query.sqlpp
index a471812..c49b436 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/dml/query-issue382/query-issue382.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/dml/query-issue382/query-issue382.3.query.sqlpp
@@ -20,7 +20,7 @@
 use SocialNetworkData;
 
 
-select element SocialNetworkData.count((
+select element SocialNetworkData.coll_count((
     select element h
     from  HandbookUsers as h
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/failure/q01_pricing_summary_report_failure/q01_pricing_summary_report_failure.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/failure/q01_pricing_summary_report_failure/q01_pricing_summary_report_failure.3.query.sqlpp
index 38d2c9d..cac4a08 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/failure/q01_pricing_summary_report_failure/q01_pricing_summary_report_failure.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/failure/q01_pricing_summary_report_failure/q01_pricing_summary_report_failure.3.query.sqlpp
@@ -20,28 +20,28 @@
 use tpch;
 
 
-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)}
+    )),'count_order':tpch.coll_count(l)}
 from  LineItem as l
 /* +hash */
 group by l.l_returnflag as l_returnflag,l.l_linestatus as l_linestatus
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_05/feeds_05.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_05/feeds_05.3.query.sqlpp
index a7303aa..ba6c676 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_05/feeds_05.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_05/feeds_05.3.query.sqlpp
@@ -22,7 +22,7 @@
 use feeds;
 
 
-if ((feeds.count((
+if ((feeds.coll_count((
       select element x
       from  SyntheticTweets as x
   )) > 0))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_07/feeds_07.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_07/feeds_07.3.query.sqlpp
index 64e1181..7760608 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_07/feeds_07.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_07/feeds_07.3.query.sqlpp
@@ -22,7 +22,7 @@
 use feeds;
 
 
-if ((feeds.count((
+if ((feeds.coll_count((
       select element x
       from  SyntheticTweets as x
   )) > 0))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_08/feeds_08.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_08/feeds_08.3.query.sqlpp
index 64e1181..7760608 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_08/feeds_08.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_08/feeds_08.3.query.sqlpp
@@ -22,7 +22,7 @@
 use feeds;
 
 
-if ((feeds.count((
+if ((feeds.coll_count((
       select element x
       from  SyntheticTweets as x
   )) > 0))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_09/feeds_09.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_09/feeds_09.3.query.sqlpp
index e5d9ea5..3b4fbad 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_09/feeds_09.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_09/feeds_09.3.query.sqlpp
@@ -22,7 +22,7 @@
 use feeds_09;
 
 
-if ((feeds_09.count((
+if ((feeds_09.coll_count((
       select element x
       from  SyntheticTweets as x
   )) > 0))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_10/feeds_10.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_10/feeds_10.3.query.sqlpp
index 350a632..b6d486c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_10/feeds_10.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feeds_10/feeds_10.3.query.sqlpp
@@ -22,7 +22,7 @@
 use feeds_10;
 
 
-select element feeds_10.count((
+select element feeds_10.coll_count((
     select element x
     from  Tweets as x
     order by x.id
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/grpby01/grpby01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/grpby01/grpby01.3.query.sqlpp
index 8f778b4..5b44875 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/grpby01/grpby01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/grpby01/grpby01.3.query.sqlpp
@@ -22,7 +22,7 @@
  * Date             :  31st July 2012
  */
 
-select element {'store-number':strNum,'total-qty':sum((
+select element {'store-number':strNum,'total-qty':coll_sum((
         select element l.qty
         from  sales as l
     ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/grpby02/grpby02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/grpby02/grpby02.3.query.sqlpp
index 8f778b4..5b44875 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/grpby02/grpby02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/grpby02/grpby02.3.query.sqlpp
@@ -22,7 +22,7 @@
  * Date             :  31st July 2012
  */
 
-select element {'store-number':strNum,'total-qty':sum((
+select element {'store-number':strNum,'total-qty':coll_sum((
         select element l.qty
         from  sales as l
     ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.query.sqlpp
index e52dcb4..54f431b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.query.sqlpp
@@ -26,5 +26,5 @@
 from  DBLP as paper,
       fuzzyjoin."counthashed-word-tokens"(paper.title) as token
 group by token as tokenGroupped
-order by fuzzyjoin.count(paper),tokenGroupped
+order by count(paper),tokenGroupped
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.3.query.sqlpp
index 8aad0db..2dca121 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.3.query.sqlpp
@@ -37,7 +37,7 @@
           with  id as paper.id
           /* +hash */
           group by token as tokenGrouped
-          order by fuzzyjoin.count(id),tokenGrouped
+          order by count(id),tokenGrouped
       ) as tokenRanked at i
       where (tokenUnranked = tokenRanked)
       order by i
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q01/q01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q01/q01.1.ddl.sqlpp
new file mode 100644
index 0000000..a7c021b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q01/q01.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  "screen-name" : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  "message-id" : int64
+}
+
+create  table FacebookUsers(FacebookUserType) primary key id;
+create  table FacebookMessages(FacebookMessageType) primary key "message-id";
+create  table TwitterUsers(TwitterUserType) primary key "screen-name";
+create  table TweetMessages(TweetMessageType) primary key tweetid hints ("CARDINALITY"="100");
+create  index fbUserSinceIdx  on FacebookUsers ("user-since":datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages ("author-id":int64) type btree enforced;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q01/q01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q01/q01.2.update.sqlpp
new file mode 100644
index 0000000..4b757cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q01/q01.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+
+load  table FacebookUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load  table FacebookMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load  table TwitterUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load  table TweetMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q01/q01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q01/q01.3.query.sqlpp
new file mode 100644
index 0000000..abf6092
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q01/q01.3.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 TinySocial;
+
+SELECT count(u.friend_ids) count
+FROM FacebookUsers u;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q02/q02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q02/q02.1.ddl.sqlpp
new file mode 100644
index 0000000..a7c021b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q02/q02.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  "screen-name" : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  "message-id" : int64
+}
+
+create  table FacebookUsers(FacebookUserType) primary key id;
+create  table FacebookMessages(FacebookMessageType) primary key "message-id";
+create  table TwitterUsers(TwitterUserType) primary key "screen-name";
+create  table TweetMessages(TweetMessageType) primary key tweetid hints ("CARDINALITY"="100");
+create  index fbUserSinceIdx  on FacebookUsers ("user-since":datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages ("author-id":int64) type btree enforced;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q02/q02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q02/q02.2.update.sqlpp
new file mode 100644
index 0000000..4b757cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q02/q02.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+
+load  table FacebookUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load  table FacebookMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load  table TwitterUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load  table TweetMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q02/q02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q02/q02.3.query.sqlpp
new file mode 100644
index 0000000..9c00dac
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q02/q02.3.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 TinySocial;
+
+SELECT 1 foo, COUNT(u.friend_ids) count
+FROM FacebookUsers u;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q03/q03.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q03/q03.1.ddl.sqlpp
new file mode 100644
index 0000000..a7c021b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q03/q03.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  "screen-name" : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  "message-id" : int64
+}
+
+create  table FacebookUsers(FacebookUserType) primary key id;
+create  table FacebookMessages(FacebookMessageType) primary key "message-id";
+create  table TwitterUsers(TwitterUserType) primary key "screen-name";
+create  table TweetMessages(TweetMessageType) primary key tweetid hints ("CARDINALITY"="100");
+create  index fbUserSinceIdx  on FacebookUsers ("user-since":datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages ("author-id":int64) type btree enforced;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q03/q03.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q03/q03.2.update.sqlpp
new file mode 100644
index 0000000..4b757cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q03/q03.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+
+load  table FacebookUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load  table FacebookMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load  table TwitterUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load  table TweetMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q03/q03.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q03/q03.3.query.sqlpp
new file mode 100644
index 0000000..c0bf442
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q03/q03.3.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 TinySocial;
+
+SELECT COUNT(1) count
+FROM FacebookUsers u;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q04/q04.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q04/q04.1.ddl.sqlpp
new file mode 100644
index 0000000..a7c021b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q04/q04.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  "screen-name" : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  "message-id" : int64
+}
+
+create  table FacebookUsers(FacebookUserType) primary key id;
+create  table FacebookMessages(FacebookMessageType) primary key "message-id";
+create  table TwitterUsers(TwitterUserType) primary key "screen-name";
+create  table TweetMessages(TweetMessageType) primary key tweetid hints ("CARDINALITY"="100");
+create  index fbUserSinceIdx  on FacebookUsers ("user-since":datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages ("author-id":int64) type btree enforced;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q04/q04.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q04/q04.2.update.sqlpp
new file mode 100644
index 0000000..4b757cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q04/q04.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+
+load  table FacebookUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load  table FacebookMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load  table TwitterUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load  table TweetMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q04/q04.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q04/q04.3.query.sqlpp
new file mode 100644
index 0000000..4d1b4d5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q04/q04.3.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 TinySocial;
+
+SELECT COUNT([1,2,3]) count
+FROM FacebookUsers u;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q05_error/q05_error.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q05_error/q05_error.1.ddl.sqlpp
new file mode 100644
index 0000000..a7c021b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q05_error/q05_error.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  "screen-name" : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  "message-id" : int64
+}
+
+create  table FacebookUsers(FacebookUserType) primary key id;
+create  table FacebookMessages(FacebookMessageType) primary key "message-id";
+create  table TwitterUsers(TwitterUserType) primary key "screen-name";
+create  table TweetMessages(TweetMessageType) primary key tweetid hints ("CARDINALITY"="100");
+create  index fbUserSinceIdx  on FacebookUsers ("user-since":datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages ("author-id":int64) type btree enforced;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q05_error/q05_error.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q05_error/q05_error.2.update.sqlpp
new file mode 100644
index 0000000..4b757cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q05_error/q05_error.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+
+load  table FacebookUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load  table FacebookMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load  table TwitterUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load  table TweetMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q05_error/q05_error.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q05_error/q05_error.3.query.sqlpp
new file mode 100644
index 0000000..2cb755a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q05_error/q05_error.3.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 TinySocial;
+
+SELECT u.name name, COUNT(u.friend_ids) count
+FROM FacebookUsers u;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q06_error/q06_error.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q06_error/q06_error.1.ddl.sqlpp
new file mode 100644
index 0000000..a7c021b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q06_error/q06_error.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  "screen-name" : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  "message-id" : int64
+}
+
+create  table FacebookUsers(FacebookUserType) primary key id;
+create  table FacebookMessages(FacebookMessageType) primary key "message-id";
+create  table TwitterUsers(TwitterUserType) primary key "screen-name";
+create  table TweetMessages(TweetMessageType) primary key tweetid hints ("CARDINALITY"="100");
+create  index fbUserSinceIdx  on FacebookUsers ("user-since":datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages ("author-id":int64) type btree enforced;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q06_error/q06_error.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q06_error/q06_error.2.update.sqlpp
new file mode 100644
index 0000000..4b757cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q06_error/q06_error.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+
+load  table FacebookUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load  table FacebookMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load  table TwitterUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load  table TweetMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q06_error/q06_error.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q06_error/q06_error.3.query.sqlpp
new file mode 100644
index 0000000..907afb0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q06_error/q06_error.3.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 TinySocial;
+
+SELECT COLL_COUNT(u.name) count
+FROM FacebookUsers u;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q07_error/q07_error.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q07_error/q07_error.1.ddl.sqlpp
new file mode 100644
index 0000000..a7c021b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q07_error/q07_error.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  "screen-name" : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  "message-id" : int64
+}
+
+create  table FacebookUsers(FacebookUserType) primary key id;
+create  table FacebookMessages(FacebookMessageType) primary key "message-id";
+create  table TwitterUsers(TwitterUserType) primary key "screen-name";
+create  table TweetMessages(TweetMessageType) primary key tweetid hints ("CARDINALITY"="100");
+create  index fbUserSinceIdx  on FacebookUsers ("user-since":datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages ("author-id":int64) type btree enforced;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q07_error/q07_error.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q07_error/q07_error.2.update.sqlpp
new file mode 100644
index 0000000..4b757cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q07_error/q07_error.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+
+load  table FacebookUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load  table FacebookMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load  table TwitterUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load  table TweetMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q07_error/q07_error.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q07_error/q07_error.3.query.sqlpp
new file mode 100644
index 0000000..67b3d68
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q07_error/q07_error.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE TinySocial;
+
+COUNT(
+  ( SELECT u.name count
+    FROM FacebookUsers u
+  )
+);
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q08/q08.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q08/q08.1.ddl.sqlpp
new file mode 100644
index 0000000..a7c021b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q08/q08.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  database TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  "screen-name" : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  "message-id" : int64
+}
+
+create  table FacebookUsers(FacebookUserType) primary key id;
+create  table FacebookMessages(FacebookMessageType) primary key "message-id";
+create  table TwitterUsers(TwitterUserType) primary key "screen-name";
+create  table TweetMessages(TweetMessageType) primary key tweetid hints ("CARDINALITY"="100");
+create  index fbUserSinceIdx  on FacebookUsers ("user-since":datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages ("author-id":int64) type btree enforced;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q08/q08.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q08/q08.2.update.sqlpp
new file mode 100644
index 0000000..4b757cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q08/q08.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+
+load  table FacebookUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load  table FacebookMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load  table TwitterUsers using "localfs" (("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load  table TweetMessages using "localfs" (("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q08/q08.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q08/q08.3.query.sqlpp
new file mode 100644
index 0000000..d333752
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q08/q08.3.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 TinySocial;
+
+SELECT COLL_COUNT(u.friend_ids) count
+FROM FacebookUsers u;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp
index 3e16b8c..dc7ac16 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp
@@ -24,6 +24,6 @@
 GROUP BY e.deptno AS deptno GROUP AS g(e AS e)
 SELECT ELEMENT {
   'deptno': deptno,
-  'avgpay': avg( (FROM g AS i SELECT ELEMENT i.e.salary) ),
+  'avgpay': coll_avg( (FROM g AS i SELECT ELEMENT i.e.salary) ),
   'workers': (FROM g AS i SELECT ELEMENT  {'name': i.e.name, 'salary': i.e.salary})
 };
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp
index f2ce8b7..70afc46 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp
@@ -26,5 +26,5 @@
 GROUP AS eis(e AS e, i AS i, s AS s)
 SELECT ELEMENT {
       'deptId': deptId,
-      'star_cost': sum( (FROM eis AS p SELECT ELEMENT p.e.salary + p.i.bonus) )
+      'star_cost': coll_sum( (FROM eis AS p SELECT ELEMENT p.e.salary + p.i.bonus) )
 };
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp
index d0ac45b..8e6b987 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp
@@ -26,7 +26,7 @@
 GROUP AS eis(e AS e, i AS i, s AS s)
 SELECT ELEMENT {
       'deptId': deptId,
-      'avgpay': avg( (FROM eis AS g SELECT ELEMENT g.e.salary + g.i.bonus) ),
+      'avgpay': coll_avg( (FROM eis AS g SELECT ELEMENT g.e.salary + g.i.bonus) ),
       'topstar_details':
            (
                 FROM eis AS g
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp
index 11c6c6f..e647ff0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp
@@ -25,7 +25,7 @@
             GROUP BY c.tire_size AS tire_size GROUP AS g(c AS c, t AS t)
             SELECT ELEMENT {
                 'tire_size': tire_size,
-                'avg_total_price': avg(
+                'avg_total_price': coll_avg(
                                          (  FROM g AS g
                                             SELECT ELEMENT g.c.price + 4 * g.t.price
                                           )
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
index 79758e3..c695e87 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
@@ -22,5 +22,5 @@
 
 FROM Employee e
 GROUP BY e.deptno AS deptno GROUP AS g
-SELECT deptno AS deptno, avg(e.salary) AS avgpay,
+SELECT deptno AS deptno, coll_avg(e.salary) AS avgpay,
        (SELECT i.e.name AS name, i.e.salary AS salary FROM g AS i) AS workers;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp
index b488a32..e9c3326 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp
@@ -23,5 +23,5 @@
     JOIN Incentive i ON e.job_category = i.job_category
     JOIN SuperStars s ON e.id = s.id
 GROUP BY e.department_id AS deptId
-SELECT deptId as deptId, sum(e.salary + i.bonus) AS star_cost;
+SELECT deptId as deptId, coll_sum(e.salary + i.bonus) AS star_cost;
 
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
index 49dd2c0..c747382 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
@@ -24,7 +24,7 @@
     JOIN SuperStars s ON e.id = s.id
 GROUP BY e.department_id AS deptId GROUP AS eis
 SELECT deptId as deptId,
-    avg(e.salary + i.bonus) AS avgpay,
+    coll_avg(e.salary + i.bonus) AS avgpay,
     (FROM eis AS v
          SELECT v.e.id AS id, v.e.salary AS salary, v.i.bonus AS bonus
          ORDER BY v.i.bonus DESC LIMIT 3
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
index 1a7a2bf..45c3528 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
@@ -25,7 +25,7 @@
             FROM Car c JOIN Tire t ON c.tire_size = t.size
             GROUP BY c.tire_size AS tire_size GROUP AS g
             SELECT tire_size AS tire_size,
-                   avg(c.price + 4 * t.price) AS avg_total_price,
+                   coll_avg(c.price + 4 * t.price) AS avg_total_price,
                    ( FROM g AS g
                      SELECT g.c.make AS make,
                             g.c.model AS model,
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_02/hdfs_02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_02/hdfs_02.3.query.sqlpp
index 04c502a..c56d747 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_02/hdfs_02.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_02/hdfs_02.3.query.sqlpp
@@ -26,7 +26,7 @@
 use test;
 
 
-select element {'word':tok,'count':test.count(token)}
+select element {'word':tok,'count':test.coll_count(token)}
 from  TextDataset as line,
       test."word-tokens"(line.content) as token
 group by token as tok
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_03/hdfs_03.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_03/hdfs_03.3.query.sqlpp
index a83f6b9..626c849 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_03/hdfs_03.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_03/hdfs_03.3.query.sqlpp
@@ -28,7 +28,7 @@
 use test;
 
 
-select element {'word':tok,'count':test.count(token)}
+select element {'word':tok,'count':test.coll_count(token)}
 from  TextDataset as line,
       test."word-tokens"(line.content) as token
 group by token as tok
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.query.sqlpp
index 158e312..d054927 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/hdfs/hdfs_shortcircuit/hdfs_shortcircuit.3.query.sqlpp
@@ -27,7 +27,7 @@
 use test;
 
 
-select element {'word':tok,'count':test.count(token)}
+select element {'word':tok,'count':test.coll_count(token)}
 from  TextDataset as line,
       test."word-tokens"(line.content) as token
 group by token as tok
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.query.sqlpp
index 8c3eff1..a51e09a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/hints/issue_251_dataset_hint_6/issue_251_dataset_hint_6.3.query.sqlpp
@@ -27,7 +27,7 @@
 use test;
 
 
-select element {'word':tok,'count':test.count(token)}
+select element {'word':tok,'count':test.coll_count(token)}
 from  TextDataset as line,
       test."word-tokens"(line.content) as token
 group by token as tok
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/list/listify_03/listify_03.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/list/listify_03/listify_03.3.query.sqlpp
index 8f6444e..5e73b39 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/list/listify_03/listify_03.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/list/listify_03/listify_03.3.query.sqlpp
@@ -25,10 +25,10 @@
 use test;
 
 
-select element test.min(y)
+select element coll_min(y)
 from  [1,2] as x
 with  y as (
-      select element test.min(i)
+      select element coll_min(i)
       from  [[1,2,3],[10,20,30],[-2,-5,0]] as i
   )
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/load/issue289_query/issue289_query.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/load/issue289_query/issue289_query.3.query.sqlpp
index 50b4066..e3b0fc7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/load/issue289_query/issue289_query.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/load/issue289_query/issue289_query.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.count((
+select element test.coll_count((
     select element l
     from  Customers as l
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/materialization/assign-reuse/assign-reuse.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/materialization/assign-reuse/assign-reuse.3.query.sqlpp
index 390f6c9..ab4ad3d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/materialization/assign-reuse/assign-reuse.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/materialization/assign-reuse/assign-reuse.3.query.sqlpp
@@ -23,12 +23,12 @@
 with  lonelyusers as (
       select element d
       from  FacebookUsers as d
-      where (TinySocial.count(d."friend-ids") < 2)
+      where (TinySocial.coll_count(d."friend-ids") < 2)
   ),
       lonelyusers2 as (
       select element d
       from  FacebookUsers as d
-      where (TinySocial.count(d."friend-ids") < 2)
+      where (TinySocial.coll_count(d."friend-ids") < 2)
   )
 select element {'user1':{'id':l1.id,'name':l1.name},'user2':{'id':l2.id,'name':l2.name}}
 from  lonelyusers as l1,
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.query.sqlpp
index 3ff8376..924fb2c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/groupby-orderby-count/groupby-orderby-count.3.query.sqlpp
@@ -20,9 +20,9 @@
 use twitter;
 
 
-select element {'word':tok,'count':twitter.count(token)}
+select element {'word':tok,'count':twitter.coll_count(token)}
 from  TwitterData as t,
       twitter."word-tokens"(t.text) as token
 group by token as tok
-order by twitter.count(token) desc,tok
+order by twitter.coll_count(token) desc,tok
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-closed/query-issue258/query-issue258.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-closed/query-issue258/query-issue258.2.update.sqlpp
index 16c53eb..b662786 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-closed/query-issue258/query-issue258.2.update.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-closed/query-issue258/query-issue258.2.update.sqlpp
@@ -27,7 +27,7 @@
 
 
 insert into ds1
-if ((test.count((
+if ((coll_count((
       select element x
       from  ds2 as x
       where (x.id = 10)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/everysat_03/everysat_03.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/everysat_03/everysat_03.3.query.sqlpp
index 04e7bfa..f83a9e9 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/everysat_03/everysat_03.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/everysat_03/everysat_03.3.query.sqlpp
@@ -23,7 +23,7 @@
  * Date             : 5th July 2012
  */
 
-with  a as [every x in [1,2] satisfies (avg([x,1]) = 1),every x in ['1','2'] satisfies (string(x) = '1'),every x in ['1','2'] satisfies ("string-length"(x) = 1),every x in [[1,2],[10],[1,5,7,8]] satisfies (count(x) = 1),every x in [[2],[10],[8]] satisfies (count(x) = 1),every x in [true,false] satisfies boolean('true'),every x in [true,true] satisfies not(x),every x in [1,2,3],
+with  a as [every x in [1,2] satisfies (coll_avg([x,1]) = 1),every x in ['1','2'] satisfies (string(x) = '1'),every x in ['1','2'] satisfies ("string-length"(x) = 1),every x in [[1,2],[10],[1,5,7,8]] satisfies (coll_count(x) = 1),every x in [[2],[10],[8]] satisfies (coll_count(x) = 1),every x in [true,false] satisfies boolean('true'),every x in [true,true] satisfies not(x),every x in [1,2,3],
 y in [4,5,6] satisfies ((x + y) = 5),every x in [1,2,3],
 y in [4,5,6] satisfies ((x - y) = 5),every x in [1,2,3],
 y in [4,5,6] satisfies ((x * y) = 10),every x in ['ab','cd'],
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/somesat_03/somesat_03.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/somesat_03/somesat_03.3.query.sqlpp
index 61317e8..5274bb5 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/somesat_03/somesat_03.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/somesat_03/somesat_03.3.query.sqlpp
@@ -22,7 +22,7 @@
  * Date            : 6th July 2012
  */
 
-with  a as [some x in [1,2] satisfies ((x + x) = 3),some x in [1,2] satisfies ((x + x) = 2),some x in [1,2] satisfies ((x - 2) = 2),some x in [1,2] satisfies ((x - 2) = 0),some x in [1,2] satisfies ((x * 2) = 4),some x in [1,2] satisfies ((x / 2) = 1),some x in [1,2] satisfies (avg([x,1]) = 1),some x in [1,2] satisfies boolean('true'),some x in [1,2] satisfies boolean('false'),some x in [true,false] satisfies not(x),some x in [1,2] satisfies ((x = 1) or (x = 2)),some x in [1,2] satisfies ((x = 1) and ((x + 1) = 2))]
+with  a as [some x in [1,2] satisfies ((x + x) = 3),some x in [1,2] satisfies ((x + x) = 2),some x in [1,2] satisfies ((x - 2) = 2),some x in [1,2] satisfies ((x - 2) = 0),some x in [1,2] satisfies ((x * 2) = 4),some x in [1,2] satisfies ((x / 2) = 1),some x in [1,2] satisfies (coll_avg([x,1]) = 1),some x in [1,2] satisfies boolean('true'),some x in [1,2] satisfies boolean('false'),some x in [true,false] satisfies not(x),some x in [1,2] satisfies ((x = 1) or (x = 2)),some x in [1,2] satisfies ((x = 1) and ((x + 1) = 2))]
 select element i
 from  a as i
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/somesat_04/somesat_04.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/somesat_04/somesat_04.3.query.sqlpp
index c29caa7..3b284aa 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/somesat_04/somesat_04.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/somesat_04/somesat_04.3.query.sqlpp
@@ -24,7 +24,7 @@
  * Date             : 5th July 2012
  */
 
-with  a as [some x in ['foo','foobar','foot','fox'] satisfies ("string-length"(x) = 3),some x in [[5,4,3,2],[1,2,3,4,5,6,7,8],[4,2,3,4]] satisfies (count(x) = 8),some x in [1,2] satisfies ((x = 1) or (x = 2)),some x in [1,2] satisfies ((x = 1) and ((x + 1) = 2)),some x in ['A','B','C'] satisfies (x = 'A'),some x in [1,2,3],
+with  a as [some x in ['foo','foobar','foot','fox'] satisfies ("string-length"(x) = 3),some x in [[5,4,3,2],[1,2,3,4,5,6,7,8],[4,2,3,4]] satisfies (coll_count(x) = 8),some x in [1,2] satisfies ((x = 1) or (x = 2)),some x in [1,2] satisfies ((x = 1) and ((x + 1) = 2)),some x in ['A','B','C'] satisfies (x = 'A'),some x in [1,2,3],
 y in [4,5,6] satisfies ((x + y) = 5),some x in [1,2,3],
 y in [4,5,6] satisfies ((x - y) = 5),some x in [1,2,3],
 y in [4,5,6] satisfies ((x * y) = 10),some x in [1,2,3],
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/semistructured/count-nullable/count-nullable.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/semistructured/count-nullable/count-nullable.3.query.sqlpp
index b2d8f6f..7102a14 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/semistructured/count-nullable/count-nullable.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/semistructured/count-nullable/count-nullable.3.query.sqlpp
@@ -20,7 +20,7 @@
 use test;
 
 
-select element {'custage':age,'count':test.count(c)}
+select element {'custage':age,'count':test.coll_count(c)}
 from  Customers as c
 group by c.age as age
 order by age
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.query.sqlpp
index 5047af8..c25b87f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/cell-aggregation-with-filtering/cell-aggregation-with-filtering.3.query.sqlpp
@@ -26,6 +26,6 @@
       region as test.polygon('\n\t33.80503407287759,-126.41235263538363 \n\t44.9090773200516,-126.41235263538363 \n\t44.9090773200516,-87.65258701038363 \n\t33.80503407287759,-87.65258701038363')
 where (test."spatial-intersect"(t.loc,region) and (t.time > test.datetime('2011-05-15T00:00:00Z')) and (t.time < test.datetime('2011-05-16T23:59:59Z')) and test.contains(t.text,keywords))
 group by test."spatial-cell"(t.loc,test."create-point"(24.5,-125.5),3.0,3.0) as c
-with  num as test.count(t)
+with  num as test.coll_count(t)
 order by num
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/cell-aggregation/cell-aggregation.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/cell-aggregation/cell-aggregation.3.query.sqlpp
index 676457c..0d85a10 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/cell-aggregation/cell-aggregation.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/spatial/cell-aggregation/cell-aggregation.3.query.sqlpp
@@ -24,7 +24,7 @@
       select element {'cell':c,'count':num}
       from  MyData as o
       group by test."spatial-cell"(o.loc,test."create-point"(0.0,0.0),5.0,5.0) as c
-      with  num as test.count(o)
+      with  num as test.coll_count(o)
       order by num
   )
 select element g
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
index c9eb48f..782130a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temp-dataset/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
@@ -27,28 +27,28 @@
 
 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)}
+    )),'count_order':tpch.coll_count(l)}
 from  LineItem as l
 where (l.l_shipdate <= '1998-09-02')
 /* +hash */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/agg_max/agg_max.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/agg_max/agg_max.3.query.sqlpp
index 6c3ed52..b67806d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/agg_max/agg_max.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/agg_max/agg_max.3.query.sqlpp
@@ -20,19 +20,19 @@
 use test;
 
 
-{'m0':test.max((
+{'m0':test.coll_max((
     select element i.time
     from  tsdata as i
-)),'m1':test.max((
+)),'m1':test.coll_max((
     select element i.date
     from  tsdata as i
-)),'m2':test.max((
+)),'m2':test.coll_max((
     select element i.datetime
     from  tsdata as i
-)),'m3':test.max((
+)),'m3':test.coll_max((
     select element i.dtduration
     from  tsdata as i
-)),'m4':test.max((
+)),'m4':test.coll_max((
     select element i.ymduration
     from  tsdata as i
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/agg_min/agg_min.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/agg_min/agg_min.3.query.sqlpp
index 08d47ce..cfc6dd7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/agg_min/agg_min.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/agg_min/agg_min.3.query.sqlpp
@@ -20,19 +20,19 @@
 use test;
 
 
-{'m0':test.min((
+{'m0':test.coll_min((
     select element i.time
     from  tsdata as i
-)),'m1':test.min((
+)),'m1':test.coll_min((
     select element i.date
     from  tsdata as i
-)),'m2':test.min((
+)),'m2':test.coll_min((
     select element i.datetime
     from  tsdata as i
-)),'m3':test.min((
+)),'m3':test.coll_min((
     select element i.dtduration
     from  tsdata as i
-)),'m4':test.min((
+)),'m4':test.coll_min((
     select element i.ymduration
     from  tsdata as i
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.query.sqlpp
index 86fc34a..d5b3fc2 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.query.sqlpp
@@ -24,7 +24,7 @@
 use test;
 
 
-select element {'timebin':bin,'count':test.count(i2),'total_ms':test.sum((
+select element {'timebin':bin,'count':test.count(i2),'total_ms':test.coll_sum((
         select element test."ms-from-day-time-duration"(test."duration-from-interval"(test."get-overlapping-interval"(bin,i3.interval)))
         from  i2 as i3
     ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.query.sqlpp
index c996e7d..933626e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.query.sqlpp
@@ -27,10 +27,10 @@
         group by i.app as subgid
         order by subgid,multitask.count(i)
     )}
-from  multitask."overlap-bins"(multitask.interval(multitask.min((
+from  multitask."overlap-bins"(multitask.interval(multitask.coll_min((
     select element i.time
     from  logs as i
-)),multitask.max((
+)),multitask.coll_max((
     select element (i.time + multitask."duration-from-ms"((i.duration * 1000)))
     from  logs as i
 ))),multitask.time('00:00:00.000'),multitask."day-time-duration"('PT1M')) as bin
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.query.sqlpp
index 8ccf4ef..ad65788 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.query.sqlpp
@@ -21,8 +21,8 @@
 
 USE TinySocial;
 
-SELECT ELEMENT avg((
-select element "string-length"(message.message)
+SELECT ELEMENT coll_avg((
+select element LENGTH(message.message)
 FROM FacebookMessages AS message
 WHERE message."in-response-to" >= 1 and
       message."in-response-to" < 11
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.14.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.14.query.sqlpp
index 5770a46..7ca10bd 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.14.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.14.query.sqlpp
@@ -23,7 +23,7 @@
 use TinySocial;
 
 
-select element TinySocial.count((
+select element coll_count((
     select element fbu
     from  FacebookUsers as fbu
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.22.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.22.query.sqlpp
index 559658c..ac378d0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.22.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.22.query.sqlpp
@@ -23,7 +23,7 @@
 use TinySocial;
 
 
-select element TinySocial.count((
+select element coll_count((
     select element t
     from  TweetMessages as t
     where (t.tweetid = '13')
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.14.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.14.query.sqlpp
index 5770a46..7ca10bd 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.14.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.14.query.sqlpp
@@ -23,7 +23,7 @@
 use TinySocial;
 
 
-select element TinySocial.count((
+select element coll_count((
     select element fbu
     from  FacebookUsers as fbu
 ));
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.22.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.22.query.sqlpp
index 559658c..ac378d0 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.22.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.22.query.sqlpp
@@ -23,7 +23,7 @@
 use TinySocial;
 
 
-select element TinySocial.count((
+select element coll_count((
     select element t
     from  TweetMessages as t
     where (t.tweetid = '13')
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.25.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.25.query.sqlpp
index 7c22f59..a4b852d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.25.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.25.query.sqlpp
@@ -19,8 +19,8 @@
 
 USE TinySocial;
 
-SELECT ELEMENT avg((
-select element "string-length"(message.message)
+SELECT ELEMENT coll_avg((
+select element LENGTH(message.message)
 FROM FacebookMessages AS message
 WHERE message."in-response-to" >= 1 and
       message."in-response-to" < 11
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
index 94b313f..686dd30 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q01_pricing_summary_report_nt/q01_pricing_summary_report_nt.3.query.sqlpp
@@ -22,28 +22,28 @@
 
 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':COLL_SUM((
         select element i.l_quantity
         from  l as i
-    )),'sum_base_price':tpch.sum((
+    )),'sum_base_price':COLL_SUM((
         select element i.l_extendedprice
         from  l as i
-    )),'sum_disc_price':tpch.sum((
+    )),'sum_disc_price':COLL_SUM((
         select element (i.l_extendedprice * (1 - i.l_discount))
         from  l as i
-    )),'sum_charge':tpch.sum((
+    )),'sum_charge':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':COLL_AVG((
         select element i.l_quantity
         from  l as i
-    )),'ave_price':tpch.avg((
+    )),'ave_price':COLL_AVG((
         select element i.l_extendedprice
         from  l as i
-    )),'ave_disc':tpch.avg((
+    )),'ave_disc':COLL_AVG((
         select element i.l_discount
         from  l as i
-    )),'count_order':tpch.count(l)}
+    )),'count_order':COLL_COUNT(l)}
 from  LineItem as l
 where (l.l_shipdate <= '1998-09-02')
 /* +hash */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
index a55c74d..edae05b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -45,7 +45,7 @@
 };
 declare function tmp2() {
 (
-    select element {'p_partkey':p_partkey,'ps_min_supplycost':tpch.min((
+    select element {'p_partkey':p_partkey,'ps_min_supplycost':COLL_MIN((
             select element i.ps_supplycost
             from  pssrn as i
         ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
index d30c6d3..ef0d15d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q03_shipping_priority_nt/q03_shipping_priority_nt.3.query.sqlpp
@@ -27,7 +27,7 @@
 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 COLL_SUM((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  l as i
   ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.query.sqlpp
index faca581..5293499 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q04_order_priority/q04_order_priority.3.query.sqlpp
@@ -27,7 +27,7 @@
     where (l.l_commitdate < l.l_receiptdate)
 )
 };
-select element {'order_priority':o_orderpriority,'count':tpch.count(o)}
+select element {'order_priority':o_orderpriority,'count':COLL_COUNT(o)}
 from  Orders as o,
       tpch.tmp() as t
 where ((o.o_orderkey = t.o_orderkey) and (o.o_orderdate >= '1993-07-01') and (o.o_orderdate < '1993-10-01'))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
index 150e4b1..f30ccbe 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q05_local_supplier_volume/q05_local_supplier_volume.3.query.sqlpp
@@ -46,7 +46,7 @@
 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 COLL_SUM((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  o1 as i
   ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
index 9dee61f..b960393 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q06_forecast_revenue_change/q06_forecast_revenue_change.3.query.sqlpp
@@ -20,7 +20,7 @@
 use tpch;
 
 
-{'revenue':tpch.sum((
+{'revenue':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))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
index 74d3b5a..5ca7eb3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q07_volume_shipping/q07_volume_shipping.3.query.sqlpp
@@ -49,7 +49,7 @@
 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 COLL_SUM((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  locs as i
   ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.query.sqlpp
index 77d3881..b5e49f7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/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':(COLL_SUM((
           select element tpch."switch-case"((i.s_name = 'BRAZIL'),true,i.revenue,false,0.0)
           from  t as i
-      )) / tpch.sum((
+      )) / COLL_SUM((
           select element i.revenue
           from  t as i
       )))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
index f7e2e8f..2ea88c9 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q09_product_type_profit_nt/q09_product_type_profit_nt.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/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':COLL_SUM((
         select element pr.amount
         from  profit as pr
     ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.query.sqlpp
index f75030c..cce248c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q10_returned_item/q10_returned_item.3.query.sqlpp
@@ -34,7 +34,7 @@
     where ((l.l_orderkey = ocn.o_orderkey) and (l.l_selectflag = '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 COLL_SUM((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  locn as i
   ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
index f75030c..cce248c 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q10_returned_item_int64/q10_returned_item_int64.3.query.sqlpp
@@ -34,7 +34,7 @@
     where ((l.l_orderkey = ocn.o_orderkey) and (l.l_selectflag = '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 COLL_SUM((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  locn as i
   ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.query.sqlpp
index ea3bd5a..6956c4b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q11_important_stock/q11_important_stock.3.query.sqlpp
@@ -20,7 +20,7 @@
 use tpch;
 
 
-with  sum as tpch.sum((
+with  sum as COLL_SUM((
       select element (ps.ps_supplycost * ps.ps_availqty)
       from  Partsupp as ps,
             (
@@ -33,7 +33,7 @@
   ))
 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':COLL_SUM((
             select element (i.ps_supplycost * i.ps_availqty)
             from  ps as i
         ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.query.sqlpp
index 61b685e..233ec2f 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/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':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':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
     ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
index afa7c9b..bf01ff7 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -24,12 +24,12 @@
 
 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':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%')))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index a8f29d3..3b15a4d 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -20,10 +20,10 @@
 use tpch;
 
 
-select element (100.0 * tpch.sum((
-      select element tpch."switch-case"(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
+select element (100.0 * COLL_SUM((
+      select element tpch."switch-case"(LIKE(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
       from  lp as i
-  )) / tpch.sum((
+  )) / COLL_SUM((
       select element (i.l_extendedprice * (1 - i.l_discount))
       from  lp as i
   )))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.query.sqlpp
index e21104b..70b5d38 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q15_top_supplier/q15_top_supplier.3.query.sqlpp
@@ -22,7 +22,7 @@
 
 declare function revenue() {
 (
-    select element {'supplier_no':l_suppkey,'total_revenue':tpch.sum((
+    select element {'supplier_no':l_suppkey,'total_revenue':COLL_SUM((
             select element (i.l_extendedprice * (1 - i.l_discount))
             from  l as i
         ))}
@@ -31,7 +31,7 @@
     group by l.l_suppkey as l_suppkey
 )
 };
-with  m as tpch.max((
+with  m as COLL_MAX((
       select element r2.total_revenue
       from  tpch.revenue() as r2
   ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
index cc4d01a..b9fa20e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
@@ -27,10 +27,10 @@
         select element {'p_brand':p.p_brand,'p_type':p.p_type,'p_size':p.p_size,'ps_suppkey':ps.ps_suppkey}
         from  Partsupp as ps,
               Part as p
-        where ((p.p_partkey = ps.ps_partkey) and (p.p_brand != 'Brand#45') and tpch.not(tpch.like(p.p_type,'MEDIUM POLISHED%')))
+        where ((p.p_partkey = ps.ps_partkey) and (p.p_brand != 'Brand#45') and NOT(tpch.like(p.p_type,'MEDIUM POLISHED%')))
     ) as psp,
           Supplier as s
-    where ((psp.ps_suppkey = s.s_suppkey) and tpch.not(tpch.like(s.s_comment,'%Customer%Complaints%')))
+    where ((psp.ps_suppkey = s.s_suppkey) and tpch.not(LIKE(s.s_comment,'%Customer%Complaints%')))
 )
 };
 select element {'p_brand':p_brand,'p_type':p_type,'p_size':p_size,'supplier_cnt':supplier_cnt}
@@ -41,7 +41,7 @@
     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
   ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
index ada4f75..d39c75a 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q17_large_gby_variant/q17_large_gby_variant.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/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':COLL_COUNT(l),'t_avg_quantity':(0.2 * COLL_AVG((
           select element i.l_quantity
           from  l as i
-      ))),'t_max_suppkey':tpch.max((
+      ))),'t_max_suppkey':COLL_MAX((
         select element i.l_suppkey
         from  l as i
-    )),'t_max_linenumber':tpch.max((
+    )),'t_max_linenumber':COLL_MAX((
         select element i.l_linenumber
         from  l as i
-    )),'t_avg_extendedprice':tpch.avg((
+    )),'t_avg_extendedprice':COLL_AVG((
         select element i.l_extendedprice
         from  l as i
-    )),'t_avg_discount':tpch.avg((
+    )),'t_avg_discount':COLL_AVG((
         select element i.l_discount
         from  l as i
-    )),'t_avg_tax':tpch.avg((
+    )),'t_avg_tax':COLL_AVG((
         select element i.l_tax
         from  l as i
-    )),'t_max_shipdate':tpch.max((
+    )),'t_max_shipdate':COLL_MAX((
         select element i.l_shipdate
         from  l as i
-    )),'t_min_commitdate':tpch.min((
+    )),'t_min_commitdate':COLL_MIN((
         select element i.l_commitdate
         from  l as i
-    )),'t_min_receiptdate':tpch.min((
+    )),'t_min_receiptdate':COLL_MIN((
         select element i.l_receiptdate
         from  l as i
-    )),'t_max_comment':tpch.max((
+    )),'t_max_comment':COLL_MAX((
         select element i.l_comment
         from  l as i
     ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
index 5aa971e..2f48cf3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
@@ -22,7 +22,7 @@
 
 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 * COLL_AVG((
               select element i.l_quantity
               from  l as i
           )))}
@@ -31,7 +31,7 @@
 )
 };
 
-select element (tpch.sum((
+select element (COLL_SUM((
       select element l.l_extendedprice
       from  LineItem as l,
             Part as p,
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
index 15081ff..5215013 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q18_large_volume_customer/q18_large_volume_customer.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/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':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':COLL_SUM((
             select element i.l_quantity
             from  l as i
         ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
index 7065f87..2a43931 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
@@ -22,7 +22,7 @@
 
 set "import-private-functions" "true";
 
-select element tpch.sum((
+select element COLL_SUM((
     select element (l.l_extendedprice * (1 - l.l_discount))
     from  LineItem as l,
           Part as p
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
index 0657ad3..2bc3b25 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q20_potential_part_promotion/q20_potential_part_promotion.3.query.sqlpp
@@ -24,7 +24,7 @@
 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 * COLL_SUM((
                   select element i.l_quantity
                   from  l as i
               )))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/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-sql-like/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp
index 5382019..578d72e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/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-sql-like/q21_suppliers_who_kept_orders_waiting/q21_suppliers_who_kept_orders_waiting.3.query.sqlpp
@@ -22,10 +22,10 @@
 
 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 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':COLL_MAX((
             select element i.l_suppkey
             from  l2 as i
         ))}
@@ -75,6 +75,6 @@
     where ((t2.count_suppkey >= 0) and (t3.l_orderkey = t2.l_orderkey))
 ) as t4
 group by t4.s_name as s_name
-with  numwait as tpch.count(t4)
+with  numwait as COLL_COUNT(t4)
 order by numwait desc,s_name
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
index 6136008..274adbc 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q22_global_sales_opportunity/q22_global_sales_opportunity.3.query.sqlpp
@@ -22,16 +22,16 @@
 
 declare function q22_customer_tmp() {
 (
-    select element {'c_acctbal':c.c_acctbal,'c_custkey':c.c_custkey,'cntrycode':tpch.substring(c.c_phone,1,2)}
+    select element {'c_acctbal':c.c_acctbal,'c_custkey':c.c_custkey,'cntrycode':SUBSTR(c.c_phone,1,2)}
     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':COLL_COUNT(ct),'totacctbal':COLL_SUM((
         select element i.c_acctbal
         from  ct as i
     ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue601/query-issue601.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue601/query-issue601.3.query.sqlpp
index 44852ec..733924e 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue601/query-issue601.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue601/query-issue601.3.query.sqlpp
@@ -26,7 +26,7 @@
 use tpch;
 
 
-select element {'l_linenumber':l_linenumber,'count_order':tpch.count(l)}
+select element {'l_linenumber':l_linenumber,'count_order':COLL_COUNT(l)}
 from  LineItem as l
 group by l.l_linenumber as l_linenumber
 ;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue638/query-issue638.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue638/query-issue638.3.query.sqlpp
index d2e8a7e..78bc3cd 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue638/query-issue638.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue638/query-issue638.3.query.sqlpp
@@ -26,7 +26,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':COLL_SUM((
         select element pr.amount
         from  profit as pr
     ))}
@@ -52,7 +52,7 @@
             ) as l1
             where ((ps.ps_suppkey = l1.l_suppkey) and (ps.ps_partkey = l1.l_partkey))
         ) as l2
-        where (tpch.contains(p.p_name,'green') and (p.p_partkey = l2.l_partkey))
+        where (CONTAINS(p.p_name,'green') and (p.p_partkey = l2.l_partkey))
     ) as l3
     with  amount as ((l3.l_extendedprice * (1 - l3.l_discount)) - (l3.ps_supplycost * l3.l_quantity)),
           o_year as tpch."get-year"(o.o_orderdate)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue785-2/query-issue785-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue785-2/query-issue785-2.3.query.sqlpp
index 341d824..0127261 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue785-2/query-issue785-2.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue785-2/query-issue785-2.3.query.sqlpp
@@ -39,7 +39,7 @@
             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 COLL_SUM((
             select element o.o_totalprice
             from  orders as o
         ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue785/query-issue785.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue785/query-issue785.3.query.sqlpp
index 0f31629..db98f32 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue785/query-issue785.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue785/query-issue785.3.query.sqlpp
@@ -30,7 +30,7 @@
         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 COLL_SUM((
               select element s.sum_price
               from  i as s
           ))
@@ -38,7 +38,7 @@
         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':COLL_SUM((
             select element o.o_totalprice
             from  orders as o
         ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue786/query-issue786.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue786/query-issue786.3.query.sqlpp
index c35853c..7098a55 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue786/query-issue786.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/query-issue786/query-issue786.3.query.sqlpp
@@ -32,7 +32,7 @@
               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 COLL_SUM((
               select element o.o_totalprice
               from  orders as o
           ))
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
index ba4f3e8..77ad1b6 100644
--- 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
@@ -20,15 +20,14 @@
 use tpch;
 
 
-{'revenue':sum(
+{'revenue':
       (
-        SELECT ELEMENT l.l_extendedprice * l.l_discount
+        SELECT ELEMENT SUM(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
-      )
-    )
+      )[0]
 };
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.3.query.sqlpp
index 0e84e68..6faf579 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q11_important_stock/q11_important_stock.3.query.sqlpp
@@ -20,9 +20,8 @@
 use tpch;
 
 
-WITH sum as sum(
-     (
-      SELECT ELEMENT ps.ps_supplycost * ps.ps_availqty
+WITH sum as (
+      SELECT ELEMENT SUM(ps.ps_supplycost * ps.ps_availqty)
       FROM  Partsupp AS ps,
             (
                 SELECT s.s_suppkey s_suppkey
@@ -31,8 +30,7 @@
                 WHERE s.s_nationkey = n.n_nationkey
             ) AS sn
       WHERE ps.ps_suppkey = sn.s_suppkey
-     )
-)
+)[0]
 
 SELECT t1.ps_partkey AS partkey,
        t1.part_value AS part_value
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
index 24794de..e069759 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -24,7 +24,7 @@
         SELECT c_custkey AS c_custkey, sum(co.o_orderkey_count) AS c_count
         FROM  (
                 SELECT c.c_custkey AS c_custkey,
-                       count(
+                       coll_count(
                            (
                             select element o.o_orderkey
                             from  Orders as o
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.3.query.sqlpp
index 1a036cc..d75a39b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q15_top_supplier/q15_top_supplier.3.query.sqlpp
@@ -30,10 +30,11 @@
 )
 };
 
-WITH  m AS max((
-      SELECT ELEMENT r2.total_revenue
+WITH  m AS (
+      SELECT ELEMENT max(r2.total_revenue)
       FROM revenue() r2
-))
+)[0]
+
 SELECT s.s_suppkey s_suppkey,
        s.s_name s_name,
        s.s_address s_address,
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
index 4519fa6..63a33ce 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q17_small_quantity_order_revenue/q17_small_quantity_order_revenue.3.query.sqlpp
@@ -27,11 +27,10 @@
     GROUP BY l.l_partkey AS l_partkey
 )
 
-SELECT ELEMENT sum((
-      SELECT ELEMENT l.l_extendedprice
-      FROM  tmp t,
+SELECT ELEMENT SUM(l.l_extendedprice) / 7.0
+FROM  tmp t,
             LineItem l,
             Part p
-      WHERE p.p_partkey = l.l_partkey AND p.p_container = 'MED BOX'
+WHERE p.p_partkey = l.l_partkey AND p.p_container = 'MED BOX'
             AND l.l_partkey = t.t_partkey AND l.l_quantity < t.t_avg_quantity
-  )) / 7.0;
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
index 558786c..1003b48 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q19_discounted_revenue/q19_discounted_revenue.3.query.sqlpp
@@ -21,12 +21,10 @@
 
 set "import-private-functions" "true";
 
-sum(
-(
-  SELECT ELEMENT l.l_extendedprice * (1 - l.l_discount)
-  FROM LineItem l
-  JOIN Part p
-  ON p.p_partkey = l.l_partkey
+SELECT ELEMENT SUM(l.l_extendedprice * (1 - l.l_discount))
+FROM LineItem l
+JOIN Part p
+ON p.p_partkey = l.l_partkey
   WHERE
   (
     p.p_brand = 'Brand#12'
@@ -54,5 +52,4 @@
     AND "reg-exp"(l.l_shipmode, 'AIR||AIR REG')
     AND l.l_shipinstruct = 'DELIVER IN PERSON'
   )
- )
-);
+;
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-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 @@
 )
 };
 
-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
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 @@
 
 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
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 @@
 
 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'
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 @@
 
 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
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 @@
 
 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 */
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 @@
               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
           ))
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 @@
               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
           ))
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 @@
 
 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)}
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 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
         ))}
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 @@
 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
   ))
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 @@
 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
   ))
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))
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 @@
 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
   ))
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
       )))}
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
     ))}
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 @@
     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
   ))
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 @@
     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
   ))
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 @@
   ))
 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
         ))}
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
     ))}
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 @@
 
 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%')))
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
   )))
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 @@
 
 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 @@
     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
   ))
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 @@
     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
   ))
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
     ))}
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 @@
 
 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 @@
 )
 };
 
-select element (tpch.sum((
+select element (tpch.coll_sum((
       select element l.l_extendedprice
       from  tpch.tmp() as t,
             LineItem as l,
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
         ))}
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 @@
 
 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
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 @@
 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
               )))}
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 @@
 
 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 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
         ))}
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 @@
     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
     ))}
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 @@
     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)
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 @@
             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
         ))
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 {'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 @@
         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
         ))}
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 @@
               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
           ))
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 */
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 */
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 */
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
 ))};
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
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 @@
               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
           ))
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 @@
               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
           ))
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 @@
 
 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)}
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 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
         ))}
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 @@
 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
   ))
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 @@
 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
   ))
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
+;
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..1da2a8a6
--- /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
+;
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 @@
 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
   ))
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
       )))}
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
     ))}
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 @@
     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
   ))
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 @@
     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
   ))
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 @@
   ))
 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
         ))}
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
     ))}
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 @@
 
 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%')))
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
   )))
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 @@
 
 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 @@
     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
   ))
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 @@
     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
   ))
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
     ))}
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 @@
 
 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 @@
 )
 };
 
-select element (tpch.sum((
+select element (tpch.coll_sum((
       select element l.l_extendedprice
       from  tpch.tmp() as t,
             LineItem as l,
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
         ))}
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 @@
 
 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
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 @@
 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
               )))}
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 @@
 
 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 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
         ))}
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 @@
     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
     ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue562/query-issue562.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue562/query-issue562.3.query.sqlpp
index ac54a30..eaac9ce 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue562/query-issue562.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue562/query-issue562.3.query.sqlpp
@@ -34,18 +34,18 @@
     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)
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue638/query-issue638.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue638/query-issue638.3.query.sqlpp
index 6c14062..3a42722 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue638/query-issue638.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue638/query-issue638.3.query.sqlpp
@@ -26,7 +26,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
     ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue785-2/query-issue785-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue785-2/query-issue785-2.3.query.sqlpp
index 2cad6ea..de434ef 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue785-2/query-issue785-2.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue785-2/query-issue785-2.3.query.sqlpp
@@ -39,7 +39,7 @@
             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
         ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue785/query-issue785.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue785/query-issue785.3.query.sqlpp
index ed649ca..c7761f3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue785/query-issue785.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue785/query-issue785.3.query.sqlpp
@@ -30,7 +30,7 @@
         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 @@
         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
         ))}
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue786/query-issue786.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue786/query-issue786.3.query.sqlpp
index dead643..37e3c92 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue786/query-issue786.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue786/query-issue786.3.query.sqlpp
@@ -32,7 +32,7 @@
               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
           ))
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue810-2/query-issue810-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue810-2/query-issue810-2.3.query.sqlpp
index 16d3fe0..d75ea7b 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue810-2/query-issue810-2.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/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 */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue810-3/query-issue810-3.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue810-3/query-issue810-3.3.query.sqlpp
index 576192d..f2656ee 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue810-3/query-issue810-3.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/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 */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue810/query-issue810.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue810/query-issue810.3.query.sqlpp
index 01e1654..f4638f2 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue810/query-issue810.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/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 */
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue827-2/query-issue827-2.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue827-2/query-issue827-2.3.query.sqlpp
index 562f78f..aefe8a3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue827-2/query-issue827-2.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/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
 ))};
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue827/query-issue827.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue827/query-issue827.3.query.sqlpp
index d056bcb..e735107 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/query-issue827/query-issue827.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/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
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue489/query-issue489.2.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue489/query-issue489.2.query.sqlpp
index 420933a..fad2f76 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue489/query-issue489.2.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue489/query-issue489.2.query.sqlpp
@@ -23,7 +23,7 @@
  * Date         : 31st May 2013
  */
 
-select element count((
+select element coll_count((
     select element x
     from  "Metadata.Function" as x
     where (x.DataverseName = 'test')
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue489/query-issue489.4.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue489/query-issue489.4.query.sqlpp
index 420933a..fad2f76 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue489/query-issue489.4.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue489/query-issue489.4.query.sqlpp
@@ -23,7 +23,7 @@
  * Date         : 31st May 2013
  */
 
-select element count((
+select element coll_count((
     select element x
     from  "Metadata.Function" as x
     where (x.DataverseName = 'test')
diff --git a/asterix-app/src/test/resources/runtimets/results/global-aggregate/q01/q01.1.adm b/asterix-app/src/test/resources/runtimets/results/global-aggregate/q01/q01.1.adm
new file mode 100644
index 0000000..8e357b8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/global-aggregate/q01/q01.1.adm
@@ -0,0 +1 @@
+{ "count": 10 }
diff --git a/asterix-app/src/test/resources/runtimets/results/global-aggregate/q02/q02.1.adm b/asterix-app/src/test/resources/runtimets/results/global-aggregate/q02/q02.1.adm
new file mode 100644
index 0000000..0d74afe
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/global-aggregate/q02/q02.1.adm
@@ -0,0 +1 @@
+{ "foo": 1, "count": 10 }
diff --git a/asterix-app/src/test/resources/runtimets/results/global-aggregate/q08/q08.1.adm b/asterix-app/src/test/resources/runtimets/results/global-aggregate/q08/q08.1.adm
new file mode 100644
index 0000000..c61d241
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/global-aggregate/q08/q08.1.adm
@@ -0,0 +1,10 @@
+{ "count": 0 }
+{ "count": 0 }
+{ "count": 0 }
+{ "count": 0 }
+{ "count": 0 }
+{ "count": 0 }
+{ "count": 0 }
+{ "count": 0 }
+{ "count": 0 }
+{ "count": 0 }
diff --git a/asterix-app/src/test/resources/runtimets/results/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.2.adm b/asterix-app/src/test/resources/runtimets/results/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.2.adm
new file mode 100644
index 0000000..cebc6b5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.2.adm
@@ -0,0 +1 @@
+{ "count": 116 }
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast
index 592238f..c8abf8d 100644
--- a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.3.ast
@@ -1,78 +1,86 @@
 DataverseUse tpch
 Query:
-RecordConstructor [
+SELECT [
+FunctionCall tpch.sum@1[
   (
-    LiteralExpr [STRING] [revenue]
-    :
-    FunctionCall tpch.sum@1[
-      (
-        SELECT ELEMENT [
-        OperatorExpr [
-          FieldAccessor [
-            Variable [ Name=$l ]
-            Field=l_extendedprice
-          ]
-          *
-          FieldAccessor [
-            Variable [ Name=$l ]
-            Field=l_discount
-          ]
+    SELECT ELEMENT [
+    OperatorExpr [
+      FieldAccessor [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
         ]
+        Field=l_extendedprice
+      ]
+      *
+      FieldAccessor [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=l
         ]
-        FROM [          FunctionCall Metadata.dataset@1[
-            LiteralExpr [STRING] [LineItem]
-          ]
-          AS
-          Variable [ Name=$l ]
-        ]
-        Where
-          OperatorExpr [
-            OperatorExpr [
-              FieldAccessor [
-                Variable [ Name=$l ]
-                Field=l_shipdate
-              ]
-              >=
-              LiteralExpr [STRING] [1994-01-01]
-            ]
-            and
-            OperatorExpr [
-              FieldAccessor [
-                Variable [ Name=$l ]
-                Field=l_shipdate
-              ]
-              <
-              LiteralExpr [STRING] [1995-01-01]
-            ]
-            and
-            OperatorExpr [
-              FieldAccessor [
-                Variable [ Name=$l ]
-                Field=l_discount
-              ]
-              >=
-              LiteralExpr [DOUBLE] [0.05]
-            ]
-            and
-            OperatorExpr [
-              FieldAccessor [
-                Variable [ Name=$l ]
-                Field=l_discount
-              ]
-              <=
-              LiteralExpr [DOUBLE] [0.07]
-            ]
-            and
-            OperatorExpr [
-              FieldAccessor [
-                Variable [ Name=$l ]
-                Field=l_quantity
-              ]
-              <
-              LiteralExpr [LONG] [24]
-            ]
-          ]
-      )
+        Field=l_discount
+      ]
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS
+      Variable [ Name=#2 ]
     ]
   )
 ]
+revenue
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [LineItem]
+  ]
+  AS
+  Variable [ Name=$l ]
+]
+Where
+  OperatorExpr [
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_shipdate
+      ]
+      >=
+      LiteralExpr [STRING] [1994-01-01]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_shipdate
+      ]
+      <
+      LiteralExpr [STRING] [1995-01-01]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_discount
+      ]
+      >=
+      LiteralExpr [DOUBLE] [0.05]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_discount
+      ]
+      <=
+      LiteralExpr [DOUBLE] [0.07]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_quantity
+      ]
+      <
+      LiteralExpr [LONG] [24]
+    ]
+  ]
+Group All
diff --git a/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.4.ast b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.4.ast
new file mode 100644
index 0000000..420bd44
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q06_forecast_revenue_change/q06_forecast_revenue_change.4.ast
@@ -0,0 +1,73 @@
+DataverseUse tpch
+Query:
+SELECT [
+FunctionCall tpch.count@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      Variable [ Name=#2 ]
+      Field=l
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS
+      Variable [ Name=#2 ]
+    ]
+  )
+]
+count
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [LineItem]
+  ]
+  AS
+  Variable [ Name=$l ]
+]
+Where
+  OperatorExpr [
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_shipdate
+      ]
+      >=
+      LiteralExpr [STRING] [1994-01-01]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_shipdate
+      ]
+      <
+      LiteralExpr [STRING] [1995-01-01]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_discount
+      ]
+      >=
+      LiteralExpr [DOUBLE] [0.05]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_discount
+      ]
+      <=
+      LiteralExpr [DOUBLE] [0.07]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$l ]
+        Field=l_quantity
+      ]
+      <
+      LiteralExpr [LONG] [24]
+    ]
+  ]
+Group All
diff --git a/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index f5bb7ce..f9d1a0e 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -2253,6 +2253,51 @@
             </compilation-unit>
         </test-case>
     </test-group> -->
+    <test-group name="global-aggregate">
+        <test-case FilePath="global-aggregate">
+            <compilation-unit name="q01">
+                <output-dir compare="Text">q01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="global-aggregate">
+            <compilation-unit name="q02">
+                <output-dir compare="Text">q02</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="global-aggregate">
+            <compilation-unit name="q03">
+                <output-dir compare="Text">q01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="global-aggregate">
+            <compilation-unit name="q04">
+                <output-dir compare="Text">q01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="global-aggregate">
+            <compilation-unit name="q05_error">
+                <output-dir compare="Text">q01</output-dir>
+                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Unsupported type</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="global-aggregate">
+            <compilation-unit name="q06_error">
+                <output-dir compare="Text">q01</output-dir>
+                <expected-error>Caused by: org.apache.asterix.common.exceptions.AsterixException: Unsupported type: STRING</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="global-aggregate">
+            <compilation-unit name="q07_error">
+                <output-dir compare="Text">q01</output-dir>
+                <expected-error>org.apache.asterix.common.exceptions.AsterixException: COUNT is a SQL-92 aggregate function. The SQL++ core aggregate function coll_count could potentially express the intent.</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="global-aggregate">
+            <compilation-unit name="q08">
+                <output-dir compare="Text">q08</output-dir>
+            </compilation-unit>
+        </test-case>
+    </test-group>
     <test-group name="group-by">
         <test-case FilePath="group-by">
             <compilation-unit name="core-01">