blob: bb803b0fb712647eba27b5c1825a2bef4c538fe8 [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 * We expect the additional predicates to be put into a select above the
6 * primary index search.
7 * Success : Yes
8 */
9
10drop dataverse test if exists;
11create dataverse test;
12use dataverse test;
13
14create type DBLPType as closed {
15 id: int32,
16 dblpid: string,
17 title: string,
18 authors: string,
19 misc: string
20}
21
22create type CSXType as closed {
23 id: int32,
24 csxid: string,
25 title: string,
26 authors: string,
27 misc: string
28}
29
ramangrover29669d8f62013-02-11 06:03:32 +000030create dataset DBLP(DBLPType) primary key id;
alexander.behm3caae9e2012-11-08 04:50:20 +000031
ramangrover29669d8f62013-02-11 06:03:32 +000032create dataset CSX(CSXType) primary key id;
alexander.behm3caae9e2012-11-08 04:50:20 +000033
alexander.behm3caae9e2012-11-08 04:50:20 +000034create index title_index on DBLP(title);
35
36write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm";
37
38for $a in dataset('DBLP')
39for $b in dataset('CSX')
40where $a.title /*+ indexnl */ = $b.title and $a.authors < $b.authors and $a.misc > $b.misc
41return {"arec": $a, "brec": $b}