blob: efee6cf51af274bed551d1f6d532bd6701f01461 [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,
20 rec: rectangle
21}
22
23create dataset MyData1(MyRecord) partitioned by key id;
24create dataset MyData2(MyRecord) partitioned by key id;
25
26load dataset MyData1
27using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
28(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
29
30load dataset MyData2
31using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
32(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
33
34create index rtree_index on MyData1(point) type rtree;
35
36write output to nc1:"rttest/index-join_rtree-spatial-intersect-point.adm";
37
38for $a in dataset('MyData1')
39for $b in dataset('MyData2')
40where spatial-intersect($a.point, $b.point) and $a.id != $b.id
41order by $a.id, $b.id
42return {"aid": $a.id, "bid": $b.id, "apt": $a.point, "bp": $b.point}