| drop dataverse test if exists; |
| |
| create dataverse test; |
| |
| use dataverse test; |
| |
| create type AddressType as open { |
| number: int32, |
| street: string, |
| city: string |
| } |
| |
| create type CustomerType as closed { |
| cid: int32, |
| name: string, |
| cashBack: int32, |
| age: int32?, |
| address: AddressType?, |
| lastorder: { |
| oid: int32, |
| total: float |
| } |
| } |
| |
| create external dataset Customers(CustomerType) |
| using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| (("path"="nc1://data/nontagged/customerData.json"),("format"="adm")); |
| |
| write output to nc1:"rttest/custord_customer_q_02.adm"; |
| |
| for $c in dataset('Customers') |
| let $nestedRec := $c.lastorder |
| return { "id": $c.cid, "nestedRecord":$nestedRec, "order_id" : $nestedRec.oid} |