| drop dataverse test if exists; |
| |
| create dataverse test; |
| use dataverse test; |
| |
| create type MyRecord as closed { |
| id: int32, |
| tweetid: int64, |
| loc: point, |
| time: datetime, |
| text: string |
| } |
| |
| create type MyMiniRecord as closed { |
| id: int32, |
| loc: point |
| } |
| |
| create dataset MyData(MyRecord) |
| primary key id; |
| |
| load dataset MyData |
| using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| (("path"="nc1://data/twitter/smalltweets.txt"),("format"="adm")) pre-sorted; |
| |
| |
| create dataset MyMiniData(MyMiniRecord) |
| primary key id; |
| |
| load dataset MyMiniData |
| using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| (("path"="nc1://data/spatial/spatialData0.json"),("format"="adm")) pre-sorted; |
| |
| |
| create index rtree_index_loc_0 on MyData(loc) type rtree; |
| create index rtree_index_loc on MyMiniData(loc) type rtree; |
| |
| insert into dataset MyMiniData |
| ( |
| for $m in dataset('MyData') |
| where $m.id<1000 |
| return { |
| "id": $m.id, |
| "loc": $m.loc |
| } |
| ); |
| |
| insert into dataset MyMiniData |
| ( |
| for $m in dataset('MyData') |
| where $m.id>=1000 |
| die after 1000 |
| return { |
| "id": $m.id, |
| "loc": $m.loc |
| } |
| ); |
| |
| write output to nc1:"rttest/failure_insert-rtree.adm"; |
| |
| for $o in dataset('MyMiniData') |
| order by $o.id |
| return {"id":$o.id} |