| /* |
| * Description : Joins two datasets on the intersection of their point attributes. |
| * The dataset 'MyData2' 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 |
| } |
| |
| create dataset MyData1(MyRecord) partitioned by key id; |
| create dataset MyData2(MyRecord) partitioned by key id; |
| |
| create index rtree_index on MyData2(point) type rtree; |
| |
| write output to nc1:"rttest/rtree-index-join_spatial-intersect-point_02.adm"; |
| |
| for $a in dataset('MyData1') |
| for $b in dataset('MyData2') |
| where spatial-intersect($a.point, $b.point) |
| return {"a": $a, "b": $b} |