blob: 1bf34905c7d0738b458e54590c48f1ea8653d031 [file] [log] [blame]
alexander.behm3caae9e2012-11-08 04:50:20 +00001/*
2 * Description : Equi joins two datasets, DBLP and CSX, based on their title.
3 * DBLP has a secondary btree index on title, and given the 'indexnl' hint
4 * we expect the 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 DBLPType as closed {
13 id: int32,
14 dblpid: string,
15 title: string,
16 authors: string,
17 misc: string
18}
19
20create type CSXType as closed {
21 id: int32,
22 csxid: string,
23 title: string,
24 authors: string,
25 misc: string
26}
27
ramangrover29669d8f62013-02-11 06:03:32 +000028create dataset DBLP(DBLPType) primary key id;
29create dataset CSX(CSXType) primary key id;
alexander.behm3caae9e2012-11-08 04:50:20 +000030
31load dataset DBLP
32using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
33(("path"="nc1://data/pub-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"));
34
35load dataset CSX
36using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
37(("path"="nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"));
38
39create index title_index on DBLP(authors);
40
41write output to nc1:"rttest/index-join_btree-secondary-equi-join.adm";
42
43for $a in dataset('DBLP')
44for $b in dataset('CSX')
45where $a.authors /*+ indexnl */ = $b.authors
46order by $a.id, $b.id
47return {"aid": $a.id, "bid": $b.id, "authors": $a.authors}