vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 1 | drop dataverse test if exists; |
| 2 | |
| 3 | create dataverse test; |
| 4 | use dataverse test; |
| 5 | |
| 6 | create type MyRecord as closed { |
| 7 | id: int32, |
| 8 | tweetid: int64, |
| 9 | loc: point, |
| 10 | time: datetime, |
| 11 | text: string |
| 12 | } |
| 13 | |
| 14 | create type MyMiniRecord as closed { |
| 15 | id: int32, |
| 16 | loc: point |
| 17 | } |
| 18 | |
| 19 | create nodegroup group1 if not exists on nc1, nc2; |
| 20 | |
| 21 | create dataset MyData(MyRecord) |
| 22 | partitioned by key id on group1; |
| 23 | |
| 24 | load dataset MyData |
| 25 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 26 | (("path"="nc1://data/twitter/smalltweets.txt"),("format"="adm")) pre-sorted; |
| 27 | |
| 28 | |
| 29 | create dataset MyMiniData(MyMiniRecord) |
| 30 | partitioned by key id on group1; |
| 31 | |
| 32 | load dataset MyMiniData |
| 33 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 34 | (("path"="nc1://data/spatial/spatialData0.json"),("format"="adm")) pre-sorted; |
| 35 | |
| 36 | |
| 37 | create index rtree_index_loc_0 on MyData(loc) type rtree; |
| 38 | create index rtree_index_loc on MyMiniData(loc) type rtree; |
| 39 | |
| 40 | insert into dataset MyMiniData |
| 41 | ( |
| 42 | for $m in dataset('MyData') |
| 43 | where $m.id<1000 |
| 44 | return { |
| 45 | "id": $m.id, |
| 46 | "loc": $m.loc |
| 47 | } |
| 48 | ); |
| 49 | |
| 50 | insert into dataset MyMiniData |
| 51 | ( |
| 52 | for $m in dataset('MyData') |
| 53 | where $m.id>=1000 |
| 54 | die after 1000 |
| 55 | return { |
| 56 | "id": $m.id, |
| 57 | "loc": $m.loc |
| 58 | } |
| 59 | ); |
| 60 | |
| 61 | write output to nc1:"rttest/failure_insert-rtree.adm"; |
| 62 | |
| 63 | for $o in dataset('MyMiniData') |
| 64 | order by $o.id |
| 65 | return {"id":$o.id} |