Young-Seok | be353dd | 2014-05-22 20:30:45 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Description : Tests whether an ngram_index is applied to optimize a join query using the contains function. |
| 3 | * The index should be applied. |
| 4 | * Success : Yes |
| 5 | */ |
| 6 | |
| 7 | drop dataverse test if exists; |
| 8 | create dataverse test; |
| 9 | use dataverse test; |
| 10 | |
| 11 | create type DBLPType as closed { |
| 12 | id: int32, |
| 13 | dblpid: string, |
| 14 | title: string, |
| 15 | authors: string, |
| 16 | misc: string |
| 17 | } |
| 18 | |
| 19 | create dataset DBLP(DBLPType) primary key id; |
| 20 | |
| 21 | create index ngram_index on DBLP(title) type ngram(3); |
| 22 | |
| 23 | write output to nc1:"rttest/inverted-index-join_ngram-contains.adm"; |
| 24 | |
Young-Seok | be353dd | 2014-05-22 20:30:45 -0700 | [diff] [blame] | 25 | for $o1 in dataset('DBLP') |
| 26 | for $o2 in dataset('DBLP') |
| 27 | where contains($o1.title, $o2.title) and $o1.id < $o2.id |
| 28 | order by $o1.id, $o2.id |
| 29 | return {"title1":$o1.title, "title2":$o2.title} |