salsubaiee@gmail.com | 2a0d817 | 2012-11-11 22:31:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Description : Create r-tree indexes for all spatial data types. |
| 3 | * Success : Yes |
| 4 | */ |
| 5 | |
| 6 | |
| 7 | drop dataverse test if exists; |
| 8 | create dataverse test; |
| 9 | use dataverse test; |
| 10 | |
| 11 | create type SpatialType as open { |
| 12 | id: int32, |
| 13 | point: point, |
| 14 | line1: line, |
| 15 | poly1: polygon, |
| 16 | rec: rectangle, |
| 17 | circle: circle |
| 18 | } |
| 19 | |
| 20 | create dataset MyData(SpatialType) partitioned by key id; |
| 21 | create index rtree_index1 on MyData(point) type rtree; |
| 22 | create index rtree_index2 on MyData(line1) type rtree; |
| 23 | create index rtree_index3 on MyData(poly1) type rtree; |
| 24 | create index rtree_index5 on MyData(rec) type rtree; |
| 25 | create index rtree_index4 on MyData(circle) type rtree; |
| 26 | |
| 27 | write output to nc1:"rttest/spatial_create-rtree-index.adm"; |
| 28 | |
| 29 | load dataset MyData |
| 30 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 31 | (("path"="nc1://data/spatial/spatialData.json"),("format"="adm")); |
| 32 | |
| 33 | for $a in dataset('MyData') |
| 34 | return $a.id |