blob: 0ed648818728de77a08f3e4ffafd72b22cc7f6eb [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,
salsubaiee@gmail.com2a0d8172012-11-11 22:31:52 +000013 rec: rectangle,
14 circle: circle
vinayakb38b7ca42012-03-05 05:44:15 +000015}
16
17create type MyMiniRecord as closed {
18 id: int32,
19 point: point
20}
21
vinayakb38b7ca42012-03-05 05:44:15 +000022create dataset MyData(MyRecord)
ramangrover29669d8f62013-02-11 06:03:32 +000023 primary key id;
vinayakb38b7ca42012-03-05 05:44:15 +000024
25load dataset MyData
26using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
27(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
28
vinayakb38b7ca42012-03-05 05:44:15 +000029create dataset MyMiniData(MyMiniRecord)
ramangrover29669d8f62013-02-11 06:03:32 +000030 primary key id;
vinayakb38b7ca42012-03-05 05:44:15 +000031
32load dataset MyMiniData
33using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
34(("path"="nc1://data/spatial/spatialData0.json"),("format"="adm")) pre-sorted;
35
36create index rtree_index_point_0 on MyData(point) type rtree;
37create index rtree_index_point on MyMiniData(point) type rtree;
38
39insert into dataset MyMiniData
40(
41 for $m in dataset('MyData')
42 return {
43 "id": $m.id,
44 "point": $m.point
45 }
46);
47
48write output to nc1:"rttest/dml_scan-insert-rtree-secondary-index.adm";
49
50for $o in dataset('MyMiniData')
51where 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)))
52order by $o.id
53return {"id":$o.id}