blob: fe9c01782a6666007ea6de4676f8ef7966508b79 [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
21create nodegroup group1 if not exists on nc1, nc2;
22
23create dataset MyData(MyRecord)
24 partitioned by key id on group1;
25
26load dataset MyData
27using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
28(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
29
30
31create dataset MyMiniData(MyMiniRecord)
32 partitioned by key id on group1;
33
34load dataset MyMiniData
35using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
36(("path"="nc1://data/spatial/spatialData0.json"),("format"="adm")) pre-sorted;
37
38create index rtree_index_point_0 on MyData(point) type rtree;
39create index rtree_index_point on MyMiniData(point) type rtree;
40
41insert into dataset MyMiniData
42(
43 for $m in dataset('MyData')
44 return {
45 "id": $m.id,
46 "point": $m.point
47 }
48);
49
50write output to nc1:"rttest/dml_scan-insert-rtree-secondary-index.adm";
51
52for $o in dataset('MyMiniData')
53where 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)))
54order by $o.id
55return {"id":$o.id}