alexander.behm | 96e3f3f | 2012-05-06 05:58:21 +0000 | [diff] [blame] | 1 | drop dataverse test if exists; |
| 2 | create dataverse test; |
| 3 | use dataverse test; |
| 4 | |
Ildar Absalyamov | 04b2b77 | 2015-03-19 15:09:51 -0700 | [diff] [blame] | 5 | create type MyRecord as open { |
alexander.behm | 96e3f3f | 2012-05-06 05:58:21 +0000 | [diff] [blame] | 6 | id: int32, |
| 7 | point: point, |
| 8 | kwds: string, |
| 9 | line1: line, |
| 10 | line2: line, |
| 11 | poly1: polygon, |
| 12 | poly2: polygon, |
salsubaiee@gmail.com | 4037dde | 2012-11-13 20:19:03 +0000 | [diff] [blame] | 13 | rec: rectangle, |
| 14 | circle: circle |
alexander.behm | 96e3f3f | 2012-05-06 05:58:21 +0000 | [diff] [blame] | 15 | } |
| 16 | |
| 17 | create nodegroup group1 if not exists on nc1, nc2; |
| 18 | |
| 19 | create dataset MyData(MyRecord) |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 20 | primary key id on group1; |
alexander.behm | 96e3f3f | 2012-05-06 05:58:21 +0000 | [diff] [blame] | 21 | |
Ildar Absalyamov | 04b2b77 | 2015-03-19 15:09:51 -0700 | [diff] [blame] | 22 | load dataset MyData |
Ian Maxon | f18bba2 | 2015-08-21 12:35:14 -0700 | [diff] [blame^] | 23 | using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" |
alexander.behm | 96e3f3f | 2012-05-06 05:58:21 +0000 | [diff] [blame] | 24 | (("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted; |
| 25 | |
| 26 | create index rtree_index_point on MyData(point) type rtree; |
| 27 | |
| 28 | |
| 29 | write output to nc1:"rttest/index_rtree-secondary-index-open.adm"; |
| 30 | |
| 31 | for $o in dataset('MyData') |
salsubaiee | 0e19648 | 2013-12-06 15:28:32 -0800 | [diff] [blame] | 32 | where spatial-intersect($o.point, create-polygon([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0])) |
alexander.behm | 96e3f3f | 2012-05-06 05:58:21 +0000 | [diff] [blame] | 33 | return {"id":$o.id} |