| 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_03.adm"; |
| |
| for $c in dataset('Customers') |
| let $nestedRec := $c.lastorder |
| let $c1 := [ $c.cid, $nestedRec.oid] |
| let $c2 := {{ $c.cid, $nestedRec.oid}} |
| let $c3 := [ $c.lastorder, $nestedRec] |
| let $c4 := {{ $c.lastorder, $nestedRec}} |
| where $c.cid >= int32("3") |
| return { "id": $c.cid, "list1":$c1, "list2":$c2,"list3":$c3,"list4":$c4} |