blob: 1d3a4bdb5b6811af0595930c643431ce38c82f05 [file] [log] [blame]
alexander.behm96e3f3f2012-05-06 05:58:21 +00001drop dataverse test if exists;
2create dataverse test;
3use dataverse test;
4
Ildar Absalyamov04b2b772015-03-19 15:09:51 -07005create type MyRecord as open {
alexander.behm96e3f3f2012-05-06 05:58:21 +00006 id: int32,
7 point: point,
8 kwds: string,
9 line1: line,
10 line2: line,
11 poly1: polygon,
12 poly2: polygon,
salsubaiee@gmail.com4037dde2012-11-13 20:19:03 +000013 rec: rectangle,
14 circle: circle
alexander.behm96e3f3f2012-05-06 05:58:21 +000015}
16
17create nodegroup group1 if not exists on nc1, nc2;
18
19create dataset MyData(MyRecord)
ramangrover29669d8f62013-02-11 06:03:32 +000020 primary key id on group1;
alexander.behm96e3f3f2012-05-06 05:58:21 +000021
Ildar Absalyamov04b2b772015-03-19 15:09:51 -070022load dataset MyData
Ian Maxonf18bba22015-08-21 12:35:14 -070023using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter"
alexander.behm96e3f3f2012-05-06 05:58:21 +000024(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
25
26create index rtree_index_point on MyData(point) type rtree;
27
28
29write output to nc1:"rttest/index_rtree-secondary-index-open.adm";
30
31for $o in dataset('MyData')
salsubaiee0e196482013-12-06 15:28:32 -080032where spatial-intersect($o.point, create-polygon([4.0,1.0,4.0,4.0,12.0,4.0,12.0,1.0]))
alexander.behm96e3f3f2012-05-06 05:58:21 +000033return {"id":$o.id}