alexander.behm | 954083a | 2012-11-15 04:01:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Description : Fuzzy joins two datasets, DBLP and CSX, based on ~= using edit distance of their authors. |
| 3 | * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join. |
| 4 | * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary. |
| 5 | * Success : Yes |
| 6 | */ |
| 7 | |
| 8 | drop dataverse test if exists; |
| 9 | create dataverse test; |
| 10 | use dataverse test; |
| 11 | |
| 12 | create type DBLPType as closed { |
| 13 | id: int32, |
| 14 | dblpid: string, |
| 15 | title: string, |
| 16 | authors: string, |
| 17 | misc: string |
| 18 | } |
| 19 | |
| 20 | create type CSXType as closed { |
| 21 | id: int32, |
| 22 | csxid: string, |
| 23 | title: string, |
| 24 | authors: string, |
| 25 | misc: string |
| 26 | } |
| 27 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 28 | create dataset DBLP(DBLPType) primary key id; |
alexander.behm | 954083a | 2012-11-15 04:01:23 +0000 | [diff] [blame] | 29 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 30 | create dataset CSX(CSXType) primary key id; |
alexander.behm | 954083a | 2012-11-15 04:01:23 +0000 | [diff] [blame] | 31 | |
| 32 | create index ngram_index on CSX(authors) type ngram(3); |
| 33 | |
| 34 | write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-fuzzyeq-edit-distance.adm"; |
| 35 | |
| 36 | set simfunction 'edit-distance'; |
| 37 | set simthreshold '3'; |
| 38 | |
| 39 | for $a in dataset('DBLP') |
| 40 | for $b in dataset('CSX') |
| 41 | where $a.authors ~= $b.authors and $a.id < $b.id |
| 42 | return {"aauthors": $a.authors, "bauthors": $b.authors} |