blob: ab791891f10dd03b538f9fe1d9ab193a23a0a322 [file] [log] [blame]
alexander.behm1e74ad52012-11-06 09:23:58 +00001/*
2 * Description : Joins two datasets on the intersection of their point attributes.
3 * The dataset 'MyData1' has an RTree index, and we expect the
4 * join to be transformed into an indexed nested-loop join.
5 * Success : Yes
6 */
7
8drop dataverse test if exists;
9create dataverse test;
10use dataverse test;
11
12create type MyRecord as closed {
13 id: int32,
14 point: point,
15 kwds: string,
16 line1: line,
17 line2: line,
18 poly1: polygon,
19 poly2: polygon,
salsubaiee@gmail.com2a0d8172012-11-11 22:31:52 +000020 rec: rectangle,
21 circle: circle
alexander.behm1e74ad52012-11-06 09:23:58 +000022}
23
24create dataset MyData1(MyRecord) partitioned by key id;
25create dataset MyData2(MyRecord) partitioned by key id;
26
27load dataset MyData1
28using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
29(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
30
31load dataset MyData2
32using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
33(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
34
35create index rtree_index on MyData1(point) type rtree;
36
37write output to nc1:"rttest/index-join_rtree-spatial-intersect-point.adm";
38
39for $a in dataset('MyData1')
40for $b in dataset('MyData2')
41where spatial-intersect($a.point, $b.point) and $a.id != $b.id
42order by $a.id, $b.id
43return {"aid": $a.id, "bid": $b.id, "apt": $a.point, "bp": $b.point}