alexander.behm | 812d3ae | 2012-05-13 07:07:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Test case Name : scan-delete-btree-secondary-index-nullable.aql |
| 3 | * Description : This test is intended to test insertion into secondary btree indexes that are built on nullable fields |
| 4 | * Expected Result : Success |
| 5 | * Date : May 12 2012 |
| 6 | */ |
| 7 | |
| 8 | drop dataverse test if exists; |
| 9 | create dataverse test; |
| 10 | use dataverse test; |
| 11 | |
| 12 | create type AddressType as closed { |
| 13 | number: int32, |
| 14 | street: string, |
| 15 | city: string |
| 16 | } |
| 17 | |
| 18 | create type CustomerType as closed { |
| 19 | cid: int32, |
| 20 | name: string, |
| 21 | age: int32?, |
| 22 | address: AddressType?, |
| 23 | interests: {{string}}, |
| 24 | children: [ { name: string, age: int32? } ] |
| 25 | } |
| 26 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame^] | 27 | create dataset Customers(CustomerType) primary key cid; |
| 28 | create dataset CustomersMini(CustomerType) primary key cid; |
alexander.behm | 812d3ae | 2012-05-13 07:07:02 +0000 | [diff] [blame] | 29 | |
| 30 | load dataset Customers |
| 31 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 32 | (("path"="nc1://data/semistructured/co1k/customer.adm"),("format"="adm")); |
| 33 | |
| 34 | create index age_index on CustomersMini(age); |
| 35 | |
| 36 | insert into dataset CustomersMini |
| 37 | ( |
| 38 | for $c in dataset('Customers') |
| 39 | where $c.cid < 200 |
| 40 | return { |
| 41 | "cid": $c.cid, |
| 42 | "name": $c.name, |
| 43 | "age": $c.age, |
| 44 | "address": $c.address, |
| 45 | "interests": $c.interests, |
| 46 | "children": $c.children |
| 47 | } |
| 48 | ); |
| 49 | |
| 50 | write output to nc1:"rttest/dml_scan-insert-btree-secondary-index-nullable.adm"; |
| 51 | |
| 52 | for $c in dataset('CustomersMini') |
| 53 | where $c.age < 20 |
| 54 | order by $c.cid |
| 55 | return $c |