| use dataverse demo1112; |
| |
| declare type CustomerType as closed { |
| cid: int32, |
| name: string, |
| budget: int32, |
| age: int32?, |
| address: AddressType?, |
| lastorder: { |
| oid: int32, |
| total: float |
| } |
| } |
| |
| declare type AddressType as open { |
| number: int32, |
| street: string, |
| city: string |
| } |
| |
| |
| declare type OrderType as open { |
| oid: int32, |
| cid: int32, |
| orderstatus: string, |
| orderpriority: string, |
| clerk: string, |
| total: float, |
| hoList: [int32] |
| } |
| |
| declare nodegroup group1 on nc1, nc2; |
| |
| set format "edu.uci.ics.asterix.runtime.formats.nontagged.NonTaggedDataFormat"; |
| |
| declare dataset Customers(CustomerType) |
| primary key cid on group1; |
| declare dataset Orders(OrderType) |
| primary key oid on group1; |
| |
| write output to nc1:"/home/yasser/Dropbox/Research/data/results/result_join_2.adm"; |
| |
| for $c in dataset('Customers') |
| for $o in dataset('Orders') |
| let $d := [$o.oid, $c.age, $o.cid] |
| // let $d := [$c.age, $o.oid, $o.cid] try this one |
| where $c.cid = $o.cid |
| //return {"cust":$c.name } |
| return {"cust":$c.name, "list": $d } |
| |
| //return {"cust":$c.name, "custage": d[0], "orderid":d[1], "ordertotal":d[2]} |