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 | |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 19 | create dataset MyData(MyRecord) |
khfaraaz82@gmail.com | 502731f | 2012-05-02 20:38:16 +0000 | [diff] [blame] | 20 | partitioned by key id; |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 21 | |
| 22 | load dataset MyData |
| 23 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 24 | (("path"="nc1://data/twitter/smalltweets.txt"),("format"="adm")) pre-sorted; |
| 25 | |
| 26 | |
| 27 | create dataset MyMiniData(MyMiniRecord) |
khfaraaz82@gmail.com | 502731f | 2012-05-02 20:38:16 +0000 | [diff] [blame] | 28 | partitioned by key id; |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 29 | |
| 30 | load dataset MyMiniData |
| 31 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 32 | (("path"="nc1://data/spatial/spatialData0.json"),("format"="adm")) pre-sorted; |
| 33 | |
| 34 | |
| 35 | create index rtree_index_loc_0 on MyData(loc) type rtree; |
| 36 | create index rtree_index_loc on MyMiniData(loc) type rtree; |
| 37 | |
| 38 | insert into dataset MyMiniData |
| 39 | ( |
| 40 | for $m in dataset('MyData') |
| 41 | where $m.id<1000 |
| 42 | return { |
| 43 | "id": $m.id, |
| 44 | "loc": $m.loc |
| 45 | } |
| 46 | ); |
| 47 | |
| 48 | insert into dataset MyMiniData |
| 49 | ( |
| 50 | for $m in dataset('MyData') |
| 51 | where $m.id>=1000 |
| 52 | die after 1000 |
| 53 | return { |
| 54 | "id": $m.id, |
| 55 | "loc": $m.loc |
| 56 | } |
| 57 | ); |
| 58 | |
| 59 | write output to nc1:"rttest/failure_insert-rtree.adm"; |
| 60 | |
| 61 | for $o in dataset('MyMiniData') |
| 62 | order by $o.id |
| 63 | return {"id":$o.id} |