blob: c2f96f6dc7686e04116bd5bf5902c60a1a35d4b9 [file] [log] [blame]
drop dataverse orders-aggreg if exists;
create dataverse orders-aggreg;
use dataverse orders-aggreg;
create type OrderType as closed {
oid: int32,
cid: int32,
orderstatus: string,
orderpriority: string,
clerk: string,
total: float
}
create nodegroup group1 if not exists on nc1, nc2;
create dataset Orders(OrderType)
partitioned by key oid on group1;
write output to nc1:"/tmp/orders-aggreg.adm";
for $o in dataset('Orders')
group by $cid := $o.cid with $o
return { "cid": $cid , "ordpercust": count($o),
"totalcust": sum(for $i in $o return $i.total),
"avgcust": avg(for $i in $o return $i.total) }