alexander.behm | 3caae9e | 2012-11-08 04:50:20 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 10 | drop dataverse test if exists; |
| 11 | create dataverse test; |
| 12 | use dataverse test; |
| 13 | |
| 14 | create type DBLPType as closed { |
| 15 | id: int32, |
| 16 | dblpid: string, |
| 17 | title: string, |
| 18 | authors: string, |
| 19 | misc: string |
| 20 | } |
| 21 | |
| 22 | create type CSXType as closed { |
| 23 | id: int32, |
| 24 | csxid: string, |
| 25 | title: string, |
| 26 | authors: string, |
| 27 | misc: string |
| 28 | } |
| 29 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 30 | create dataset DBLP(DBLPType) primary key id; |
alexander.behm | 3caae9e | 2012-11-08 04:50:20 +0000 | [diff] [blame] | 31 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 32 | create dataset CSX(CSXType) primary key id; |
alexander.behm | 3caae9e | 2012-11-08 04:50:20 +0000 | [diff] [blame] | 33 | |
alexander.behm | 3caae9e | 2012-11-08 04:50:20 +0000 | [diff] [blame] | 34 | create index title_index on DBLP(title); |
| 35 | |
| 36 | write output to nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm"; |
| 37 | |
| 38 | for $a in dataset('DBLP') |
| 39 | for $b in dataset('CSX') |
| 40 | where $a.title /*+ indexnl */ = $b.title and $a.authors < $b.authors and $a.misc > $b.misc |
| 41 | return {"arec": $a, "brec": $b} |