blob: 58fbf73996d50041bca6c169750f2e8b4b886a02 [file] [log] [blame]
/*
* Description : Joins two datasets on the intersection of their point attributes.
* The dataset 'MyData1' has an RTree index, and we expect the
* join to be transformed into an indexed nested-loop join.
* Success : Yes
*/
drop dataverse test if exists;
create dataverse test;
use dataverse test;
create type MyRecord as closed {
id: int32,
point: point,
kwds: string,
line1: line,
line2: line,
poly1: polygon,
poly2: polygon,
rec: rectangle,
circle: circle
}
create dataset MyData1(MyRecord) primary key id;
create dataset MyData2(MyRecord) primary key id;
load dataset MyData1
using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
load dataset MyData2
using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
(("path"="nc1://data/spatial/spatialData.json"),("format"="adm")) pre-sorted;
create index rtree_index on MyData1(point) type rtree;
write output to nc1:"rttest/index-join_rtree-spatial-intersect-point.adm";
for $a in dataset('MyData1')
for $b in dataset('MyData2')
where spatial-intersect($a.point, $b.point) and $a.id != $b.id
order by $a.id, $b.id
return {"aid": $a.id, "bid": $b.id, "apt": $a.point, "bp": $b.point}