blob: 236b4a965b25f5e82ac6b9a36dc2e5fe15ad3394 [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001drop dataverse test if exists;
2create dataverse test;
3use dataverse test;
4
5create type MyRecord as closed {
6 id: int32,
7 point: point,
8 kwds: string,
9 line1: line,
10 line2: line,
11 poly1: polygon,
12 poly2: polygon,
13 rec: rectangle
14}
15
16create type MyMiniRecord as closed {
17 id: int32,
18 point: point
19}
20
vinayakb38b7ca42012-03-05 05:44:15 +000021create dataset MyData(MyRecord)
khfaraaz82@gmail.com502731f2012-05-02 20:38:16 +000022 partitioned by key id;
vinayakb38b7ca42012-03-05 05:44:15 +000023
24load dataset MyData
25using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
26(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
27
vinayakb38b7ca42012-03-05 05:44:15 +000028create dataset MyMiniData(MyMiniRecord)
khfaraaz82@gmail.com502731f2012-05-02 20:38:16 +000029 partitioned by key id;
vinayakb38b7ca42012-03-05 05:44:15 +000030
31load dataset MyMiniData
32using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
33(("path"="nc1://data/spatial/spatialData0.json"),("format"="adm")) pre-sorted;
34
35create index rtree_index_point_0 on MyData(point) type rtree;
36create index rtree_index_point on MyMiniData(point) type rtree;
37
38insert into dataset MyMiniData
39(
40 for $m in dataset('MyData')
41 return {
42 "id": $m.id,
43 "point": $m.point
44 }
45);
46
47write output to nc1:"rttest/dml_scan-insert-rtree-secondary-index.adm";
48
49for $o in dataset('MyMiniData')
50where spatial-intersect($o.point, create-polygon(create-point(0.0,1.0), create-point(0.0,4.0), create-point(12.0,4.0), create-point(12.0,1.0)))
51order by $o.id
52return {"id":$o.id}