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-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
index 49e9399..9cbc88a 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
@@ -725,33 +725,7 @@
@Override
public Pair<ILogicalOperator, LogicalVariable> visit(GroupbyClause gc, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
- GroupByOperator gOp = new GroupByOperator();
Mutable<ILogicalOperator> topOp = tupSource;
- for (GbyVariableExpressionPair ve : gc.getGbyPairList()) {
- LogicalVariable v;
- VariableExpr vexpr = ve.getVar();
- if (vexpr != null) {
- v = context.newVar(vexpr);
- } else {
- v = context.newVar();
- }
- Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(ve.getExpr(), topOp);
- gOp.addGbyExpression(v, eo.first);
- topOp = eo.second;
- }
- for (GbyVariableExpressionPair ve : gc.getDecorPairList()) {
- LogicalVariable v;
- VariableExpr vexpr = ve.getVar();
- if (vexpr != null) {
- v = context.newVar(vexpr);
- } else {
- v = context.newVar();
- }
- Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(ve.getExpr(), topOp);
- gOp.addDecorExpression(v, eo.first);
- topOp = eo.second;
- }
-
if (gc.hasGroupVar()) {
List<Pair<Expression, Identifier>> groupFieldList = gc.getGroupFieldList();
List<Mutable<ILogicalExpression>> groupRecordConstructorArgList = new ArrayList<>();
@@ -770,29 +744,75 @@
groupVarAssignOp.getInputs().add(topOp);
topOp = new MutableObject<ILogicalOperator>(groupVarAssignOp);
}
+ if (gc.isGroupAll()) {
+ List<LogicalVariable> aggVars = new ArrayList<>();
+ List<Mutable<ILogicalExpression>> aggFuncs = new ArrayList<>();
+ for (VariableExpr var : gc.getWithVarList()) {
+ LogicalVariable aggVar = context.newVar();
+ LogicalVariable oldVar = context.getVar(var);
+ List<Mutable<ILogicalExpression>> flArgs = new ArrayList<Mutable<ILogicalExpression>>();
+ flArgs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(oldVar)));
+ AggregateFunctionCallExpression fListify = AsterixBuiltinFunctions
+ .makeAggregateFunctionExpression(AsterixBuiltinFunctions.LISTIFY, flArgs);
+ aggVars.add(aggVar);
+ aggFuncs.add(new MutableObject<ILogicalExpression>(fListify));
+ // Hide the variable that was part of the "with", replacing it with
+ // the one bound by the aggregation op.
+ context.setVar(var, aggVar);
+ }
+ AggregateOperator aggOp = new AggregateOperator(aggVars, aggFuncs);
+ aggOp.getInputs().add(topOp);
+ return new Pair<ILogicalOperator, LogicalVariable>(aggOp, null);
+ } else {
+ GroupByOperator gOp = new GroupByOperator();
+ for (GbyVariableExpressionPair ve : gc.getGbyPairList()) {
+ LogicalVariable v;
+ VariableExpr vexpr = ve.getVar();
+ if (vexpr != null) {
+ v = context.newVar(vexpr);
+ } else {
+ v = context.newVar();
+ }
+ Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(ve.getExpr(), topOp);
+ gOp.addGbyExpression(v, eo.first);
+ topOp = eo.second;
+ }
+ for (GbyVariableExpressionPair ve : gc.getDecorPairList()) {
+ LogicalVariable v;
+ VariableExpr vexpr = ve.getVar();
+ if (vexpr != null) {
+ v = context.newVar(vexpr);
+ } else {
+ v = context.newVar();
+ }
+ Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = langExprToAlgExpression(ve.getExpr(), topOp);
+ gOp.addDecorExpression(v, eo.first);
+ topOp = eo.second;
+ }
- gOp.getInputs().add(topOp);
- for (VariableExpr var : gc.getWithVarList()) {
- LogicalVariable aggVar = context.newVar();
- LogicalVariable oldVar = context.getVar(var);
- List<Mutable<ILogicalExpression>> flArgs = new ArrayList<Mutable<ILogicalExpression>>(1);
- flArgs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(oldVar)));
- AggregateFunctionCallExpression fListify = AsterixBuiltinFunctions
- .makeAggregateFunctionExpression(AsterixBuiltinFunctions.LISTIFY, flArgs);
- AggregateOperator agg = new AggregateOperator(mkSingletonArrayList(aggVar),
- (List) mkSingletonArrayList(new MutableObject<ILogicalExpression>(fListify)));
+ gOp.getInputs().add(topOp);
+ for (VariableExpr var : gc.getWithVarList()) {
+ LogicalVariable aggVar = context.newVar();
+ LogicalVariable oldVar = context.getVar(var);
+ List<Mutable<ILogicalExpression>> flArgs = new ArrayList<Mutable<ILogicalExpression>>(1);
+ flArgs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(oldVar)));
+ AggregateFunctionCallExpression fListify = AsterixBuiltinFunctions
+ .makeAggregateFunctionExpression(AsterixBuiltinFunctions.LISTIFY, flArgs);
+ AggregateOperator agg = new AggregateOperator(mkSingletonArrayList(aggVar),
+ (List) mkSingletonArrayList(new MutableObject<ILogicalExpression>(fListify)));
- agg.getInputs().add(new MutableObject<ILogicalOperator>(
- new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(gOp))));
- ILogicalPlan plan = new ALogicalPlanImpl(new MutableObject<ILogicalOperator>(agg));
- gOp.getNestedPlans().add(plan);
- // Hide the variable that was part of the "with", replacing it with
- // the one bound by the aggregation op.
- context.setVar(var, aggVar);
+ agg.getInputs().add(new MutableObject<ILogicalOperator>(
+ new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(gOp))));
+ ILogicalPlan plan = new ALogicalPlanImpl(new MutableObject<ILogicalOperator>(agg));
+ gOp.getNestedPlans().add(plan);
+ // Hide the variable that was part of the "with", replacing it with
+ // the one bound by the aggregation op.
+ context.setVar(var, aggVar);
+ }
+ gOp.getAnnotations().put(OperatorAnnotations.USE_HASH_GROUP_BY, gc.hasHashGroupByHint());
+ return new Pair<ILogicalOperator, LogicalVariable>(gOp, null);
}
- gOp.getAnnotations().put(OperatorAnnotations.USE_HASH_GROUP_BY, gc.hasHashGroupByHint());
- return new Pair<ILogicalOperator, LogicalVariable>(gOp, null);
}
@Override
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">
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java
index 50e0ae2..b5d78e2 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java
@@ -38,6 +38,7 @@
private VariableExpr groupVar;
private List<Pair<Expression, Identifier>> groupFieldList = new ArrayList<Pair<Expression, Identifier>>();
private boolean hashGroupByHint;
+ private boolean groupAll;
public GroupbyClause() {
}
@@ -45,6 +46,12 @@
public GroupbyClause(List<GbyVariableExpressionPair> gbyPairList, List<GbyVariableExpressionPair> decorPairList,
List<VariableExpr> withVarList, VariableExpr groupVarExpr,
List<Pair<Expression, Identifier>> groupFieldList, boolean hashGroupByHint) {
+ this(gbyPairList, decorPairList, withVarList, groupVarExpr, groupFieldList, hashGroupByHint, false);
+ }
+
+ public GroupbyClause(List<GbyVariableExpressionPair> gbyPairList, List<GbyVariableExpressionPair> decorPairList,
+ List<VariableExpr> withVarList, VariableExpr groupVarExpr,
+ List<Pair<Expression, Identifier>> groupFieldList, boolean hashGroupByHint, boolean groupAll) {
this.gbyPairList = gbyPairList;
this.decorPairList = decorPairList;
this.withVarList = withVarList;
@@ -53,6 +60,7 @@
this.groupFieldList = groupFieldList;
}
this.hashGroupByHint = hashGroupByHint;
+ this.groupAll = groupAll;
}
public List<GbyVariableExpressionPair> getGbyPairList() {
@@ -128,4 +136,8 @@
public boolean hasGroupFieldList() {
return groupFieldList != null && groupFieldList.size() > 0;
}
+
+ public boolean isGroupAll() {
+ return groupAll;
+ }
}
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LimitClause.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LimitClause.java
index 451d7ef..7ebedc2 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LimitClause.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LimitClause.java
@@ -51,6 +51,10 @@
this.offset = offset;
}
+ public boolean hasOffset() {
+ return offset != null;
+ }
+
@Override
public ClauseType getClauseType() {
return ClauseType.LIMIT_CLAUSE;
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/CallExpr.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/CallExpr.java
index 8cff0e8..c7d48b6 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/CallExpr.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/CallExpr.java
@@ -27,7 +27,7 @@
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
public class CallExpr extends AbstractExpression {
- private final FunctionSignature functionSignature;
+ private FunctionSignature functionSignature;
private List<Expression> exprList;
private boolean isBuiltin;
@@ -53,6 +53,10 @@
return Kind.CALL_EXPRESSION;
}
+ public void setFunctionSignature(FunctionSignature functionSignature) {
+ this.functionSignature = functionSignature;
+ }
+
public void setExprList(List<Expression> exprList) {
this.exprList = exprList;
}
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
index da7f59e..65422b2 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
@@ -40,10 +40,12 @@
opList = new ArrayList<OperatorType>();
}
- public OperatorExpr(List<Expression> exprList, List<Integer> exprBroadcastIdx, List<OperatorType> opList) {
+ public OperatorExpr(List<Expression> exprList, List<Integer> exprBroadcastIdx, List<OperatorType> opList,
+ boolean currentop) {
this.exprList = exprList;
this.exprBroadcastIdx = exprBroadcastIdx;
this.opList = opList;
+ this.currentop = currentop;
}
public boolean isCurrentop() {
@@ -87,40 +89,41 @@
}
public void addOperator(String strOp) {
- if ("or".equals(strOp))
+ if ("or".equals(strOp)) {
opList.add(OperatorType.OR);
- else if ("and".equals(strOp))
+ } else if ("and".equals(strOp)) {
opList.add(OperatorType.AND);
- else if ("<".equals(strOp))
+ } else if ("<".equals(strOp)) {
opList.add(OperatorType.LT);
- else if (">".equals(strOp))
+ } else if (">".equals(strOp)) {
opList.add(OperatorType.GT);
- else if ("<=".equals(strOp))
+ } else if ("<=".equals(strOp)) {
opList.add(OperatorType.LE);
- else if ("<=".equals(strOp))
+ } else if ("<=".equals(strOp)) {
opList.add(OperatorType.LE);
- else if (">=".equals(strOp))
+ } else if (">=".equals(strOp)) {
opList.add(OperatorType.GE);
- else if ("=".equals(strOp))
+ } else if ("=".equals(strOp)) {
opList.add(OperatorType.EQ);
- else if ("!=".equals(strOp))
+ } else if ("!=".equals(strOp)) {
opList.add(OperatorType.NEQ);
- else if ("+".equals(strOp))
+ } else if ("+".equals(strOp)) {
opList.add(OperatorType.PLUS);
- else if ("-".equals(strOp))
+ } else if ("-".equals(strOp)) {
opList.add(OperatorType.MINUS);
- else if ("*".equals(strOp))
+ } else if ("*".equals(strOp)) {
opList.add(OperatorType.MUL);
- else if ("/".equals(strOp))
+ } else if ("/".equals(strOp)) {
opList.add(OperatorType.DIV);
- else if ("%".equals(strOp))
+ } else if ("%".equals(strOp)) {
opList.add(OperatorType.MOD);
- else if ("^".equals(strOp))
+ } else if ("^".equals(strOp)) {
opList.add(OperatorType.CARET);
- else if ("idiv".equals(strOp))
+ } else if ("idiv".equals(strOp)) {
opList.add(OperatorType.IDIV);
- else if ("~=".equals(strOp))
+ } else if ("~=".equals(strOp)) {
opList.add(OperatorType.FUZZY_EQ);
+ }
}
@Override
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/Query.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/Query.java
index ac7698d..64ca0c1 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/Query.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/Query.java
@@ -33,6 +33,18 @@
private List<String> dataverses = new ArrayList<String>();
private List<String> datasets = new ArrayList<String>();
+ public Query() {
+
+ }
+
+ public Query(boolean topLevel, Expression body, int varCounter, List<String> dataverses, List<String> datasets) {
+ this.topLevel = topLevel;
+ this.body = body;
+ this.varCounter = varCounter;
+ this.dataverses.addAll(dataverses);
+ this.datasets.addAll(datasets);
+ }
+
public Expression getBody() {
return body;
}
diff --git a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java
index ebe266e..db55c0e 100644
--- a/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java
+++ b/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java
@@ -108,7 +108,7 @@
}
}
GroupbyClause newGroup = new GroupbyClause(newGbyList, newDecorList, wList, newGroupVar, newGroupFieldList,
- gc.hasHashGroupByHint());
+ gc.hasHashGroupByHint(), gc.isGroupAll());
return new Pair<ILangExpression, VariableSubstitutionEnvironment>(newGroup, newSubs);
}
@@ -217,8 +217,7 @@
Pair<ILangExpression, VariableSubstitutionEnvironment> p1 = e.accept(this, env);
exprs.add((Expression) p1.first);
}
- OperatorExpr oe = new OperatorExpr(exprs, op.getExprBroadcastIdx(), op.getOpList());
- oe.setCurrentop(op.isCurrentop());
+ OperatorExpr oe = new OperatorExpr(exprs, op.getExprBroadcastIdx(), op.getOpList(), op.isCurrentop());
return new Pair<ILangExpression, VariableSubstitutionEnvironment>(oe, env);
}
@@ -295,7 +294,8 @@
}
// Replace a variable expression if the variable is to-be substituted.
- protected Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env) {
+ protected Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env)
+ throws AsterixException {
if (env.constainsOldVar(expr)) {
return env.findSubstituion(expr);
} else {
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectBlock.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectBlock.java
index 646e150..f63eced 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectBlock.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectBlock.java
@@ -112,4 +112,8 @@
public boolean hasHavingClause() {
return havingClause != null;
}
+
+ public void setGroupbyClause(GroupbyClause groupbyClause) {
+ this.groupbyClause = groupbyClause;
+ }
}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
index 1f119ae..01b9b54 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
@@ -37,6 +37,9 @@
// Inlines column aliases.
inlineColumnAlias();
+ // Rewrites SQL-92 global aggregations.
+ rewriteGlobalAggregations();
+
// Group-by core/sugar rewrites.
rewriteGroupBys();
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
index a2c84ba..f9a7183 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
@@ -48,11 +48,14 @@
import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
import org.apache.asterix.lang.sqlpp.parser.FunctionParser;
import org.apache.asterix.lang.sqlpp.parser.SqlppParserFactory;
+import org.apache.asterix.lang.sqlpp.rewrites.visitor.InlineColumnAliasVisitor;
+import org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppBuiltinFunctionRewriteVisitor;
+import org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppGlobalAggregationSugarVisitor;
+import org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppGroupByVisitor;
+import org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppInlineUdfsVisitor;
+import org.apache.asterix.lang.sqlpp.rewrites.visitor.VariableCheckAndRewriteVisitor;
import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
-import org.apache.asterix.lang.sqlpp.visitor.InlineColumnAliasVisitor;
-import org.apache.asterix.lang.sqlpp.visitor.SqlppGroupByVisitor;
-import org.apache.asterix.lang.sqlpp.visitor.SqlppInlineUdfsVisitor;
-import org.apache.asterix.lang.sqlpp.visitor.VariableCheckAndRewriteVisitor;
+import org.apache.asterix.lang.sqlpp.util.FunctionMapUtil;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
import org.apache.asterix.metadata.MetadataManager;
import org.apache.asterix.metadata.MetadataTransactionContext;
@@ -86,6 +89,9 @@
// Inlines column aliases.
inlineColumnAlias();
+ // Rewrites SQL-92 global aggregations.
+ rewriteGlobalAggregations();
+
// Group-by core/sugar rewrites.
rewriteGroupBys();
@@ -95,6 +101,11 @@
// Inlines functions.
inlineDeclaredUdfs();
+ // Rewrites function names.
+ // This should be done after inlineDeclaredUdfs() because user-defined function
+ // names could be case sensitive.
+ rewriteFunctionNames();
+
// Replace global variable access with the dataset function for inlined expressions.
variableCheckAndRewrite(true);
@@ -102,6 +113,22 @@
topExpr.setVarCounter(context.getVarCounter());
}
+ protected void rewriteGlobalAggregations() throws AsterixException {
+ if (topExpr == null) {
+ return;
+ }
+ SqlppGlobalAggregationSugarVisitor globalAggregationVisitor = new SqlppGlobalAggregationSugarVisitor();
+ globalAggregationVisitor.visit(topExpr, null);
+ }
+
+ protected void rewriteFunctionNames() throws AsterixException {
+ if (topExpr == null) {
+ return;
+ }
+ SqlppBuiltinFunctionRewriteVisitor functionNameMapVisitor = new SqlppBuiltinFunctionRewriteVisitor();
+ functionNameMapVisitor.visit(topExpr, null);
+ }
+
protected void inlineColumnAlias() throws AsterixException {
if (topExpr == null) {
return;
@@ -124,7 +151,7 @@
if (topExpr == null) {
return;
}
- SqlppGroupByVisitor groupByVisitor = new SqlppGroupByVisitor(context, metadataProvider);
+ SqlppGroupByVisitor groupByVisitor = new SqlppGroupByVisitor(context);
groupByVisitor.visit(topExpr, null);
}
@@ -167,7 +194,9 @@
Function function = lookupUserDefinedFunctionDecl(signature);
if (function == null) {
- if (AsterixBuiltinFunctions.isBuiltinCompilerFunction(signature, includePrivateFunctions)) {
+ FunctionSignature normalizedSignature = FunctionMapUtil.normalizeBuiltinFunctionSignature(signature,
+ false);
+ if (AsterixBuiltinFunctions.isBuiltinCompilerFunction(normalizedSignature, includePrivateFunctions)) {
continue;
}
StringBuilder messageBuilder = new StringBuilder();
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/InlineColumnAliasVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/InlineColumnAliasVisitor.java
similarity index 96%
rename from asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/InlineColumnAliasVisitor.java
rename to asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/InlineColumnAliasVisitor.java
index 98c74b4..bb8c149 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/InlineColumnAliasVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/InlineColumnAliasVisitor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.lang.sqlpp.visitor;
+package org.apache.asterix.lang.sqlpp.rewrites.visitor;
import java.util.ArrayList;
import java.util.HashMap;
@@ -67,6 +67,7 @@
import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
+import org.apache.asterix.lang.sqlpp.util.SqlppRewriteUtil;
import org.apache.asterix.lang.sqlpp.util.SqlppVariableSubstitutionUtil;
import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
@@ -135,9 +136,10 @@
@Override
public Void visit(Projection projection, Boolean arg) throws AsterixException {
projection.getExpression().accept(this, arg);
- VariableExpr columnAlias = new VariableExpr(SqlppVariableUtil.toInternalVariableIdentifier(projection.getName()));
+ VariableExpr columnAlias = new VariableExpr(
+ SqlppVariableUtil.toInternalVariableIdentifier(projection.getName()));
VariableSubstitutionEnvironment env = scopeChecker.getCurrentScope().getVarSubstitutionEnvironment();
- Expression gbyKey = env.findSubstituion(columnAlias);
+ Expression gbyKey = (Expression) SqlppRewriteUtil.deepCopy(env.findSubstituion(columnAlias));
if (arg) {
scopeChecker.getCurrentScope().addSymbolExpressionMappingToScope(columnAlias, projection.getExpression());
} else {
@@ -354,21 +356,22 @@
return null;
}
- private void mapForRecordConstructor(Boolean initPhase, RecordConstructor rc) {
+ private void mapForRecordConstructor(Boolean initPhase, RecordConstructor rc) throws AsterixException {
for (FieldBinding binding : rc.getFbList()) {
Expression leftExpr = binding.getLeftExpr();
if (leftExpr.getKind() == Kind.LITERAL_EXPRESSION) {
LiteralExpr literalExpr = (LiteralExpr) leftExpr;
if (literalExpr.getValue().getLiteralType() == Literal.Type.STRING) {
String fieldName = literalExpr.getValue().getStringValue();
- VariableExpr columnAlias = new VariableExpr(SqlppVariableUtil.toInternalVariableIdentifier(fieldName));
+ VariableExpr columnAlias = new VariableExpr(
+ SqlppVariableUtil.toInternalVariableIdentifier(fieldName));
VariableSubstitutionEnvironment env = scopeChecker.getCurrentScope()
.getVarSubstitutionEnvironment();
if (initPhase) {
scopeChecker.getCurrentScope().addSymbolExpressionMappingToScope(columnAlias,
binding.getRightExpr());
} else {
- Expression gbyKey = env.findSubstituion(columnAlias);
+ Expression gbyKey = (Expression) SqlppRewriteUtil.deepCopy(env.findSubstituion(columnAlias));
if (gbyKey != null) {
binding.setRightExpr(gbyKey);
}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppBuiltinFunctionRewriteVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppBuiltinFunctionRewriteVisitor.java
new file mode 100644
index 0000000..c7c7d11
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppBuiltinFunctionRewriteVisitor.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.lang.sqlpp.rewrites.visitor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.sqlpp.util.FunctionMapUtil;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppSimpleExpressionVisitor;
+
+public class SqlppBuiltinFunctionRewriteVisitor extends AbstractSqlppSimpleExpressionVisitor {
+
+ @Override
+ public Expression visit(CallExpr callExpr, Expression arg) throws AsterixException {
+ //TODO(buyingyi): rewrite SQL temporal functions
+ FunctionSignature functionSignature = callExpr.getFunctionSignature();
+ callExpr.setFunctionSignature(FunctionMapUtil.normalizeBuiltinFunctionSignature(functionSignature, true));
+ List<Expression> newExprList = new ArrayList<Expression>();
+ for (Expression expr : callExpr.getExprList()) {
+ newExprList.add(expr.accept(this, arg));
+ }
+ callExpr.setExprList(newExprList);
+ return callExpr;
+ }
+
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppGlobalAggregationSugarVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppGlobalAggregationSugarVisitor.java
new file mode 100644
index 0000000..ae629af
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppGlobalAggregationSugarVisitor.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+package org.apache.asterix.lang.sqlpp.rewrites.visitor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.ILangExpression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.literal.IntegerLiteral;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.clause.SelectClause;
+import org.apache.asterix.lang.sqlpp.visitor.CheckSql92AggregateVisitor;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppSimpleExpressionVisitor;
+
+public class SqlppGlobalAggregationSugarVisitor extends AbstractSqlppSimpleExpressionVisitor {
+
+ @Override
+ public Expression visit(SelectBlock selectBlock, Expression arg) throws AsterixException {
+ SelectClause selectClause = selectBlock.getSelectClause();
+ if (!selectBlock.hasGroupbyClause() && selectBlock.hasFromClause()) {
+ boolean addImplicitGby = false;
+ if (selectClause.selectRegular()) {
+ addImplicitGby = isSql92Aggregate(selectClause.getSelectRegular(), selectBlock);
+ } else {
+ addImplicitGby = isSql92Aggregate(selectClause.getSelectElement(), selectBlock);
+ }
+ if (addImplicitGby) {
+ // Adds an implicit group-by clause for SQL-92 global aggregate.
+ List<GbyVariableExpressionPair> gbyPairList = new ArrayList<>();
+ gbyPairList.add(new GbyVariableExpressionPair(null, new LiteralExpr(new IntegerLiteral(1))));
+ List<GbyVariableExpressionPair> decorPairList = new ArrayList<>();
+ List<VariableExpr> withVarList = new ArrayList<>();
+ GroupbyClause gbyClause = new GroupbyClause(gbyPairList, decorPairList, withVarList, null, null, false,
+ true);
+ selectBlock.setGroupbyClause(gbyClause);
+ }
+ }
+ return super.visit(selectBlock, arg);
+ }
+
+ private boolean isSql92Aggregate(ILangExpression expr, SelectBlock selectBlock) throws AsterixException {
+ CheckSql92AggregateVisitor visitor = new CheckSql92AggregateVisitor();
+ return expr.accept(visitor, selectBlock);
+ }
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupBySugarVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppGroupBySugarVisitor.java
similarity index 77%
rename from asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupBySugarVisitor.java
rename to asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppGroupBySugarVisitor.java
index 5506256..ae47264 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupBySugarVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppGroupBySugarVisitor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.lang.sqlpp.visitor;
+package org.apache.asterix.lang.sqlpp.rewrites.visitor;
import java.util.ArrayList;
import java.util.Collection;
@@ -28,7 +28,6 @@
import java.util.Set;
import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.common.functions.FunctionConstants;
import org.apache.asterix.common.functions.FunctionSignature;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.base.Expression.Kind;
@@ -36,7 +35,6 @@
import org.apache.asterix.lang.common.expression.FieldAccessor;
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
-import org.apache.asterix.lang.common.util.FunctionUtil;
import org.apache.asterix.lang.sqlpp.clause.FromClause;
import org.apache.asterix.lang.sqlpp.clause.FromTerm;
import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
@@ -45,25 +43,23 @@
import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
import org.apache.asterix.lang.sqlpp.struct.SetOperationInput;
+import org.apache.asterix.lang.sqlpp.util.FunctionMapUtil;
import org.apache.asterix.lang.sqlpp.util.SqlppRewriteUtil;
import org.apache.asterix.lang.sqlpp.util.SqlppVariableSubstitutionUtil;
import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
-import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppExpressionScopingVisitor;
/**
* An AST pre-processor to rewrite group-by sugar queries.
*/
-public class SqlppGroupBySugarVisitor extends VariableCheckAndRewriteVisitor {
+public class SqlppGroupBySugarVisitor extends AbstractSqlppExpressionScopingVisitor {
private final Expression groupVar;
private final Collection<VariableExpr> targetVars;
- public SqlppGroupBySugarVisitor(LangRewritingContext context, AqlMetadataProvider metadataProvider,
- Expression groupVar, Collection<VariableExpr> targetVars) {
- super(context, false, metadataProvider);
+ public SqlppGroupBySugarVisitor(LangRewritingContext context, Expression groupVar,
+ Collection<VariableExpr> targetVars) {
+ super(context);
this.groupVar = groupVar;
this.targetVars = targetVars;
}
@@ -71,24 +67,23 @@
@Override
public Expression visit(CallExpr callExpr, Expression arg) throws AsterixException {
List<Expression> newExprList = new ArrayList<Expression>();
- boolean aggregate = isAggregateFunction(callExpr.getFunctionSignature());
+ FunctionSignature signature = callExpr.getFunctionSignature();
+ boolean aggregate = FunctionMapUtil.isSql92AggregateFunction(signature)
+ || FunctionMapUtil.isCoreAggregateFunction(signature);
+ boolean rewritten = false;
for (Expression expr : callExpr.getExprList()) {
Expression newExpr = aggregate ? wrapAggregationArgument(expr) : expr;
+ rewritten |= newExpr != expr;
newExprList.add(newExpr.accept(this, arg));
}
+ if (rewritten) {
+ // Rewrites the SQL-92 function name to core functions.
+ callExpr.setFunctionSignature(FunctionMapUtil.sql92ToCoreAggregateFunction(signature));
+ }
callExpr.setExprList(newExprList);
return callExpr;
}
- private boolean isAggregateFunction(FunctionSignature signature) throws AsterixException {
- IFunctionInfo finfo = FunctionUtil.getFunctionInfo(
- new FunctionIdentifier(FunctionConstants.ASTERIX_NS, signature.getName(), signature.getArity()));
- if (finfo == null) {
- return false;
- }
- return AsterixBuiltinFunctions.getAggregateFunction(finfo.getFunctionIdentifier()) != null;
- }
-
private Expression wrapAggregationArgument(Expression expr) throws AsterixException {
if (expr.getKind() == Kind.SELECT_EXPRESSION) {
return expr;
@@ -96,10 +91,11 @@
Set<VariableExpr> definedVars = scopeChecker.getCurrentScope().getLiveVariables();
Set<VariableExpr> vars = new HashSet<>(targetVars);
vars.remove(definedVars); // Exclude re-defined local variables.
- Set<VariableExpr> usedVars = SqlppRewriteUtil.getUsedVariable(expr);
- if (!vars.containsAll(usedVars)) {
+ Set<VariableExpr> freeVars = SqlppRewriteUtil.getFreeVariable(expr);
+ if (!vars.containsAll(freeVars)) {
return expr;
}
+
VariableExpr var = new VariableExpr(context.newVariable());
FromTerm fromTerm = new FromTerm(groupVar, var, null, null);
FromClause fromClause = new FromClause(Collections.singletonList(fromTerm));
@@ -116,7 +112,7 @@
// replace variable expressions with field access
Map<VariableExpr, Expression> varExprMap = new HashMap<>();
- for (VariableExpr usedVar : usedVars) {
+ for (VariableExpr usedVar : freeVars) {
varExprMap.put(usedVar,
new FieldAccessor(var, SqlppVariableUtil.toUserDefinedVariableName(usedVar.getVar())));
}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupByVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppGroupByVisitor.java
similarity index 93%
rename from asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupByVisitor.java
rename to asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppGroupByVisitor.java
index ecbdecd..c9e7a6e 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppGroupByVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppGroupByVisitor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.lang.sqlpp.visitor;
+package org.apache.asterix.lang.sqlpp.rewrites.visitor;
import java.util.ArrayList;
import java.util.HashSet;
@@ -38,17 +38,17 @@
import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
import org.apache.asterix.lang.sqlpp.util.SqlppRewriteUtil;
import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppExpressionScopingVisitor;
import org.apache.hyracks.algebricks.common.utils.Pair;
/**
* A pre-processor that adds the group variable as well as its group field
* list into the AST. It will also invoke SQL group-by aggregation sugar rewritings.
*/
-public class SqlppGroupByVisitor extends VariableCheckAndRewriteVisitor {
+public class SqlppGroupByVisitor extends AbstractSqlppExpressionScopingVisitor {
- public SqlppGroupByVisitor(LangRewritingContext context, AqlMetadataProvider metadataProvider) {
- super(context, false, metadataProvider);
+ public SqlppGroupByVisitor(LangRewritingContext context) {
+ super(context);
}
@Override
@@ -71,8 +71,6 @@
selectBlock.getGroupbyClause().accept(this, arg);
Set<VariableExpr> withVarSet = new HashSet<>(selectBlock.getGroupbyClause().getWithVarList());
withVarSet.remove(selectBlock.getGroupbyClause().getGroupVar());
- //selectBlock.getGroupbyClause().getWithVarList()
- // .retainAll(Collections.singleton(selectBlock.getGroupbyClause().getGroupVar()));
if (selectBlock.hasLetClausesAfterGroupby()) {
List<LetClause> letListAfterGby = selectBlock.getLetListAfterGroupby();
for (LetClause letClauseAfterGby : letListAfterGby) {
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppInlineUdfsVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppInlineUdfsVisitor.java
similarity index 98%
rename from asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppInlineUdfsVisitor.java
rename to asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppInlineUdfsVisitor.java
index 37c8be8..e7832bb 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppInlineUdfsVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppInlineUdfsVisitor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.lang.sqlpp.visitor;
+package org.apache.asterix.lang.sqlpp.rewrites.visitor;
import java.util.HashMap;
import java.util.List;
@@ -46,6 +46,7 @@
import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
import org.apache.asterix.lang.sqlpp.util.SqlppVariableSubstitutionUtil;
+import org.apache.asterix.lang.sqlpp.visitor.SqlppCloneAndSubstituteVariablesVisitor;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
import org.apache.asterix.metadata.declared.AqlMetadataProvider;
import org.apache.hyracks.algebricks.common.utils.Pair;
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
new file mode 100644
index 0000000..5ca2533
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+package org.apache.asterix.lang.sqlpp.rewrites.visitor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.asterix.common.config.MetadataConstants;
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.literal.StringLiteral;
+import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.struct.VarIdentifier;
+import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppExpressionScopingVisitor;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+
+public class VariableCheckAndRewriteVisitor extends AbstractSqlppExpressionScopingVisitor {
+
+ protected final boolean overwrite;
+ protected final AqlMetadataProvider metadataProvider;
+
+ /**
+ * @param context,
+ * manages ids of variables and guarantees uniqueness of variables.
+ * @param overwrite,
+ * whether rewrite unbounded variables to dataset function calls.
+ * This flag can only be true for rewriting a top-level query.
+ * It should be false for rewriting the body expression of a user-defined function.
+ */
+ public VariableCheckAndRewriteVisitor(LangRewritingContext context, boolean overwrite,
+ AqlMetadataProvider metadataProvider) {
+ super(context);
+ this.overwrite = overwrite;
+ this.metadataProvider = metadataProvider;
+ }
+
+ @Override
+ public Expression visit(VariableExpr varExpr, Expression arg) throws AsterixException {
+ String varName = varExpr.getVar().getValue();
+ if (scopeChecker.isInForbiddenScopes(varName)) {
+ throw new AsterixException(
+ "Inside limit clauses, it is disallowed to reference a variable having the same name as any variable bound in the same scope as the limit clause.");
+ }
+ if (rewriteNeeded(varExpr)) {
+ return datasetRewrite(varExpr);
+ } else {
+ return varExpr;
+ }
+ }
+
+ // Whether a rewrite is needed for a variable reference expression.
+ private boolean rewriteNeeded(VariableExpr varExpr) throws AsterixException {
+ String varName = varExpr.getVar().getValue();
+ Identifier ident = scopeChecker.lookupSymbol(varName);
+ if (ident != null) {
+ // Exists such an identifier
+ varExpr.setIsNewVar(false);
+ varExpr.setVar((VarIdentifier) ident);
+ return false;
+ } else {
+ // Meets a undefined variable
+ return true;
+ }
+ }
+
+ // Rewrites for global variable (e.g., dataset) references.
+ private Expression datasetRewrite(VariableExpr expr) throws AsterixException {
+ if (!overwrite) {
+ return expr;
+ }
+ String funcName = "dataset";
+ String dataverse = MetadataConstants.METADATA_DATAVERSE_NAME;
+ FunctionSignature signature = new FunctionSignature(dataverse, funcName, 1);
+ List<Expression> argList = new ArrayList<Expression>();
+ //Ignore the parser-generated prefix "$" for a dataset.
+ String dataset = SqlppVariableUtil.toUserDefinedVariableName(expr.getVar()).getValue();
+ argList.add(new LiteralExpr(new StringLiteral(dataset)));
+ return new CallExpr(signature, argList);
+ }
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/FunctionMapUtil.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/FunctionMapUtil.java
new file mode 100644
index 0000000..cbf05b5
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/FunctionMapUtil.java
@@ -0,0 +1,150 @@
+/*
+ * 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.
+ */
+package org.apache.asterix.lang.sqlpp.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.functions.FunctionConstants;
+import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.common.util.FunctionUtil;
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo;
+
+public class FunctionMapUtil {
+
+ private final static String CORE_AGGREGATE_PREFIX = "coll_";
+
+ // Maps from a SQL function name to an AQL function name (i.e., AsterixDB internal name).
+ private static final Map<String, String> FUNCTION_NAME_MAP = new HashMap<>();
+
+ static {
+ FUNCTION_NAME_MAP.put("ceil", "ceiling"); //SQL: ceil, AQL: ceiling
+ FUNCTION_NAME_MAP.put("length", "string-length"); // SQL: length, AQL: string-length
+ FUNCTION_NAME_MAP.put("lower", "lowercase"); // SQL: lower, AQL: lowercase
+ FUNCTION_NAME_MAP.put("substr", "substring"); // SQL: substr, AQL: substring
+ FUNCTION_NAME_MAP.put("upper", "uppercase"); //SQL: upper, AQL: uppercase
+ }
+
+ /**
+ * Whether a function signature is a SQL-92 core aggregate function.
+ *
+ * @param fs,
+ * the function signature.
+ * @return true if the function signature is a SQL-92 core aggregate,
+ * false otherwise.
+ */
+ public static boolean isSql92AggregateFunction(FunctionSignature signature) throws AsterixException {
+ IFunctionInfo finfo = FunctionUtil.getFunctionInfo(new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ signature.getName().toLowerCase(), signature.getArity()));
+ if (finfo == null) {
+ return false;
+ }
+ return AsterixBuiltinFunctions.getAggregateFunction(finfo.getFunctionIdentifier()) != null;
+ }
+
+ /**
+ * Whether a function signature is a SQL++ core aggregate function.
+ *
+ * @param fs,
+ * the function signature.
+ * @return true if the function signature is a SQL++ core aggregate,
+ * false otherwise.
+ */
+ public static boolean isCoreAggregateFunction(FunctionSignature fs) {
+ String name = fs.getName().toLowerCase();
+ if (!name.startsWith(CORE_AGGREGATE_PREFIX)) {
+ return false;
+ }
+ IFunctionInfo finfo = FunctionUtil.getFunctionInfo(new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+ name.substring(CORE_AGGREGATE_PREFIX.length()), fs.getArity()));
+ if (finfo == null) {
+ return false;
+ }
+ return AsterixBuiltinFunctions.getAggregateFunction(finfo.getFunctionIdentifier()) != null;
+ }
+
+ /**
+ * Get the corresponding SQL++ core aggregate function from the SQL-92 aggregate function.
+ *
+ * @param fs,
+ * the SQL-92 aggregate function signature.
+ * @return the SQL++ aggregate function signature.
+ * @throws AsterixException
+ */
+ public static FunctionSignature sql92ToCoreAggregateFunction(FunctionSignature fs) throws AsterixException {
+ if (!isSql92AggregateFunction(fs)) {
+ return fs;
+ }
+ return new FunctionSignature(fs.getNamespace(), CORE_AGGREGATE_PREFIX + fs.getName(), fs.getArity());
+ }
+
+ /**
+ * Maps a user invoked function signature to a system internal function signature.
+ *
+ * @param fs,
+ * the user typed function.
+ * @return the system internal function.
+ */
+ public static FunctionSignature normalizeBuiltinFunctionSignature(FunctionSignature fs, boolean checkSql92Aggregate)
+ throws AsterixException {
+ String mappedName = internalizeBuiltinScalarFunctionName(fs.getName());
+ if (isCoreAggregateFunction(fs)) {
+ mappedName = internalizeCoreAggregateFunctionName(mappedName);
+ } else if (checkSql92Aggregate && isSql92AggregateFunction(fs)) {
+ throw new AsterixException(fs.getName()
+ + " is a SQL-92 aggregate function. The SQL++ core aggregate function " + CORE_AGGREGATE_PREFIX
+ + fs.getName().toLowerCase() + " could potentially express the intent.");
+ }
+ return new FunctionSignature(fs.getNamespace(), mappedName, fs.getArity());
+ }
+
+ /**
+ * Removes the "coll_" prefix for user-facing SQL++ core aggregate function names.
+ *
+ * @param name,
+ * the name of a user-facing SQL++ core aggregate function name.
+ * @return the AsterixDB internal function name for the aggregate function.
+ * @throws AsterixException
+ */
+ private static String internalizeCoreAggregateFunctionName(String name) throws AsterixException {
+ String lowerCaseName = name.toLowerCase();
+ return lowerCaseName.substring(CORE_AGGREGATE_PREFIX.length());
+ }
+
+ /**
+ * Note: function name normalization can ONLY be called
+ * after all user-defined functions (by either "DECLARE FUNCTION" or "CREATE FUNCTION")
+ * are inlined, because user-defined function names are case-sensitive.
+ *
+ * @param name
+ * the user-input function name in the query.
+ * @return the mapped internal name.
+ */
+ private static String internalizeBuiltinScalarFunctionName(String name) {
+ String lowerCaseName = name.toLowerCase();
+ String mappedName = FUNCTION_NAME_MAP.get(lowerCaseName);
+ if (mappedName != null) {
+ return mappedName;
+ }
+ return lowerCaseName;
+ }
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java
index 0f8488a..6c737d6 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java
@@ -27,8 +27,9 @@
import org.apache.asterix.lang.common.base.ILangExpression;
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
-import org.apache.asterix.lang.sqlpp.visitor.SqlppGroupBySugarVisitor;
-import org.apache.asterix.lang.sqlpp.visitor.UsedVariableVisitor;
+import org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppGroupBySugarVisitor;
+import org.apache.asterix.lang.sqlpp.visitor.DeepCopyVisitor;
+import org.apache.asterix.lang.sqlpp.visitor.FreeVariableVisitor;
public class SqlppRewriteUtil {
@@ -36,15 +37,23 @@
public static Expression rewriteExpressionUsingGroupVariable(VariableExpr groupVar,
Collection<VariableExpr> targetVarList, ILangExpression expr, LangRewritingContext context)
throws AsterixException {
- SqlppGroupBySugarVisitor visitor = new SqlppGroupBySugarVisitor(context, null, groupVar, targetVarList);
+ SqlppGroupBySugarVisitor visitor = new SqlppGroupBySugarVisitor(context, groupVar, targetVarList);
return expr.accept(visitor, null);
}
- public static Set<VariableExpr> getUsedVariable(Expression expr) throws AsterixException {
+ public static Set<VariableExpr> getFreeVariable(Expression expr) throws AsterixException {
Set<VariableExpr> vars = new HashSet<>();
- UsedVariableVisitor visitor = new UsedVariableVisitor();
+ FreeVariableVisitor visitor = new FreeVariableVisitor();
expr.accept(visitor, vars);
return vars;
}
+ public static ILangExpression deepCopy(ILangExpression expr) throws AsterixException {
+ if (expr == null) {
+ return expr;
+ }
+ DeepCopyVisitor visitor = new DeepCopyVisitor();
+ return expr.accept(visitor, null);
+ }
+
}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java
index 8a63aa5..59e9389 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java
@@ -18,7 +18,22 @@
*/
package org.apache.asterix.lang.sqlpp.util;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.ILangExpression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.struct.VarIdentifier;
+import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.visitor.FreeVariableVisitor;
public class SqlppVariableUtil {
@@ -44,4 +59,73 @@
return new VarIdentifier(USER_VAR_PREFIX + idName);
}
+ public static Collection<VariableExpr> getFreeVariables(ILangExpression langExpr) throws AsterixException {
+ Collection<VariableExpr> freeVars = new HashSet<>();
+ FreeVariableVisitor visitor = new FreeVariableVisitor();
+ langExpr.accept(visitor, freeVars);
+ return freeVars;
+ }
+
+ public static Collection<VariableExpr> getBindingVariables(FromClause fromClause) {
+ Set<VariableExpr> bindingVars = new HashSet<>();
+ if (fromClause == null) {
+ return bindingVars;
+ }
+ for (FromTerm fromTerm : fromClause.getFromTerms()) {
+ bindingVars.addAll(getBindingVariables(fromTerm));
+ }
+ return bindingVars;
+ }
+
+ public static Collection<VariableExpr> getBindingVariables(FromTerm fromTerm) {
+ Set<VariableExpr> bindingVars = new HashSet<>();
+ if (fromTerm == null) {
+ return bindingVars;
+ }
+ bindingVars.add(fromTerm.getLeftVariable());
+ if (fromTerm.hasPositionalVariable()) {
+ bindingVars.add(fromTerm.getPositionalVariable());
+ }
+ for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
+ bindingVars.add(correlateClause.getRightVariable());
+ if (correlateClause.hasPositionalVariable()) {
+ bindingVars.add(correlateClause.getPositionalVariable());
+ }
+ }
+ return bindingVars;
+ }
+
+ public static Collection<VariableExpr> getBindingVariables(GroupbyClause gbyClause) {
+ Set<VariableExpr> bindingVars = new HashSet<>();
+ if (gbyClause == null) {
+ return bindingVars;
+ }
+ for (GbyVariableExpressionPair gbyKey : gbyClause.getGbyPairList()) {
+ VariableExpr var = gbyKey.getVar();
+ if (var != null) {
+ bindingVars.add(var);
+ }
+ }
+ for (GbyVariableExpressionPair gbyKey : gbyClause.getDecorPairList()) {
+ VariableExpr var = gbyKey.getVar();
+ if (var != null) {
+ bindingVars.add(var);
+ }
+ }
+ bindingVars.addAll(gbyClause.getWithVarList());
+ bindingVars.add(gbyClause.getGroupVar());
+ return bindingVars;
+ }
+
+ public static Collection<VariableExpr> getBindingVariables(List<LetClause> letClauses) {
+ Set<VariableExpr> bindingVars = new HashSet<>();
+ if (letClauses == null || letClauses.isEmpty()) {
+ return bindingVars;
+ }
+ for (LetClause letClause : letClauses) {
+ bindingVars.add(letClause.getVarExpr());
+ }
+ return bindingVars;
+ }
+
}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSql92AggregateVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSql92AggregateVisitor.java
new file mode 100644
index 0000000..1bca7ac
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSql92AggregateVisitor.java
@@ -0,0 +1,265 @@
+/*
+ * 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.
+ */
+package org.apache.asterix.lang.sqlpp.visitor;
+
+import java.util.List;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.ILangExpression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.clause.HavingClause;
+import org.apache.asterix.lang.sqlpp.clause.JoinClause;
+import org.apache.asterix.lang.sqlpp.clause.NestClause;
+import org.apache.asterix.lang.sqlpp.clause.Projection;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.clause.SelectClause;
+import org.apache.asterix.lang.sqlpp.clause.SelectElement;
+import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
+import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
+import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.util.FunctionMapUtil;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
+
+/**
+ * This visitor checks if a language construct contains SQL-92 aggregates.
+ */
+public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisitor<Boolean, ILangExpression> {
+
+ @Override
+ public Boolean visit(Query q, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(FunctionDecl fd, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(LiteralExpr l, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(VariableExpr v, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(ListConstructor lc, ILangExpression parentSelectBlock) throws AsterixException {
+ return visitExprList(lc.getExprList(), parentSelectBlock);
+ }
+
+ @Override
+ public Boolean visit(RecordConstructor rc, ILangExpression parentSelectBlock) throws AsterixException {
+ for (FieldBinding fieldBinding : rc.getFbList()) {
+ ILangExpression leftExpr = fieldBinding.getLeftExpr();
+ ILangExpression rightExpr = fieldBinding.getRightExpr();
+ if (leftExpr.accept(this, parentSelectBlock)) {
+ return true;
+ }
+ if (rightExpr.accept(this, parentSelectBlock)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Boolean visit(OperatorExpr ifbo, ILangExpression parentSelectBlock) throws AsterixException {
+ return visitExprList(ifbo.getExprList(), parentSelectBlock);
+ }
+
+ @Override
+ public Boolean visit(FieldAccessor fa, ILangExpression parentSelectBlock) throws AsterixException {
+ return fa.getExpr().accept(this, parentSelectBlock);
+ }
+
+ @Override
+ public Boolean visit(IndexAccessor ia, ILangExpression parentSelectBlock) throws AsterixException {
+ return ia.getExpr().accept(this, parentSelectBlock);
+ }
+
+ @Override
+ public Boolean visit(IfExpr ifexpr, ILangExpression parentSelectBlock) throws AsterixException {
+ if (ifexpr.getCondExpr().accept(this, parentSelectBlock)) {
+ return true;
+ } else {
+ return ifexpr.getThenExpr().accept(this, parentSelectBlock)
+ || ifexpr.getElseExpr().accept(this, parentSelectBlock);
+ }
+ }
+
+ @Override
+ public Boolean visit(QuantifiedExpression qe, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(UnaryExpr u, ILangExpression parentSelectBlock) throws AsterixException {
+ return u.getExpr().accept(this, parentSelectBlock);
+ }
+
+ @Override
+ public Boolean visit(CallExpr pf, ILangExpression parentSelectBlock) throws AsterixException {
+ FunctionSignature fs = pf.getFunctionSignature();
+ if (FunctionMapUtil.isSql92AggregateFunction(fs)) {
+ return true;
+ }
+ for (Expression parameter : pf.getExprList()) {
+ if (parameter.accept(this, parentSelectBlock)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Boolean visit(LetClause lc, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(WhereClause wc, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(OrderbyClause oc, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(GroupbyClause gc, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(LimitClause lc, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(FromClause fromClause, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(FromTerm fromTerm, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(JoinClause joinClause, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(NestClause nestClause, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(Projection projection, ILangExpression parentSelectBlock) throws AsterixException {
+ return projection.getExpression().accept(this, parentSelectBlock);
+ }
+
+ @Override
+ public Boolean visit(SelectBlock selectBlock, ILangExpression parentSelectBlock) throws AsterixException {
+ return selectBlock.getSelectClause().accept(this, selectBlock);
+ }
+
+ @Override
+ public Boolean visit(SelectClause selectClause, ILangExpression parentSelectBlock) throws AsterixException {
+ if (selectClause.selectElement()) {
+ return selectClause.getSelectElement().accept(this, parentSelectBlock);
+ } else {
+ return selectClause.getSelectRegular().accept(this, parentSelectBlock);
+ }
+ }
+
+ @Override
+ public Boolean visit(SelectElement selectElement, ILangExpression parentSelectBlock) throws AsterixException {
+ return selectElement.getExpression().accept(this, parentSelectBlock);
+ }
+
+ @Override
+ public Boolean visit(SelectRegular selectRegular, ILangExpression parentSelectBlock) throws AsterixException {
+ for (Projection projection : selectRegular.getProjections()) {
+ if (projection.accept(this, parentSelectBlock)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Boolean visit(SelectSetOperation selectSetOperation, ILangExpression parentSelectBlock)
+ throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(SelectExpression selectStatement, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(UnnestClause unnestClause, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ @Override
+ public Boolean visit(HavingClause havingClause, ILangExpression parentSelectBlock) throws AsterixException {
+ return false;
+ }
+
+ private Boolean visitExprList(List<Expression> exprs, ILangExpression parentSelectBlock) throws AsterixException {
+ for (Expression item : exprs) {
+ if (item.accept(this, parentSelectBlock)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/DeepCopyVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/DeepCopyVisitor.java
new file mode 100644
index 0000000..2d891e0
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/DeepCopyVisitor.java
@@ -0,0 +1,415 @@
+/*
+ * 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.
+ */
+package org.apache.asterix.lang.sqlpp.visitor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.ILangExpression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
+import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.clause.HavingClause;
+import org.apache.asterix.lang.sqlpp.clause.JoinClause;
+import org.apache.asterix.lang.sqlpp.clause.NestClause;
+import org.apache.asterix.lang.sqlpp.clause.Projection;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.clause.SelectClause;
+import org.apache.asterix.lang.sqlpp.clause.SelectElement;
+import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
+import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
+import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.struct.SetOperationInput;
+import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
+import org.apache.hyracks.algebricks.common.utils.Pair;
+
+public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangExpression, Void> {
+
+ @Override
+ public FromClause visit(FromClause fromClause, Void arg) throws AsterixException {
+ List<FromTerm> fromTerms = new ArrayList<>();
+ for (FromTerm fromTerm : fromClause.getFromTerms()) {
+ fromTerms.add((FromTerm) fromTerm.accept(this, arg));
+ }
+ return new FromClause(fromTerms);
+ }
+
+ @Override
+ public FromTerm visit(FromTerm fromTerm, Void arg) throws AsterixException {
+ // Visit the left expression of a from term.
+ Expression fromExpr = (Expression) fromTerm.getLeftExpression().accept(this, arg);
+ VariableExpr fromVar = (VariableExpr) fromTerm.getLeftVariable().accept(this, arg);
+ VariableExpr positionVar = fromTerm.getPositionalVariable() == null ? null
+ : (VariableExpr) fromTerm.getPositionalVariable().accept(this, arg);
+
+ // Visits join/unnest/nest clauses.
+ List<AbstractBinaryCorrelateClause> correlateClauses = new ArrayList<>();
+ for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
+ correlateClauses.add((AbstractBinaryCorrelateClause) correlateClause.accept(this, arg));
+ }
+ return new FromTerm(fromExpr, fromVar, positionVar, correlateClauses);
+ }
+
+ @Override
+ public JoinClause visit(JoinClause joinClause, Void arg) throws AsterixException {
+ Expression rightExpression = (Expression) joinClause.getRightExpression().accept(this, arg);
+ VariableExpr rightVar = (VariableExpr) joinClause.getRightVariable().accept(this, arg);
+ VariableExpr rightPositionVar = joinClause.getPositionalVariable() == null ? null
+ : (VariableExpr) joinClause.getPositionalVariable().accept(this, arg);
+ Expression conditionExpresion = (Expression) joinClause.getConditionExpression().accept(this, arg);
+ return new JoinClause(joinClause.getJoinType(), rightExpression, rightVar, rightPositionVar,
+ conditionExpresion);
+ }
+
+ @Override
+ public NestClause visit(NestClause nestClause, Void arg) throws AsterixException {
+ Expression rightExpression = (Expression) nestClause.getRightExpression().accept(this, arg);
+ VariableExpr rightVar = (VariableExpr) nestClause.getRightVariable().accept(this, arg);
+ VariableExpr rightPositionVar = nestClause.getPositionalVariable() == null ? null
+ : (VariableExpr) nestClause.getPositionalVariable().accept(this, arg);
+ Expression conditionExpresion = (Expression) nestClause.getConditionExpression().accept(this, arg);
+ return new NestClause(nestClause.getJoinType(), rightExpression, rightVar, rightPositionVar,
+ conditionExpresion);
+ }
+
+ @Override
+ public UnnestClause visit(UnnestClause unnestClause, Void arg) throws AsterixException {
+ Expression rightExpression = (Expression) unnestClause.getRightExpression().accept(this, arg);
+ VariableExpr rightVar = (VariableExpr) unnestClause.getRightVariable().accept(this, arg);
+ VariableExpr rightPositionVar = unnestClause.getPositionalVariable() == null ? null
+ : (VariableExpr) unnestClause.getPositionalVariable().accept(this, arg);
+ return new UnnestClause(unnestClause.getJoinType(), rightExpression, rightVar, rightPositionVar);
+ }
+
+ @Override
+ public Projection visit(Projection projection, Void arg) throws AsterixException {
+ return new Projection((Expression) projection.getExpression().accept(this, arg), projection.getName(),
+ projection.star(), projection.exprStar());
+ }
+
+ @Override
+ public SelectBlock visit(SelectBlock selectBlock, Void arg) throws AsterixException {
+ FromClause fromClause = null;
+ List<LetClause> letClauses = new ArrayList<>();
+ WhereClause whereClause = null;
+ GroupbyClause gbyClause = null;
+ List<LetClause> gbyLetClauses = new ArrayList<>();
+ HavingClause havingClause = null;
+ SelectClause selectCluase = null;
+ // Traverses the select block in the order of "from", "let"s, "where",
+ // "group by", "let"s, "having" and "select".
+ if (selectBlock.hasFromClause()) {
+ fromClause = (FromClause) selectBlock.getFromClause().accept(this, arg);
+ }
+ if (selectBlock.hasLetClauses()) {
+ List<LetClause> letList = selectBlock.getLetList();
+ for (LetClause letClause : letList) {
+ letClauses.add((LetClause) letClause.accept(this, arg));
+ }
+ }
+ if (selectBlock.hasWhereClause()) {
+ whereClause = (WhereClause) selectBlock.getWhereClause().accept(this, arg);
+ }
+ if (selectBlock.hasGroupbyClause()) {
+ gbyClause = (GroupbyClause) selectBlock.getGroupbyClause().accept(this, arg);
+ }
+ if (selectBlock.hasLetClausesAfterGroupby()) {
+ List<LetClause> letListAfterGby = selectBlock.getLetListAfterGroupby();
+ for (LetClause letClauseAfterGby : letListAfterGby) {
+ gbyLetClauses.add((LetClause) letClauseAfterGby.accept(this, arg));
+ }
+ }
+ if (selectBlock.hasHavingClause()) {
+ havingClause = (HavingClause) selectBlock.getHavingClause().accept(this, arg);
+ }
+ selectCluase = (SelectClause) selectBlock.getSelectClause().accept(this, arg);
+ return new SelectBlock(selectCluase, fromClause, letClauses, whereClause, gbyClause, gbyLetClauses,
+ havingClause);
+ }
+
+ @Override
+ public SelectClause visit(SelectClause selectClause, Void arg) throws AsterixException {
+ SelectElement selectElement = null;
+ SelectRegular selectRegular = null;
+ if (selectClause.selectElement()) {
+ selectElement = (SelectElement) selectClause.getSelectElement().accept(this, arg);
+ }
+ if (selectClause.selectRegular()) {
+ selectRegular = (SelectRegular) selectClause.getSelectRegular().accept(this, arg);
+ }
+ return new SelectClause(selectElement, selectRegular, selectClause.distinct());
+ }
+
+ @Override
+ public SelectElement visit(SelectElement selectElement, Void arg) throws AsterixException {
+ return new SelectElement((Expression) selectElement.getExpression().accept(this, arg));
+ }
+
+ @Override
+ public SelectRegular visit(SelectRegular selectRegular, Void arg) throws AsterixException {
+ List<Projection> projections = new ArrayList<>();
+ for (Projection projection : selectRegular.getProjections()) {
+ projections.add((Projection) projection.accept(this, arg));
+ }
+ return new SelectRegular(projections);
+ }
+
+ @Override
+ public SelectSetOperation visit(SelectSetOperation selectSetOperation, Void arg) throws AsterixException {
+ SetOperationInput leftInput = selectSetOperation.getLeftInput();
+ SetOperationInput newLeftInput = null;
+ if (leftInput.selectBlock()) {
+ newLeftInput = new SetOperationInput((SelectBlock) leftInput.accept(this, arg), null);
+ } else {
+ newLeftInput = new SetOperationInput(null, (SelectExpression) leftInput.accept(this, arg));
+ }
+ List<SetOperationRight> rightInputs = new ArrayList<>();
+ for (SetOperationRight right : selectSetOperation.getRightInputs()) {
+ SetOperationInput newRightInput = null;
+ SetOperationInput setOpRightInput = right.getSetOperationRightInput();
+ if (setOpRightInput.selectBlock()) {
+ newRightInput = new SetOperationInput((SelectBlock) leftInput.accept(this, arg), null);
+ } else {
+ newRightInput = new SetOperationInput(null, (SelectExpression) leftInput.accept(this, arg));
+ }
+ rightInputs.add(new SetOperationRight(right.getSetOpType(), right.isSetSemantics(), newRightInput));
+ }
+ return new SelectSetOperation(newLeftInput, rightInputs);
+ }
+
+ @Override
+ public HavingClause visit(HavingClause havingClause, Void arg) throws AsterixException {
+ return new HavingClause((Expression) havingClause.getFilterExpression().accept(this, arg));
+ }
+
+ @Override
+ public Query visit(Query q, Void arg) throws AsterixException {
+ return new Query(q.isTopLevel(), (Expression) q.getBody().accept(this, arg), q.getVarCounter(),
+ q.getDataverses(), q.getDatasets());
+ }
+
+ @Override
+ public FunctionDecl visit(FunctionDecl fd, Void arg) throws AsterixException {
+ return new FunctionDecl(fd.getSignature(), fd.getParamList(), (Expression) fd.getFuncBody().accept(this, arg));
+ }
+
+ @Override
+ public WhereClause visit(WhereClause whereClause, Void arg) throws AsterixException {
+ return new WhereClause((Expression) whereClause.getWhereExpr().accept(this, arg));
+ }
+
+ @Override
+ public OrderbyClause visit(OrderbyClause oc, Void arg) throws AsterixException {
+ List<Expression> newOrderbyList = new ArrayList<Expression>();
+ for (Expression orderExpr : oc.getOrderbyList()) {
+ newOrderbyList.add((Expression) orderExpr.accept(this, arg));
+ }
+ return new OrderbyClause(newOrderbyList, oc.getModifierList());
+ }
+
+ @Override
+ public GroupbyClause visit(GroupbyClause gc, Void arg) throws AsterixException {
+ List<GbyVariableExpressionPair> gbyPairList = new ArrayList<>();
+ List<GbyVariableExpressionPair> decorPairList = new ArrayList<>();
+ List<VariableExpr> withVarList = new ArrayList<>();
+ VariableExpr groupVarExpr = null;
+ List<Pair<Expression, Identifier>> groupFieldList = new ArrayList<>();
+ for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
+ gbyPairList.add(new GbyVariableExpressionPair((VariableExpr) gbyVarExpr.getVar().accept(this, arg),
+ (Expression) gbyVarExpr.getExpr().accept(this, arg)));
+ }
+ for (GbyVariableExpressionPair gbyVarExpr : gc.getDecorPairList()) {
+ decorPairList.add(new GbyVariableExpressionPair((VariableExpr) gbyVarExpr.getVar().accept(this, arg),
+ (Expression) gbyVarExpr.getExpr().accept(this, arg)));
+ }
+ for (VariableExpr withVar : gc.getWithVarList()) {
+ withVarList.add((VariableExpr) withVar.accept(this, arg));
+ }
+ if (gc.hasGroupVar()) {
+ groupVarExpr = (VariableExpr) gc.getGroupVar().accept(this, arg);
+ }
+ for (Pair<Expression, Identifier> field : gc.getGroupFieldList()) {
+ groupFieldList.add(new Pair<>((Expression) field.first.accept(this, arg), field.second));
+ }
+ return new GroupbyClause(gbyPairList, decorPairList, withVarList, groupVarExpr, groupFieldList,
+ gc.hasHashGroupByHint(), gc.isGroupAll());
+ }
+
+ @Override
+ public LimitClause visit(LimitClause limitClause, Void arg) throws AsterixException {
+ Expression limitExpr = (Expression) limitClause.getLimitExpr().accept(this, arg);
+ Expression offsetExpr = limitClause.hasOffset() ? (Expression) limitClause.getOffset().accept(this, arg) : null;
+ return new LimitClause(limitExpr, offsetExpr);
+ }
+
+ @Override
+ public LetClause visit(LetClause letClause, Void arg) throws AsterixException {
+ return new LetClause((VariableExpr) letClause.getVarExpr().accept(this, arg),
+ (Expression) letClause.getBindingExpr().accept(this, arg));
+ }
+
+ @Override
+ public SelectExpression visit(SelectExpression selectExpression, Void arg) throws AsterixException {
+ List<LetClause> lets = new ArrayList<>();
+ SelectSetOperation select = null;
+ OrderbyClause orderby = null;
+ LimitClause limit = null;
+
+ // visit let list
+ if (selectExpression.hasLetClauses()) {
+ for (LetClause letClause : selectExpression.getLetList()) {
+ lets.add((LetClause) letClause.accept(this, arg));
+ }
+ }
+
+ // visit the main select.
+ select = (SelectSetOperation) selectExpression.getSelectSetOperation().accept(this, arg);
+
+ // visit order by
+ if (selectExpression.hasOrderby()) {
+ List<Expression> orderExprs = new ArrayList<>();
+ for (Expression orderExpr : selectExpression.getOrderbyClause().getOrderbyList()) {
+ orderExprs.add((Expression) orderExpr.accept(this, arg));
+ }
+ orderby = new OrderbyClause(orderExprs, selectExpression.getOrderbyClause().getModifierList());
+ }
+
+ // visit limit
+ if (selectExpression.hasLimit()) {
+ limit = (LimitClause) selectExpression.getLimitClause().accept(this, arg);
+ }
+ return new SelectExpression(lets, select, orderby, limit, selectExpression.isSubquery());
+ }
+
+ @Override
+ public LiteralExpr visit(LiteralExpr l, Void arg) throws AsterixException {
+ return l;
+ }
+
+ @Override
+ public ListConstructor visit(ListConstructor lc, Void arg) throws AsterixException {
+ List<Expression> newExprList = new ArrayList<Expression>();
+ for (Expression expr : lc.getExprList()) {
+ newExprList.add((Expression) expr.accept(this, arg));
+ }
+ return new ListConstructor(lc.getType(), newExprList);
+ }
+
+ @Override
+ public RecordConstructor visit(RecordConstructor rc, Void arg) throws AsterixException {
+ List<FieldBinding> bindings = new ArrayList<>();
+ for (FieldBinding binding : rc.getFbList()) {
+ FieldBinding fb = new FieldBinding((Expression) binding.getLeftExpr().accept(this, arg),
+ (Expression) binding.getRightExpr().accept(this, arg));
+ bindings.add(fb);
+ }
+ return new RecordConstructor(bindings);
+ }
+
+ @Override
+ public OperatorExpr visit(OperatorExpr operatorExpr, Void arg) throws AsterixException {
+ List<Expression> newExprList = new ArrayList<Expression>();
+ for (Expression expr : operatorExpr.getExprList()) {
+ newExprList.add((Expression) expr.accept(this, arg));
+ }
+ return new OperatorExpr(newExprList, operatorExpr.getExprBroadcastIdx(), operatorExpr.getOpList(),
+ operatorExpr.isCurrentop());
+ }
+
+ @Override
+ public IfExpr visit(IfExpr ifExpr, Void arg) throws AsterixException {
+ Expression conditionExpr = (Expression) ifExpr.getCondExpr().accept(this, arg);
+ Expression thenExpr = (Expression) ifExpr.getThenExpr().accept(this, arg);
+ Expression elseExpr = (Expression) ifExpr.getElseExpr().accept(this, arg);
+ return new IfExpr(conditionExpr, thenExpr, elseExpr);
+ }
+
+ @Override
+ public QuantifiedExpression visit(QuantifiedExpression qe, Void arg) throws AsterixException {
+ List<QuantifiedPair> quantifiedPairs = new ArrayList<>();
+ for (QuantifiedPair pair : qe.getQuantifiedList()) {
+ Expression expr = (Expression) pair.getExpr().accept(this, arg);
+ VariableExpr var = (VariableExpr) pair.getVarExpr().accept(this, arg);
+ quantifiedPairs.add(new QuantifiedPair(var, expr));
+ }
+ Expression condition = (Expression) qe.getSatisfiesExpr().accept(this, arg);
+ return new QuantifiedExpression(qe.getQuantifier(), quantifiedPairs, condition);
+ }
+
+ @Override
+ public CallExpr visit(CallExpr callExpr, Void arg) throws AsterixException {
+ List<Expression> newExprList = new ArrayList<Expression>();
+ for (Expression expr : callExpr.getExprList()) {
+ newExprList.add((Expression) expr.accept(this, arg));
+ }
+ return new CallExpr(callExpr.getFunctionSignature(), newExprList);
+ }
+
+ @Override
+ public VariableExpr visit(VariableExpr varExpr, Void arg) throws AsterixException {
+ return new VariableExpr(varExpr.getVar());
+ }
+
+ @Override
+ public UnaryExpr visit(UnaryExpr u, Void arg) throws AsterixException {
+ return new UnaryExpr(u.getSign(), (Expression) u.getExpr().accept(this, arg));
+ }
+
+ @Override
+ public FieldAccessor visit(FieldAccessor fa, Void arg) throws AsterixException {
+ return new FieldAccessor((Expression) fa.getExpr().accept(this, arg), fa.getIdent());
+ }
+
+ @Override
+ public Expression visit(IndexAccessor ia, Void arg) throws AsterixException {
+ Expression expr = (Expression) ia.getExpr().accept(this, arg);
+ Expression indexExpr = null;
+ if (ia.getIndexExpr() != null) {
+ indexExpr = ia.getIndexExpr();
+ }
+ return new IndexAccessor(expr, indexExpr);
+ }
+
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java
new file mode 100644
index 0000000..6e70455
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java
@@ -0,0 +1,471 @@
+/*
+ * 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.
+ */
+package org.apache.asterix.lang.sqlpp.visitor;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Clause.ClauseType;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
+import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.clause.HavingClause;
+import org.apache.asterix.lang.sqlpp.clause.JoinClause;
+import org.apache.asterix.lang.sqlpp.clause.NestClause;
+import org.apache.asterix.lang.sqlpp.clause.Projection;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.clause.SelectClause;
+import org.apache.asterix.lang.sqlpp.clause.SelectElement;
+import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
+import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
+import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
+import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
+import org.apache.hyracks.algebricks.common.utils.Pair;
+
+public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Void, Collection<VariableExpr>> {
+
+ @Override
+ public Void visit(FromClause fromClause, Collection<VariableExpr> freeVars) throws AsterixException {
+ Collection<VariableExpr> bindingVars = new HashSet<>();
+ for (FromTerm fromTerm : fromClause.getFromTerms()) {
+ Collection<VariableExpr> fromTermFreeVars = new HashSet<>();
+ fromTerm.accept(this, fromTermFreeVars);
+
+ // Since a right from term can refer to variables defined in a left from term,
+ // we remove binding variables from the free variables.
+ fromTermFreeVars.removeAll(bindingVars);
+
+ // Adds binding variables.
+ bindingVars.addAll(SqlppVariableUtil.getBindingVariables(fromTerm));
+
+ // Adds into freeVars.
+ freeVars.addAll(fromTermFreeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(FromTerm fromTerm, Collection<VariableExpr> freeVars) throws AsterixException {
+ // The encountered binding variables so far in the fromterm.
+ Collection<VariableExpr> bindingVariables = new HashSet<>();
+
+ // Visit the left expression of a from term.
+ fromTerm.getLeftExpression().accept(this, freeVars);
+
+ // Adds binding variables.
+ bindingVariables.add(fromTerm.getLeftVariable());
+ if (fromTerm.hasPositionalVariable()) {
+ bindingVariables.add(fromTerm.getPositionalVariable());
+ }
+
+ // Visits join/unnest/nest clauses.
+ for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
+ Collection<VariableExpr> correlateFreeVars = new HashSet<>();
+ correlateClause.accept(this, correlateFreeVars);
+ if (correlateClause.getClauseType() != ClauseType.JOIN_CLAUSE) {
+ // Correlation is allowed if the clause is not a join clause,
+ // therefore we remove left-side binding variables for these cases.
+ correlateFreeVars.removeAll(bindingVariables);
+
+ // Adds binding variables.
+ bindingVariables.add(correlateClause.getRightVariable());
+ if (correlateClause.hasPositionalVariable()) {
+ bindingVariables.add(correlateClause.getPositionalVariable());
+ }
+ }
+ freeVars.addAll(correlateFreeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(JoinClause joinClause, Collection<VariableExpr> freeVars) throws AsterixException {
+ visitJoinAndNest(joinClause, joinClause.getConditionExpression(), freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(NestClause nestClause, Collection<VariableExpr> freeVars) throws AsterixException {
+ visitJoinAndNest(nestClause, nestClause.getConditionExpression(), freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(UnnestClause unnestClause, Collection<VariableExpr> freeVars) throws AsterixException {
+ unnestClause.getRightExpression().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(Projection projection, Collection<VariableExpr> freeVars) throws AsterixException {
+ projection.getExpression().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(SelectBlock selectBlock, Collection<VariableExpr> freeVars) throws AsterixException {
+ Collection<VariableExpr> selectFreeVars = new HashSet<>();
+ Collection<VariableExpr> fromFreeVars = new HashSet<>();
+ Collection<VariableExpr> letsFreeVars = new HashSet<>();
+ Collection<VariableExpr> whereFreeVars = new HashSet<>();
+ Collection<VariableExpr> gbyFreeVars = new HashSet<>();
+ Collection<VariableExpr> gbyLetsFreeVars = new HashSet<>();
+
+ Collection<VariableExpr> fromBindingVars = SqlppVariableUtil.getBindingVariables(selectBlock.getFromClause());
+ Collection<VariableExpr> letsBindingVars = SqlppVariableUtil.getBindingVariables(selectBlock.getLetList());
+ Collection<VariableExpr> gbyBindingVars = SqlppVariableUtil.getBindingVariables(selectBlock.getGroupbyClause());
+ Collection<VariableExpr> gbyLetsBindingVars = SqlppVariableUtil
+ .getBindingVariables(selectBlock.getLetListAfterGroupby());
+
+ selectBlock.getSelectClause().accept(this, selectFreeVars);
+ // Removes group-by, from, let, and gby-let binding vars.
+ removeAllBindingVarsInSelectBlock(selectFreeVars, fromBindingVars, letsBindingVars, gbyLetsBindingVars);
+
+ if (selectBlock.hasFromClause()) {
+ selectBlock.getFromClause().accept(this, fromFreeVars);
+ }
+ if (selectBlock.hasLetClauses()) {
+ visitLetClauses(selectBlock.getLetList(), letsFreeVars);
+ letsFreeVars.removeAll(fromBindingVars);
+ }
+ if (selectBlock.hasWhereClause()) {
+ selectBlock.getWhereClause().accept(this, whereFreeVars);
+ whereFreeVars.removeAll(fromBindingVars);
+ whereFreeVars.removeAll(letsBindingVars);
+ }
+ if (selectBlock.hasGroupbyClause()) {
+ selectBlock.getGroupbyClause().accept(this, gbyFreeVars);
+ // Remove group-by and let binding vars.
+ gbyFreeVars.removeAll(fromBindingVars);
+ gbyFreeVars.removeAll(letsBindingVars);
+ if (selectBlock.hasLetClausesAfterGroupby()) {
+ visitLetClauses(selectBlock.getLetListAfterGroupby(), gbyLetsFreeVars);
+ gbyLetsFreeVars.removeAll(fromBindingVars);
+ gbyLetsFreeVars.removeAll(letsBindingVars);
+ gbyLetsFreeVars.removeAll(gbyBindingVars);
+ }
+ if (selectBlock.hasHavingClause()) {
+ selectBlock.getHavingClause().accept(this, selectFreeVars);
+ removeAllBindingVarsInSelectBlock(selectFreeVars, fromBindingVars, letsBindingVars, gbyLetsBindingVars);
+ }
+ }
+
+ // Removes all binding vars from <code>freeVars</code>, which contains the free
+ // vars in the order-by and limit.
+ removeAllBindingVarsInSelectBlock(freeVars, fromBindingVars, letsBindingVars, gbyLetsBindingVars);
+
+ // Adds all free vars.
+ freeVars.addAll(selectFreeVars);
+ freeVars.addAll(fromFreeVars);
+ freeVars.addAll(letsFreeVars);
+ freeVars.addAll(whereFreeVars);
+ freeVars.addAll(gbyFreeVars);
+ freeVars.addAll(gbyLetsFreeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(SelectClause selectClause, Collection<VariableExpr> freeVars) throws AsterixException {
+ if (selectClause.selectElement()) {
+ selectClause.getSelectElement().accept(this, freeVars);
+ }
+ if (selectClause.selectRegular()) {
+ selectClause.getSelectRegular().accept(this, freeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(SelectElement selectElement, Collection<VariableExpr> freeVars) throws AsterixException {
+ selectElement.getExpression().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(SelectRegular selectRegular, Collection<VariableExpr> freeVars) throws AsterixException {
+ for (Projection projection : selectRegular.getProjections()) {
+ projection.accept(this, freeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(SelectSetOperation selectSetOperation, Collection<VariableExpr> freeVars)
+ throws AsterixException {
+ selectSetOperation.getLeftInput().accept(this, freeVars);
+ for (SetOperationRight right : selectSetOperation.getRightInputs()) {
+ right.getSetOperationRightInput().accept(this, freeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(HavingClause havingClause, Collection<VariableExpr> freeVars) throws AsterixException {
+ havingClause.getFilterExpression().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(Query q, Collection<VariableExpr> freeVars) throws AsterixException {
+ q.getBody().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(FunctionDecl fd, Collection<VariableExpr> freeVars) throws AsterixException {
+ fd.getFuncBody().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(WhereClause whereClause, Collection<VariableExpr> freeVars) throws AsterixException {
+ whereClause.getWhereExpr().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(OrderbyClause oc, Collection<VariableExpr> freeVars) throws AsterixException {
+ for (Expression orderExpr : oc.getOrderbyList()) {
+ orderExpr.accept(this, freeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(GroupbyClause gc, Collection<VariableExpr> freeVars) throws AsterixException {
+ // Puts all group-by variables into the symbol set of the new scope.
+ for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
+ gbyVarExpr.getExpr().accept(this, freeVars);
+ }
+ for (GbyVariableExpressionPair decorVarExpr : gc.getDecorPairList()) {
+ decorVarExpr.getExpr().accept(this, freeVars);
+ }
+ if (gc.hasGroupFieldList()) {
+ for (Pair<Expression, Identifier> groupField : gc.getGroupFieldList()) {
+ groupField.first.accept(this, freeVars);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(LimitClause limitClause, Collection<VariableExpr> freeVars) throws AsterixException {
+ limitClause.getLimitExpr().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(LetClause letClause, Collection<VariableExpr> freeVars) throws AsterixException {
+ letClause.getBindingExpr().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(SelectExpression selectExpression, Collection<VariableExpr> freeVars) throws AsterixException {
+ Collection<VariableExpr> letsFreeVars = new HashSet<>();
+ Collection<VariableExpr> selectFreeVars = new HashSet<>();
+ visitLetClauses(selectExpression.getLetList(), letsFreeVars);
+
+ // visit order by
+ if (selectExpression.hasOrderby()) {
+ for (Expression orderExpr : selectExpression.getOrderbyClause().getOrderbyList()) {
+ orderExpr.accept(this, selectFreeVars);
+ }
+ }
+
+ // visit limit
+ if (selectExpression.hasLimit()) {
+ selectExpression.getLimitClause().accept(this, selectFreeVars);
+ }
+
+ // visit the main select
+ selectExpression.getSelectSetOperation().accept(this, selectFreeVars);
+
+ // Removed let binding variables.
+ selectFreeVars.removeAll(SqlppVariableUtil.getBindingVariables(selectExpression.getLetList()));
+ freeVars.addAll(letsFreeVars);
+ freeVars.addAll(selectFreeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(LiteralExpr l, Collection<VariableExpr> freeVars) throws AsterixException {
+ return null;
+ }
+
+ @Override
+ public Void visit(ListConstructor lc, Collection<VariableExpr> freeVars) throws AsterixException {
+ for (Expression expr : lc.getExprList()) {
+ expr.accept(this, freeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(RecordConstructor rc, Collection<VariableExpr> freeVars) throws AsterixException {
+ for (FieldBinding binding : rc.getFbList()) {
+ binding.getLeftExpr().accept(this, freeVars);
+ binding.getRightExpr().accept(this, freeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(OperatorExpr operatorExpr, Collection<VariableExpr> freeVars) throws AsterixException {
+ for (Expression expr : operatorExpr.getExprList()) {
+ expr.accept(this, freeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(IfExpr ifExpr, Collection<VariableExpr> freeVars) throws AsterixException {
+ ifExpr.getCondExpr().accept(this, freeVars);
+ ifExpr.getThenExpr().accept(this, freeVars);
+ ifExpr.getElseExpr().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(QuantifiedExpression qe, Collection<VariableExpr> freeVars) throws AsterixException {
+ for (QuantifiedPair pair : qe.getQuantifiedList()) {
+ pair.getExpr().accept(this, freeVars);
+ }
+ qe.getSatisfiesExpr().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(CallExpr callExpr, Collection<VariableExpr> freeVars) throws AsterixException {
+ for (Expression expr : callExpr.getExprList()) {
+ expr.accept(this, freeVars);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(VariableExpr varExpr, Collection<VariableExpr> freeVars) throws AsterixException {
+ freeVars.add(varExpr);
+ return null;
+ }
+
+ @Override
+ public Void visit(UnaryExpr u, Collection<VariableExpr> freeVars) throws AsterixException {
+ u.getExpr().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(FieldAccessor fa, Collection<VariableExpr> freeVars) throws AsterixException {
+ fa.getExpr().accept(this, freeVars);
+ return null;
+ }
+
+ @Override
+ public Void visit(IndexAccessor ia, Collection<VariableExpr> freeVars) throws AsterixException {
+ ia.getExpr().accept(this, freeVars);
+ if (ia.getIndexExpr() != null) {
+ ia.getIndexExpr();
+ }
+ return null;
+ }
+
+ private void visitLetClauses(List<LetClause> letClauses, Collection<VariableExpr> freeVars)
+ throws AsterixException {
+ if (letClauses == null || letClauses.isEmpty()) {
+ return;
+ }
+ Collection<VariableExpr> bindingVars = new HashSet<>();
+ for (LetClause letClause : letClauses) {
+ Collection<VariableExpr> letFreeVars = new HashSet<>();
+ letClause.accept(this, letFreeVars);
+
+ // Removes previous binding variables.
+ letFreeVars.removeAll(bindingVars);
+ freeVars.addAll(letFreeVars);
+
+ // Adds let binding variables into the binding variable collection.
+ bindingVars.add(letClause.getVarExpr());
+ }
+ }
+
+ private void visitJoinAndNest(AbstractBinaryCorrelateClause clause, Expression condition,
+ Collection<VariableExpr> freeVars) throws AsterixException {
+ clause.getRightExpression().accept(this, freeVars);
+ Collection<VariableExpr> conditionFreeVars = new HashSet<>();
+ condition.accept(this, freeVars);
+
+ // The condition expression can free binding variables defined in the join clause.
+ conditionFreeVars.remove(clause.getRightVariable());
+ if (clause.hasPositionalVariable()) {
+ conditionFreeVars.remove(clause.getPositionalVariable());
+ }
+ freeVars.addAll(conditionFreeVars);
+ }
+
+ /**
+ * Removes all binding variables defined in the select block for a free variable collection.
+ *
+ * @param freeVars,
+ * free variables.
+ * @param fromBindingVars,
+ * binding variables defined in the from clause of a select block.
+ * @param letsBindingVars,
+ * binding variables defined in the let clauses of the select block.
+ * @param gbyLetsBindingVars,
+ * binding variables defined in the let clauses after a group-by in the select block.
+ */
+ private void removeAllBindingVarsInSelectBlock(Collection<VariableExpr> selectFreeVars,
+ Collection<VariableExpr> fromBindingVars, Collection<VariableExpr> letsBindingVars,
+ Collection<VariableExpr> gbyLetsBindingVars) {
+ selectFreeVars.removeAll(fromBindingVars);
+ selectFreeVars.removeAll(letsBindingVars);
+ selectFreeVars.removeAll(gbyLetsBindingVars);
+ selectFreeVars.removeAll(gbyLetsBindingVars);
+ }
+
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
index df32b01..0f36646 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
@@ -21,9 +21,11 @@
import java.io.PrintWriter;
import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.functions.FunctionSignature;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.clause.GroupbyClause;
import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
import org.apache.asterix.lang.common.struct.Identifier;
import org.apache.asterix.lang.common.visitor.QueryPrintVisitor;
@@ -42,7 +44,9 @@
import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
+import org.apache.asterix.lang.sqlpp.util.FunctionMapUtil;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.hyracks.algebricks.common.utils.Pair;
public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVisitor<Void, Integer> {
@@ -243,7 +247,27 @@
}
@Override
+ public Void visit(CallExpr pf, Integer step) throws AsterixException {
+ FunctionSignature functionSignature = pf.getFunctionSignature();
+ FunctionSignature normalizedFunctionSignature = FunctionMapUtil
+ .normalizeBuiltinFunctionSignature(functionSignature, false);
+ if (AsterixBuiltinFunctions.isBuiltinCompilerFunction(normalizedFunctionSignature, true)) {
+ functionSignature = normalizedFunctionSignature;
+ }
+ out.println(skip(step) + "FunctionCall " + functionSignature.toString() + "[");
+ for (Expression expr : pf.getExprList()) {
+ expr.accept(this, step + 1);
+ }
+ out.println(skip(step) + "]");
+ return null;
+ }
+
+ @Override
public Void visit(GroupbyClause gc, Integer step) throws AsterixException {
+ if (gc.isGroupAll()) {
+ out.println(skip(step) + "Group All");
+ return null;
+ }
out.println(skip(step) + "Groupby");
for (GbyVariableExpressionPair pair : gc.getGbyPairList()) {
if (pair.getVar() != null) {
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppDeleteRewriteVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppDeleteRewriteVisitor.java
index 5a15772..efff18e 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppDeleteRewriteVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppDeleteRewriteVisitor.java
@@ -84,7 +84,7 @@
SelectBlock selectBlock = new SelectBlock(selectClause, fromClause, null, whereClause, null, null, null);
SelectSetOperation selectSetOperation = new SelectSetOperation(new SetOperationInput(selectBlock, null), null);
SelectExpression selectExpression = new SelectExpression(null, selectSetOperation, null, null, false);
- Query query = new Query();
+ Query query = new Query(false, selectExpression, 0, new ArrayList<>(), new ArrayList<>());
query.setBody(selectExpression);
// return the delete statement.
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java
index a9aff55..f737eb7 100644
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java
@@ -18,10 +18,12 @@
*/
package org.apache.asterix.lang.sqlpp.visitor;
+import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
import org.apache.asterix.lang.common.rewrites.VariableSubstitutionEnvironment;
+import org.apache.asterix.lang.sqlpp.util.SqlppRewriteUtil;
public class SqlppSubstituteVariablesVisitor extends SqlppCloneAndSubstituteVariablesVisitor {
@@ -30,9 +32,10 @@
}
@Override
- protected Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env) {
+ protected Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env)
+ throws AsterixException {
if (env.constainsOldVar(expr)) {
- return env.findSubstituion(expr);
+ return (Expression) SqlppRewriteUtil.deepCopy(env.findSubstituion(expr));
}
return expr;
}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/UsedVariableVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/UsedVariableVisitor.java
deleted file mode 100644
index 877f722..0000000
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/UsedVariableVisitor.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * 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.
- */
-package org.apache.asterix.lang.sqlpp.visitor;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.lang.common.base.Expression;
-import org.apache.asterix.lang.common.clause.GroupbyClause;
-import org.apache.asterix.lang.common.clause.LetClause;
-import org.apache.asterix.lang.common.clause.LimitClause;
-import org.apache.asterix.lang.common.clause.OrderbyClause;
-import org.apache.asterix.lang.common.clause.WhereClause;
-import org.apache.asterix.lang.common.expression.CallExpr;
-import org.apache.asterix.lang.common.expression.FieldAccessor;
-import org.apache.asterix.lang.common.expression.FieldBinding;
-import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
-import org.apache.asterix.lang.common.expression.IfExpr;
-import org.apache.asterix.lang.common.expression.IndexAccessor;
-import org.apache.asterix.lang.common.expression.ListConstructor;
-import org.apache.asterix.lang.common.expression.LiteralExpr;
-import org.apache.asterix.lang.common.expression.OperatorExpr;
-import org.apache.asterix.lang.common.expression.QuantifiedExpression;
-import org.apache.asterix.lang.common.expression.RecordConstructor;
-import org.apache.asterix.lang.common.expression.UnaryExpr;
-import org.apache.asterix.lang.common.expression.VariableExpr;
-import org.apache.asterix.lang.common.statement.FunctionDecl;
-import org.apache.asterix.lang.common.statement.Query;
-import org.apache.asterix.lang.common.struct.Identifier;
-import org.apache.asterix.lang.common.struct.QuantifiedPair;
-import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
-import org.apache.asterix.lang.sqlpp.clause.FromClause;
-import org.apache.asterix.lang.sqlpp.clause.FromTerm;
-import org.apache.asterix.lang.sqlpp.clause.HavingClause;
-import org.apache.asterix.lang.sqlpp.clause.JoinClause;
-import org.apache.asterix.lang.sqlpp.clause.NestClause;
-import org.apache.asterix.lang.sqlpp.clause.Projection;
-import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
-import org.apache.asterix.lang.sqlpp.clause.SelectClause;
-import org.apache.asterix.lang.sqlpp.clause.SelectElement;
-import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
-import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
-import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
-import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
-import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
-import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
-import org.apache.hyracks.algebricks.common.utils.Pair;
-
-public class UsedVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Void, Collection<VariableExpr>> {
-
- @Override
- public Void visit(FromClause fromClause, Collection<VariableExpr> usedVars) throws AsterixException {
- for (FromTerm fromTerm : fromClause.getFromTerms()) {
- fromTerm.accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(FromTerm fromTerm, Collection<VariableExpr> usedVars) throws AsterixException {
- // Visit the left expression of a from term.
- fromTerm.getLeftExpression().accept(this, usedVars);
-
- // Visits join/unnest/nest clauses.
- for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
- correlateClause.accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(JoinClause joinClause, Collection<VariableExpr> usedVars) throws AsterixException {
- // NOTE: the two join branches cannot be correlated, instead of checking
- // the correlation here,
- // we defer the check to the query optimizer.
- joinClause.getRightExpression().accept(this, usedVars);
-
- // The condition expression can refer to the just registered variables
- // for the right branch.
- joinClause.getConditionExpression().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(NestClause nestClause, Collection<VariableExpr> usedVars) throws AsterixException {
- // NOTE: the two branches of a NEST cannot be correlated, instead of
- // checking the correlation here, we defer the check to the query
- // optimizer.
- nestClause.getRightExpression().accept(this, usedVars);
-
- // The condition expression can refer to the just registered variables
- // for the right branch.
- nestClause.getConditionExpression().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(UnnestClause unnestClause, Collection<VariableExpr> usedVars) throws AsterixException {
- unnestClause.getRightExpression().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(Projection projection, Collection<VariableExpr> usedVars) throws AsterixException {
- projection.getExpression().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(SelectBlock selectBlock, Collection<VariableExpr> usedVars) throws AsterixException {
- // Traverses the select block in the order of "from", "let"s, "where",
- // "group by", "let"s, "having" and "select".
- if (selectBlock.hasFromClause()) {
- selectBlock.getFromClause().accept(this, usedVars);
- }
- if (selectBlock.hasLetClauses()) {
- List<LetClause> letList = selectBlock.getLetList();
- for (LetClause letClause : letList) {
- letClause.accept(this, usedVars);
- }
- }
- if (selectBlock.hasWhereClause()) {
- selectBlock.getWhereClause().accept(this, usedVars);
- }
- if (selectBlock.hasGroupbyClause()) {
- selectBlock.getGroupbyClause().accept(this, usedVars);
- if (selectBlock.hasLetClausesAfterGroupby()) {
- List<LetClause> letListAfterGby = selectBlock.getLetListAfterGroupby();
- for (LetClause letClauseAfterGby : letListAfterGby) {
- letClauseAfterGby.accept(this, usedVars);
- }
- }
- if (selectBlock.hasHavingClause()) {
- selectBlock.getHavingClause().accept(this, usedVars);
- }
- }
- selectBlock.getSelectClause().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(SelectClause selectClause, Collection<VariableExpr> usedVars) throws AsterixException {
- if (selectClause.selectElement()) {
- selectClause.getSelectElement().accept(this, usedVars);
- }
- if (selectClause.selectRegular()) {
- selectClause.getSelectRegular().accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(SelectElement selectElement, Collection<VariableExpr> usedVars) throws AsterixException {
- selectElement.getExpression().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(SelectRegular selectRegular, Collection<VariableExpr> usedVars) throws AsterixException {
- for (Projection projection : selectRegular.getProjections()) {
- projection.accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(SelectSetOperation selectSetOperation, Collection<VariableExpr> usedVars)
- throws AsterixException {
- selectSetOperation.getLeftInput().accept(this, usedVars);
- for (SetOperationRight right : selectSetOperation.getRightInputs()) {
- right.getSetOperationRightInput().accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(HavingClause havingClause, Collection<VariableExpr> usedVars) throws AsterixException {
- havingClause.getFilterExpression().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(Query q, Collection<VariableExpr> usedVars) throws AsterixException {
- q.getBody().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(FunctionDecl fd, Collection<VariableExpr> usedVars) throws AsterixException {
- fd.getFuncBody().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(WhereClause whereClause, Collection<VariableExpr> usedVars) throws AsterixException {
- whereClause.getWhereExpr().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(OrderbyClause oc, Collection<VariableExpr> usedVars) throws AsterixException {
- for (Expression orderExpr : oc.getOrderbyList()) {
- orderExpr.accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(GroupbyClause gc, Collection<VariableExpr> usedVars) throws AsterixException {
- // Puts all group-by variables into the symbol set of the new scope.
- for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
- gbyVarExpr.getExpr().accept(this, usedVars);
- }
- for (GbyVariableExpressionPair decorVarExpr : gc.getDecorPairList()) {
- decorVarExpr.getExpr().accept(this, usedVars);
- }
- if (gc.hasGroupFieldList()) {
- for (Pair<Expression, Identifier> groupField : gc.getGroupFieldList()) {
- groupField.first.accept(this, usedVars);
- }
- }
- return null;
- }
-
- @Override
- public Void visit(LimitClause limitClause, Collection<VariableExpr> usedVars) throws AsterixException {
- limitClause.getLimitExpr().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(LetClause letClause, Collection<VariableExpr> usedVars) throws AsterixException {
- letClause.getBindingExpr().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(SelectExpression selectExpression, Collection<VariableExpr> usedVars) throws AsterixException {
- // visit let list
- if (selectExpression.hasLetClauses()) {
- for (LetClause letClause : selectExpression.getLetList()) {
- letClause.accept(this, usedVars);
- }
- }
-
- // visit the main select.
- selectExpression.getSelectSetOperation().accept(this, usedVars);
-
- // visit order by
- if (selectExpression.hasOrderby()) {
- for (Expression orderExpr : selectExpression.getOrderbyClause().getOrderbyList()) {
- orderExpr.accept(this, usedVars);
- }
- }
-
- // visit limit
- if (selectExpression.hasLimit()) {
- selectExpression.getLimitClause().accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(LiteralExpr l, Collection<VariableExpr> usedVars) throws AsterixException {
- return null;
- }
-
- @Override
- public Void visit(ListConstructor lc, Collection<VariableExpr> usedVars) throws AsterixException {
- for (Expression expr : lc.getExprList()) {
- expr.accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(RecordConstructor rc, Collection<VariableExpr> usedVars) throws AsterixException {
- for (FieldBinding binding : rc.getFbList()) {
- binding.getLeftExpr().accept(this, usedVars);
- binding.getRightExpr().accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(OperatorExpr operatorExpr, Collection<VariableExpr> usedVars) throws AsterixException {
- for (Expression expr : operatorExpr.getExprList()) {
- expr.accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(IfExpr ifExpr, Collection<VariableExpr> usedVars) throws AsterixException {
- ifExpr.getCondExpr().accept(this, usedVars);
- ifExpr.getThenExpr().accept(this, usedVars);
- ifExpr.getElseExpr().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(QuantifiedExpression qe, Collection<VariableExpr> usedVars) throws AsterixException {
- for (QuantifiedPair pair : qe.getQuantifiedList()) {
- pair.getExpr().accept(this, usedVars);
- }
- qe.getSatisfiesExpr().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(CallExpr callExpr, Collection<VariableExpr> usedVars) throws AsterixException {
- for (Expression expr : callExpr.getExprList()) {
- expr.accept(this, usedVars);
- }
- return null;
- }
-
- @Override
- public Void visit(VariableExpr varExpr, Collection<VariableExpr> usedVars) throws AsterixException {
- usedVars.add(varExpr);
- return null;
- }
-
- @Override
- public Void visit(UnaryExpr u, Collection<VariableExpr> usedVars) throws AsterixException {
- u.getExpr().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(FieldAccessor fa, Collection<VariableExpr> usedVars) throws AsterixException {
- fa.getExpr().accept(this, usedVars);
- return null;
- }
-
- @Override
- public Void visit(IndexAccessor ia, Collection<VariableExpr> usedVars) throws AsterixException {
- ia.getExpr().accept(this, usedVars);
- if (ia.getIndexExpr() != null) {
- ia.getIndexExpr();
- }
- return null;
- }
-
-}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/VariableCheckAndRewriteVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/VariableCheckAndRewriteVisitor.java
deleted file mode 100644
index f4456a4..0000000
--- a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/VariableCheckAndRewriteVisitor.java
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * 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.
- */
-package org.apache.asterix.lang.sqlpp.visitor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.asterix.common.config.MetadataConstants;
-import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.common.functions.FunctionSignature;
-import org.apache.asterix.lang.common.base.Expression;
-import org.apache.asterix.lang.common.clause.GroupbyClause;
-import org.apache.asterix.lang.common.clause.LetClause;
-import org.apache.asterix.lang.common.clause.LimitClause;
-import org.apache.asterix.lang.common.clause.OrderbyClause;
-import org.apache.asterix.lang.common.clause.WhereClause;
-import org.apache.asterix.lang.common.context.Scope;
-import org.apache.asterix.lang.common.expression.CallExpr;
-import org.apache.asterix.lang.common.expression.FieldAccessor;
-import org.apache.asterix.lang.common.expression.FieldBinding;
-import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
-import org.apache.asterix.lang.common.expression.IfExpr;
-import org.apache.asterix.lang.common.expression.IndexAccessor;
-import org.apache.asterix.lang.common.expression.ListConstructor;
-import org.apache.asterix.lang.common.expression.LiteralExpr;
-import org.apache.asterix.lang.common.expression.OperatorExpr;
-import org.apache.asterix.lang.common.expression.QuantifiedExpression;
-import org.apache.asterix.lang.common.expression.RecordConstructor;
-import org.apache.asterix.lang.common.expression.UnaryExpr;
-import org.apache.asterix.lang.common.expression.VariableExpr;
-import org.apache.asterix.lang.common.literal.StringLiteral;
-import org.apache.asterix.lang.common.parser.ScopeChecker;
-import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
-import org.apache.asterix.lang.common.statement.FunctionDecl;
-import org.apache.asterix.lang.common.statement.Query;
-import org.apache.asterix.lang.common.struct.Identifier;
-import org.apache.asterix.lang.common.struct.QuantifiedPair;
-import org.apache.asterix.lang.common.struct.VarIdentifier;
-import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
-import org.apache.asterix.lang.sqlpp.clause.FromClause;
-import org.apache.asterix.lang.sqlpp.clause.FromTerm;
-import org.apache.asterix.lang.sqlpp.clause.HavingClause;
-import org.apache.asterix.lang.sqlpp.clause.JoinClause;
-import org.apache.asterix.lang.sqlpp.clause.NestClause;
-import org.apache.asterix.lang.sqlpp.clause.Projection;
-import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
-import org.apache.asterix.lang.sqlpp.clause.SelectClause;
-import org.apache.asterix.lang.sqlpp.clause.SelectElement;
-import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
-import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
-import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
-import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
-import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
-import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
-import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
-import org.apache.hyracks.algebricks.core.algebra.base.Counter;
-
-public class VariableCheckAndRewriteVisitor extends AbstractSqlppQueryExpressionVisitor<Expression, Expression> {
-
- protected final ScopeChecker scopeChecker = new ScopeChecker();
- protected final LangRewritingContext context;
- protected final boolean overwrite;
- protected final AqlMetadataProvider metadataProvider;
-
- /**
- * @param context,
- * manages ids of variables and guarantees uniqueness of variables.
- * @param overwrite,
- * whether rewrite unbounded variables to dataset function calls.
- * This flag can only be true for rewriting a top-level query.
- * It should be false for rewriting the body expression of a user-defined function.
- */
- public VariableCheckAndRewriteVisitor(LangRewritingContext context, boolean overwrite,
- AqlMetadataProvider metadataProvider) {
- this.context = context;
- scopeChecker.setVarCounter(new Counter(context.getVarCounter()));
- this.overwrite = overwrite;
- this.metadataProvider = metadataProvider;
- }
-
- @Override
- public Expression visit(FromClause fromClause, Expression arg) throws AsterixException {
- scopeChecker.extendCurrentScope();
- for (FromTerm fromTerm : fromClause.getFromTerms()) {
- fromTerm.accept(this, arg);
- }
- return null;
- }
-
- @Override
- public Expression visit(FromTerm fromTerm, Expression arg) throws AsterixException {
- scopeChecker.createNewScope();
- // Visit the left expression of a from term.
- fromTerm.setLeftExpression(fromTerm.getLeftExpression().accept(this, arg));
-
- // Registers the data item variable.
- VariableExpr leftVar = fromTerm.getLeftVariable();
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(leftVar.getVar());
-
- // Registers the positional variable
- if (fromTerm.hasPositionalVariable()) {
- VariableExpr posVar = fromTerm.getPositionalVariable();
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
- }
- // Visits join/unnest/nest clauses.
- for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
- correlateClause.accept(this, arg);
- }
- return null;
- }
-
- @Override
- public Expression visit(JoinClause joinClause, Expression arg) throws AsterixException {
- Scope backupScope = scopeChecker.removeCurrentScope();
- Scope parentScope = scopeChecker.getCurrentScope();
- scopeChecker.createNewScope();
- // NOTE: the two join branches cannot be correlated, instead of checking
- // the correlation here,
- // we defer the check to the query optimizer.
- joinClause.setRightExpression(joinClause.getRightExpression().accept(this, arg));
-
- // Registers the data item variable.
- VariableExpr rightVar = joinClause.getRightVariable();
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(rightVar.getVar());
-
- if (joinClause.hasPositionalVariable()) {
- // Registers the positional variable.
- VariableExpr posVar = joinClause.getPositionalVariable();
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
- }
-
- Scope rightScope = scopeChecker.removeCurrentScope();
- Scope mergedScope = new Scope(scopeChecker, parentScope);
- mergedScope.merge(backupScope);
- mergedScope.merge(rightScope);
- scopeChecker.pushExistingScope(mergedScope);
- // The condition expression can refer to the just registered variables
- // for the right branch.
- joinClause.setConditionExpression(joinClause.getConditionExpression().accept(this, arg));
- return null;
- }
-
- @Override
- public Expression visit(NestClause nestClause, Expression arg) throws AsterixException {
- // NOTE: the two branches of a NEST cannot be correlated, instead of
- // checking the correlation here, we defer the check to the query
- // optimizer.
- nestClause.setRightExpression(nestClause.getRightExpression().accept(this, arg));
-
- // Registers the data item variable.
- VariableExpr rightVar = nestClause.getRightVariable();
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(rightVar.getVar());
-
- if (nestClause.hasPositionalVariable()) {
- // Registers the positional variable.
- VariableExpr posVar = nestClause.getPositionalVariable();
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
- }
-
- // The condition expression can refer to the just registered variables
- // for the right branch.
- nestClause.setConditionExpression(nestClause.getConditionExpression().accept(this, arg));
- return null;
- }
-
- @Override
- public Expression visit(UnnestClause unnestClause, Expression arg) throws AsterixException {
- unnestClause.setRightExpression(unnestClause.getRightExpression().accept(this, arg));
-
- // register the data item variable
- VariableExpr rightVar = unnestClause.getRightVariable();
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(rightVar.getVar());
-
- if (unnestClause.hasPositionalVariable()) {
- // register the positional variable
- VariableExpr posVar = unnestClause.getPositionalVariable();
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
- }
- return null;
- }
-
- @Override
- public Expression visit(Projection projection, Expression arg) throws AsterixException {
- projection.setExpression(projection.getExpression().accept(this, arg));
- return null;
- }
-
- @Override
- public Expression visit(SelectBlock selectBlock, Expression arg) throws AsterixException {
- // Traverses the select block in the order of "from", "let"s, "where",
- // "group by", "let"s, "having" and "select".
- if (selectBlock.hasFromClause()) {
- selectBlock.getFromClause().accept(this, arg);
- }
- if (selectBlock.hasLetClauses()) {
- List<LetClause> letList = selectBlock.getLetList();
- for (LetClause letClause : letList) {
- letClause.accept(this, arg);
- }
- }
- if (selectBlock.hasWhereClause()) {
- selectBlock.getWhereClause().accept(this, arg);
- }
- if (selectBlock.hasGroupbyClause()) {
- selectBlock.getGroupbyClause().accept(this, arg);
- if (selectBlock.hasLetClausesAfterGroupby()) {
- List<LetClause> letListAfterGby = selectBlock.getLetListAfterGroupby();
- for (LetClause letClauseAfterGby : letListAfterGby) {
- letClauseAfterGby.accept(this, arg);
- }
- }
- if (selectBlock.hasHavingClause()) {
- // Rewrites the having clause.
- selectBlock.getHavingClause().accept(this, arg);
- }
- }
- selectBlock.getSelectClause().accept(this, arg);
- return null;
- }
-
- @Override
- public Expression visit(SelectClause selectClause, Expression arg) throws AsterixException {
- if (selectClause.selectElement()) {
- selectClause.getSelectElement().accept(this, arg);
- }
- if (selectClause.selectRegular()) {
- selectClause.getSelectRegular().accept(this, arg);
- }
- return null;
- }
-
- @Override
- public Expression visit(SelectElement selectElement, Expression arg) throws AsterixException {
- selectElement.setExpression(selectElement.getExpression().accept(this, arg));
- return null;
- }
-
- @Override
- public Expression visit(SelectRegular selectRegular, Expression arg) throws AsterixException {
- for (Projection projection : selectRegular.getProjections()) {
- projection.accept(this, arg);
- }
- return null;
- }
-
- @Override
- public Expression visit(SelectSetOperation selectSetOperation, Expression arg) throws AsterixException {
- selectSetOperation.getLeftInput().accept(this, arg);
- for (SetOperationRight right : selectSetOperation.getRightInputs()) {
- scopeChecker.createNewScope();
- right.getSetOperationRightInput().accept(this, arg);
- }
- return null;
- }
-
- @Override
- public Expression visit(HavingClause havingClause, Expression arg) throws AsterixException {
- havingClause.setFilterExpression(havingClause.getFilterExpression().accept(this, arg));
- return null;
- }
-
- @Override
- public Expression visit(Query q, Expression arg) throws AsterixException {
- q.setBody(q.getBody().accept(this, arg));
- q.setVarCounter(scopeChecker.getVarCounter());
- context.setVarCounter(scopeChecker.getVarCounter());
- return null;
- }
-
- @Override
- public Expression visit(FunctionDecl fd, Expression arg) throws AsterixException {
- scopeChecker.createNewScope();
- fd.setFuncBody(fd.getFuncBody().accept(this, arg));
- scopeChecker.removeCurrentScope();
- return null;
- }
-
- @Override
- public Expression visit(WhereClause whereClause, Expression arg) throws AsterixException {
- whereClause.setWhereExpr(whereClause.getWhereExpr().accept(this, arg));
- return null;
- }
-
- @Override
- public Expression visit(OrderbyClause oc, Expression arg) throws AsterixException {
- List<Expression> newOrderbyList = new ArrayList<Expression>();
- for (Expression orderExpr : oc.getOrderbyList()) {
- newOrderbyList.add(orderExpr.accept(this, arg));
- }
- oc.setOrderbyList(newOrderbyList);
- return null;
- }
-
- @Override
- public Expression visit(GroupbyClause gc, Expression arg) throws AsterixException {
- Scope newScope = scopeChecker.extendCurrentScopeNoPush(true);
- // Puts all group-by variables into the symbol set of the new scope.
- for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
- gbyVarExpr.setExpr(gbyVarExpr.getExpr().accept(this, arg));
- VariableExpr gbyVar = gbyVarExpr.getVar();
- if (gbyVar != null) {
- newScope.addNewVarSymbolToScope(gbyVarExpr.getVar().getVar());
- }
- }
- for (VariableExpr withVar : gc.getWithVarList()) {
- newScope.addNewVarSymbolToScope(withVar.getVar());
- }
- scopeChecker.replaceCurrentScope(newScope);
- return null;
- }
-
- @Override
- public Expression visit(LimitClause limitClause, Expression arg) throws AsterixException {
- scopeChecker.pushForbiddenScope(scopeChecker.getCurrentScope());
- limitClause.setLimitExpr(limitClause.getLimitExpr().accept(this, arg));
- scopeChecker.popForbiddenScope();
- return null;
- }
-
- @Override
- public Expression visit(LetClause letClause, Expression arg) throws AsterixException {
- scopeChecker.extendCurrentScope();
- letClause.setBindingExpr(letClause.getBindingExpr().accept(this, arg));
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(letClause.getVarExpr().getVar());
- return null;
- }
-
- @Override
- public Expression visit(SelectExpression selectExpression, Expression arg) throws AsterixException {
- Scope scopeBeforeSelectExpression = scopeChecker.getCurrentScope();
- scopeChecker.createNewScope();
-
- // visit let list
- if (selectExpression.hasLetClauses()) {
- for (LetClause letClause : selectExpression.getLetList()) {
- letClause.accept(this, arg);
- }
- }
-
- // visit the main select.
- selectExpression.getSelectSetOperation().accept(this, selectExpression);
-
- // visit order by
- if (selectExpression.hasOrderby()) {
- selectExpression.getOrderbyClause().accept(this, arg);
- }
-
- // visit limit
- if (selectExpression.hasLimit()) {
- selectExpression.getLimitClause().accept(this, arg);
- }
-
- // Exit scopes that were entered within this select expression
- while (scopeChecker.getCurrentScope() != scopeBeforeSelectExpression) {
- scopeChecker.removeCurrentScope();
- }
- return selectExpression;
- }
-
- @Override
- public Expression visit(LiteralExpr l, Expression arg) throws AsterixException {
- return l;
- }
-
- @Override
- public Expression visit(ListConstructor lc, Expression arg) throws AsterixException {
- List<Expression> newExprList = new ArrayList<Expression>();
- for (Expression expr : lc.getExprList()) {
- newExprList.add(expr.accept(this, arg));
- }
- lc.setExprList(newExprList);
- return lc;
- }
-
- @Override
- public Expression visit(RecordConstructor rc, Expression arg) throws AsterixException {
- for (FieldBinding binding : rc.getFbList()) {
- binding.setLeftExpr(binding.getLeftExpr().accept(this, arg));
- binding.setRightExpr(binding.getRightExpr().accept(this, arg));
- }
- return rc;
- }
-
- @Override
- public Expression visit(OperatorExpr operatorExpr, Expression arg) throws AsterixException {
- List<Expression> newExprList = new ArrayList<Expression>();
- for (Expression expr : operatorExpr.getExprList()) {
- newExprList.add(expr.accept(this, arg));
- }
- operatorExpr.setExprList(newExprList);
- return operatorExpr;
- }
-
- @Override
- public Expression visit(IfExpr ifExpr, Expression arg) throws AsterixException {
- ifExpr.setCondExpr(ifExpr.getCondExpr().accept(this, arg));
- ifExpr.setThenExpr(ifExpr.getThenExpr().accept(this, arg));
- ifExpr.setElseExpr(ifExpr.getElseExpr().accept(this, arg));
- return ifExpr;
- }
-
- @Override
- public Expression visit(QuantifiedExpression qe, Expression arg) throws AsterixException {
- scopeChecker.createNewScope();
- for (QuantifiedPair pair : qe.getQuantifiedList()) {
- scopeChecker.getCurrentScope().addNewVarSymbolToScope(pair.getVarExpr().getVar());
- pair.setExpr(pair.getExpr().accept(this, arg));
- }
- qe.setSatisfiesExpr(qe.getSatisfiesExpr().accept(this, arg));
- scopeChecker.removeCurrentScope();
- return qe;
- }
-
- @Override
- public Expression visit(CallExpr callExpr, Expression arg) throws AsterixException {
- List<Expression> newExprList = new ArrayList<Expression>();
- for (Expression expr : callExpr.getExprList()) {
- newExprList.add(expr.accept(this, arg));
- }
- callExpr.setExprList(newExprList);
- return callExpr;
- }
-
- @Override
- public Expression visit(VariableExpr varExpr, Expression arg) throws AsterixException {
- String varName = varExpr.getVar().getValue();
- if (scopeChecker.isInForbiddenScopes(varName)) {
- throw new AsterixException(
- "Inside limit clauses, it is disallowed to reference a variable having the same name as any variable bound in the same scope as the limit clause.");
- }
- if (rewriteNeeded(varExpr)) {
- return datasetRewrite(varExpr);
- } else {
- return varExpr;
- }
- }
-
- @Override
- public Expression visit(UnaryExpr u, Expression arg) throws AsterixException {
- u.setExpr(u.getExpr().accept(this, arg));
- return u;
- }
-
- @Override
- public Expression visit(FieldAccessor fa, Expression arg) throws AsterixException {
- fa.setExpr(fa.getExpr().accept(this, arg));
- return fa;
- }
-
- @Override
- public Expression visit(IndexAccessor ia, Expression arg) throws AsterixException {
- ia.setExpr(ia.getExpr().accept(this, arg));
- if (ia.getIndexExpr() != null) {
- ia.setIndexExpr(ia.getIndexExpr());
- }
- return ia;
- }
-
- // Whether a rewrite is needed for a variable reference expression.
- private boolean rewriteNeeded(VariableExpr varExpr) throws AsterixException {
- String varName = varExpr.getVar().getValue();
- Identifier ident = scopeChecker.lookupSymbol(varName);
- if (ident != null) {
- // Exists such an identifier
- varExpr.setIsNewVar(false);
- varExpr.setVar((VarIdentifier) ident);
- return false;
- } else {
- // Meets a undefined variable
- return true;
- }
- }
-
- // Rewrites for global variable (e.g., dataset) references.
- private Expression datasetRewrite(VariableExpr expr) throws AsterixException {
- if (!overwrite) {
- return expr;
- }
- String funcName = "dataset";
- String dataverse = MetadataConstants.METADATA_DATAVERSE_NAME;
- FunctionSignature signature = new FunctionSignature(dataverse, funcName, 1);
- List<Expression> argList = new ArrayList<Expression>();
- //Ignore the parser-generated prefix "$" for a dataset.
- String dataset = SqlppVariableUtil.toUserDefinedVariableName(expr.getVar()).getValue();
- argList.add(new LiteralExpr(new StringLiteral(dataset)));
- return new CallExpr(signature, argList);
- }
-}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppExpressionScopingVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppExpressionScopingVisitor.java
new file mode 100644
index 0000000..14e80d9
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppExpressionScopingVisitor.java
@@ -0,0 +1,284 @@
+/*
+ * 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.
+ */
+package org.apache.asterix.lang.sqlpp.visitor.base;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.context.Scope;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.parser.ScopeChecker;
+import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
+import org.apache.asterix.lang.common.struct.VarIdentifier;
+import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.clause.JoinClause;
+import org.apache.asterix.lang.sqlpp.clause.NestClause;
+import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
+import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
+import org.apache.hyracks.algebricks.core.algebra.base.Counter;
+
+public class AbstractSqlppExpressionScopingVisitor extends AbstractSqlppSimpleExpressionVisitor {
+
+ protected final ScopeChecker scopeChecker = new ScopeChecker();
+ protected final LangRewritingContext context;
+
+ /**
+ * @param context,
+ * manages ids of variables and guarantees uniqueness of variables.
+ */
+ public AbstractSqlppExpressionScopingVisitor(LangRewritingContext context) {
+ this.context = context;
+ this.scopeChecker.setVarCounter(new Counter(context.getVarCounter()));
+ }
+
+ @Override
+ public Expression visit(FromClause fromClause, Expression arg) throws AsterixException {
+ scopeChecker.extendCurrentScope();
+ for (FromTerm fromTerm : fromClause.getFromTerms()) {
+ fromTerm.accept(this, arg);
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(FromTerm fromTerm, Expression arg) throws AsterixException {
+ scopeChecker.createNewScope();
+ // Visit the left expression of a from term.
+ fromTerm.setLeftExpression(fromTerm.getLeftExpression().accept(this, arg));
+
+ // Registers the data item variable.
+ VariableExpr leftVar = fromTerm.getLeftVariable();
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(leftVar.getVar());
+
+ // Registers the positional variable
+ if (fromTerm.hasPositionalVariable()) {
+ VariableExpr posVar = fromTerm.getPositionalVariable();
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
+ }
+ // Visits join/unnest/nest clauses.
+ for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
+ correlateClause.accept(this, arg);
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(JoinClause joinClause, Expression arg) throws AsterixException {
+ Scope backupScope = scopeChecker.removeCurrentScope();
+ Scope parentScope = scopeChecker.getCurrentScope();
+ scopeChecker.createNewScope();
+ // NOTE: the two join branches cannot be correlated, instead of checking
+ // the correlation here,
+ // we defer the check to the query optimizer.
+ joinClause.setRightExpression(joinClause.getRightExpression().accept(this, arg));
+
+ // Registers the data item variable.
+ VariableExpr rightVar = joinClause.getRightVariable();
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(rightVar.getVar());
+
+ if (joinClause.hasPositionalVariable()) {
+ // Registers the positional variable.
+ VariableExpr posVar = joinClause.getPositionalVariable();
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
+ }
+
+ Scope rightScope = scopeChecker.removeCurrentScope();
+ Scope mergedScope = new Scope(scopeChecker, parentScope);
+ mergedScope.merge(backupScope);
+ mergedScope.merge(rightScope);
+ scopeChecker.pushExistingScope(mergedScope);
+ // The condition expression can refer to the just registered variables
+ // for the right branch.
+ joinClause.setConditionExpression(joinClause.getConditionExpression().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(NestClause nestClause, Expression arg) throws AsterixException {
+ // NOTE: the two branches of a NEST cannot be correlated, instead of
+ // checking the correlation here, we defer the check to the query
+ // optimizer.
+ nestClause.setRightExpression(nestClause.getRightExpression().accept(this, arg));
+
+ // Registers the data item variable.
+ VariableExpr rightVar = nestClause.getRightVariable();
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(rightVar.getVar());
+
+ if (nestClause.hasPositionalVariable()) {
+ // Registers the positional variable.
+ VariableExpr posVar = nestClause.getPositionalVariable();
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
+ }
+
+ // The condition expression can refer to the just registered variables
+ // for the right branch.
+ nestClause.setConditionExpression(nestClause.getConditionExpression().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(UnnestClause unnestClause, Expression arg) throws AsterixException {
+ unnestClause.setRightExpression(unnestClause.getRightExpression().accept(this, arg));
+
+ // register the data item variable
+ VariableExpr rightVar = unnestClause.getRightVariable();
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(rightVar.getVar());
+
+ if (unnestClause.hasPositionalVariable()) {
+ // register the positional variable
+ VariableExpr posVar = unnestClause.getPositionalVariable();
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(posVar.getVar());
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(SelectSetOperation selectSetOperation, Expression arg) throws AsterixException {
+ selectSetOperation.getLeftInput().accept(this, arg);
+ for (SetOperationRight right : selectSetOperation.getRightInputs()) {
+ scopeChecker.createNewScope();
+ right.getSetOperationRightInput().accept(this, arg);
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(Query q, Expression arg) throws AsterixException {
+ q.setBody(q.getBody().accept(this, arg));
+ q.setVarCounter(scopeChecker.getVarCounter());
+ context.setVarCounter(scopeChecker.getVarCounter());
+ return null;
+ }
+
+ @Override
+ public Expression visit(FunctionDecl fd, Expression arg) throws AsterixException {
+ scopeChecker.createNewScope();
+ fd.setFuncBody(fd.getFuncBody().accept(this, arg));
+ scopeChecker.removeCurrentScope();
+ return null;
+ }
+
+ @Override
+ public Expression visit(GroupbyClause gc, Expression arg) throws AsterixException {
+ Scope newScope = scopeChecker.extendCurrentScopeNoPush(true);
+ // Puts all group-by variables into the symbol set of the new scope.
+ for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
+ gbyVarExpr.setExpr(gbyVarExpr.getExpr().accept(this, arg));
+ VariableExpr gbyVar = gbyVarExpr.getVar();
+ if (gbyVar != null) {
+ newScope.addNewVarSymbolToScope(gbyVarExpr.getVar().getVar());
+ }
+ }
+ for (VariableExpr withVar : gc.getWithVarList()) {
+ newScope.addNewVarSymbolToScope(withVar.getVar());
+ }
+ scopeChecker.replaceCurrentScope(newScope);
+ return null;
+ }
+
+ @Override
+ public Expression visit(LimitClause limitClause, Expression arg) throws AsterixException {
+ scopeChecker.pushForbiddenScope(scopeChecker.getCurrentScope());
+ limitClause.setLimitExpr(limitClause.getLimitExpr().accept(this, arg));
+ scopeChecker.popForbiddenScope();
+ return null;
+ }
+
+ @Override
+ public Expression visit(LetClause letClause, Expression arg) throws AsterixException {
+ scopeChecker.extendCurrentScope();
+ letClause.setBindingExpr(letClause.getBindingExpr().accept(this, arg));
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(letClause.getVarExpr().getVar());
+ return null;
+ }
+
+ @Override
+ public Expression visit(SelectExpression selectExpression, Expression arg) throws AsterixException {
+ Scope scopeBeforeSelectExpression = scopeChecker.getCurrentScope();
+ scopeChecker.createNewScope();
+
+ // visit let list
+ if (selectExpression.hasLetClauses()) {
+ for (LetClause letClause : selectExpression.getLetList()) {
+ letClause.accept(this, arg);
+ }
+ }
+
+ // visit the main select.
+ selectExpression.getSelectSetOperation().accept(this, selectExpression);
+
+ // visit order by
+ if (selectExpression.hasOrderby()) {
+ selectExpression.getOrderbyClause().accept(this, arg);
+ }
+
+ // visit limit
+ if (selectExpression.hasLimit()) {
+ selectExpression.getLimitClause().accept(this, arg);
+ }
+
+ // Exit scopes that were entered within this select expression
+ while (scopeChecker.getCurrentScope() != scopeBeforeSelectExpression) {
+ scopeChecker.removeCurrentScope();
+ }
+ return selectExpression;
+ }
+
+ @Override
+ public Expression visit(QuantifiedExpression qe, Expression arg) throws AsterixException {
+ scopeChecker.createNewScope();
+ for (QuantifiedPair pair : qe.getQuantifiedList()) {
+ scopeChecker.getCurrentScope().addNewVarSymbolToScope(pair.getVarExpr().getVar());
+ pair.setExpr(pair.getExpr().accept(this, arg));
+ }
+ qe.setSatisfiesExpr(qe.getSatisfiesExpr().accept(this, arg));
+ scopeChecker.removeCurrentScope();
+ return qe;
+ }
+
+ @Override
+ public Expression visit(VariableExpr varExpr, Expression arg) throws AsterixException {
+ String varName = varExpr.getVar().getValue();
+ if (scopeChecker.isInForbiddenScopes(varName)) {
+ throw new AsterixException(
+ "Inside limit clauses, it is disallowed to reference a variable having the same name as any variable bound in the same scope as the limit clause.");
+ }
+ Identifier ident = scopeChecker.lookupSymbol(varName);
+ if (ident != null) {
+ // Exists such an identifier, then this is a variable reference instead of a variable
+ // definition.
+ varExpr.setIsNewVar(false);
+ varExpr.setVar((VarIdentifier) ident);
+ }
+ return varExpr;
+ }
+
+}
diff --git a/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppSimpleExpressionVisitor.java b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppSimpleExpressionVisitor.java
new file mode 100644
index 0000000..18c2789
--- /dev/null
+++ b/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppSimpleExpressionVisitor.java
@@ -0,0 +1,347 @@
+/*
+ * 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.
+ */
+package org.apache.asterix.lang.sqlpp.visitor.base;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
+import org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.clause.HavingClause;
+import org.apache.asterix.lang.sqlpp.clause.JoinClause;
+import org.apache.asterix.lang.sqlpp.clause.NestClause;
+import org.apache.asterix.lang.sqlpp.clause.Projection;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.clause.SelectClause;
+import org.apache.asterix.lang.sqlpp.clause.SelectElement;
+import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
+import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
+import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
+
+public class AbstractSqlppSimpleExpressionVisitor extends AbstractSqlppQueryExpressionVisitor<Expression, Expression> {
+
+ @Override
+ public Expression visit(FromClause fromClause, Expression arg) throws AsterixException {
+ for (FromTerm fromTerm : fromClause.getFromTerms()) {
+ fromTerm.accept(this, arg);
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(FromTerm fromTerm, Expression arg) throws AsterixException {
+ // Visit the left expression of a from term.
+ fromTerm.setLeftExpression(fromTerm.getLeftExpression().accept(this, arg));
+
+ // Visits join/unnest/nest clauses.
+ for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
+ correlateClause.accept(this, arg);
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(JoinClause joinClause, Expression arg) throws AsterixException {
+ joinClause.setRightExpression(joinClause.getRightExpression().accept(this, arg));
+ joinClause.setConditionExpression(joinClause.getConditionExpression().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(NestClause nestClause, Expression arg) throws AsterixException {
+ nestClause.setRightExpression(nestClause.getRightExpression().accept(this, arg));
+ nestClause.setConditionExpression(nestClause.getConditionExpression().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(UnnestClause unnestClause, Expression arg) throws AsterixException {
+ unnestClause.setRightExpression(unnestClause.getRightExpression().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(Projection projection, Expression arg) throws AsterixException {
+ projection.setExpression(projection.getExpression().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(SelectBlock selectBlock, Expression arg) throws AsterixException {
+ // Traverses the select block in the order of "from", "let"s, "where",
+ // "group by", "let"s, "having" and "select".
+ if (selectBlock.hasFromClause()) {
+ selectBlock.getFromClause().accept(this, arg);
+ }
+ if (selectBlock.hasLetClauses()) {
+ List<LetClause> letList = selectBlock.getLetList();
+ for (LetClause letClause : letList) {
+ letClause.accept(this, arg);
+ }
+ }
+ if (selectBlock.hasWhereClause()) {
+ selectBlock.getWhereClause().accept(this, arg);
+ }
+ if (selectBlock.hasGroupbyClause()) {
+ selectBlock.getGroupbyClause().accept(this, arg);
+ }
+ if (selectBlock.hasLetClausesAfterGroupby()) {
+ List<LetClause> letListAfterGby = selectBlock.getLetListAfterGroupby();
+ for (LetClause letClauseAfterGby : letListAfterGby) {
+ letClauseAfterGby.accept(this, arg);
+ }
+ }
+ if (selectBlock.hasHavingClause()) {
+ selectBlock.getHavingClause().accept(this, arg);
+ }
+ selectBlock.getSelectClause().accept(this, arg);
+ return null;
+ }
+
+ @Override
+ public Expression visit(SelectClause selectClause, Expression arg) throws AsterixException {
+ if (selectClause.selectElement()) {
+ selectClause.getSelectElement().accept(this, arg);
+ }
+ if (selectClause.selectRegular()) {
+ selectClause.getSelectRegular().accept(this, arg);
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(SelectElement selectElement, Expression arg) throws AsterixException {
+ selectElement.setExpression(selectElement.getExpression().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(SelectRegular selectRegular, Expression arg) throws AsterixException {
+ for (Projection projection : selectRegular.getProjections()) {
+ projection.accept(this, arg);
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(SelectSetOperation selectSetOperation, Expression arg) throws AsterixException {
+ selectSetOperation.getLeftInput().accept(this, arg);
+ for (SetOperationRight right : selectSetOperation.getRightInputs()) {
+ right.getSetOperationRightInput().accept(this, arg);
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(HavingClause havingClause, Expression arg) throws AsterixException {
+ havingClause.setFilterExpression(havingClause.getFilterExpression().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(Query q, Expression arg) throws AsterixException {
+ q.setBody(q.getBody().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(FunctionDecl fd, Expression arg) throws AsterixException {
+ fd.setFuncBody(fd.getFuncBody().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(WhereClause whereClause, Expression arg) throws AsterixException {
+ whereClause.setWhereExpr(whereClause.getWhereExpr().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(OrderbyClause oc, Expression arg) throws AsterixException {
+ List<Expression> newOrderbyList = new ArrayList<Expression>();
+ for (Expression orderExpr : oc.getOrderbyList()) {
+ newOrderbyList.add(orderExpr.accept(this, arg));
+ }
+ oc.setOrderbyList(newOrderbyList);
+ return null;
+ }
+
+ @Override
+ public Expression visit(GroupbyClause gc, Expression arg) throws AsterixException {
+ for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
+ gbyVarExpr.setExpr(gbyVarExpr.getExpr().accept(this, arg));
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(LimitClause limitClause, Expression arg) throws AsterixException {
+ limitClause.setLimitExpr(limitClause.getLimitExpr().accept(this, arg));
+ if (limitClause.hasOffset()) {
+ limitClause.setOffset(limitClause.getOffset().accept(this, arg));
+ }
+ return null;
+ }
+
+ @Override
+ public Expression visit(LetClause letClause, Expression arg) throws AsterixException {
+ letClause.setBindingExpr(letClause.getBindingExpr().accept(this, arg));
+ return null;
+ }
+
+ @Override
+ public Expression visit(SelectExpression selectExpression, Expression arg) throws AsterixException {
+ // visit let list
+ if (selectExpression.hasLetClauses()) {
+ for (LetClause letClause : selectExpression.getLetList()) {
+ letClause.accept(this, arg);
+ }
+ }
+
+ // visit the main select.
+ selectExpression.getSelectSetOperation().accept(this, arg);
+
+ // visit order by
+ if (selectExpression.hasOrderby()) {
+ for (Expression orderExpr : selectExpression.getOrderbyClause().getOrderbyList()) {
+ orderExpr.accept(this, arg);
+ }
+ }
+
+ // visit limit
+ if (selectExpression.hasLimit()) {
+ selectExpression.getLimitClause().accept(this, arg);
+ }
+ return selectExpression;
+ }
+
+ @Override
+ public Expression visit(LiteralExpr l, Expression arg) throws AsterixException {
+ return l;
+ }
+
+ @Override
+ public Expression visit(ListConstructor lc, Expression arg) throws AsterixException {
+ List<Expression> newExprList = new ArrayList<Expression>();
+ for (Expression expr : lc.getExprList()) {
+ newExprList.add(expr.accept(this, arg));
+ }
+ lc.setExprList(newExprList);
+ return lc;
+ }
+
+ @Override
+ public Expression visit(RecordConstructor rc, Expression arg) throws AsterixException {
+ for (FieldBinding binding : rc.getFbList()) {
+ binding.setLeftExpr(binding.getLeftExpr().accept(this, arg));
+ binding.setRightExpr(binding.getRightExpr().accept(this, arg));
+ }
+ return rc;
+ }
+
+ @Override
+ public Expression visit(OperatorExpr operatorExpr, Expression arg) throws AsterixException {
+ List<Expression> newExprList = new ArrayList<Expression>();
+ for (Expression expr : operatorExpr.getExprList()) {
+ newExprList.add(expr.accept(this, arg));
+ }
+ operatorExpr.setExprList(newExprList);
+ return operatorExpr;
+ }
+
+ @Override
+ public Expression visit(IfExpr ifExpr, Expression arg) throws AsterixException {
+ ifExpr.setCondExpr(ifExpr.getCondExpr().accept(this, arg));
+ ifExpr.setThenExpr(ifExpr.getThenExpr().accept(this, arg));
+ ifExpr.setElseExpr(ifExpr.getElseExpr().accept(this, arg));
+ return ifExpr;
+ }
+
+ @Override
+ public Expression visit(QuantifiedExpression qe, Expression arg) throws AsterixException {
+ for (QuantifiedPair pair : qe.getQuantifiedList()) {
+ pair.setExpr(pair.getExpr().accept(this, arg));
+ }
+ qe.setSatisfiesExpr(qe.getSatisfiesExpr().accept(this, arg));
+ return qe;
+ }
+
+ @Override
+ public Expression visit(CallExpr callExpr, Expression arg) throws AsterixException {
+ List<Expression> newExprList = new ArrayList<Expression>();
+ for (Expression expr : callExpr.getExprList()) {
+ newExprList.add(expr.accept(this, arg));
+ }
+ callExpr.setExprList(newExprList);
+ return callExpr;
+ }
+
+ @Override
+ public Expression visit(VariableExpr varExpr, Expression arg) throws AsterixException {
+ return varExpr;
+ }
+
+ @Override
+ public Expression visit(UnaryExpr u, Expression arg) throws AsterixException {
+ u.setExpr(u.getExpr().accept(this, arg));
+ return u;
+ }
+
+ @Override
+ public Expression visit(FieldAccessor fa, Expression arg) throws AsterixException {
+ fa.setExpr(fa.getExpr().accept(this, arg));
+ return fa;
+ }
+
+ @Override
+ public Expression visit(IndexAccessor ia, Expression arg) throws AsterixException {
+ ia.setExpr(ia.getExpr().accept(this, arg));
+ if (ia.getIndexExpr() != null) {
+ ia.setIndexExpr(ia.getIndexExpr());
+ }
+ return ia;
+ }
+
+}