blob: 676ed3b795a7878131210dfd73514e7781b43a03 [file] [log] [blame]
Young-Seokbe353dd2014-05-22 20:30:45 -07001/*
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
7drop dataverse test if exists;
8create dataverse test;
9use dataverse test;
10
11create type DBLPType as closed {
12 id: int32,
13 dblpid: string,
14 title: string,
15 authors: string,
16 misc: string
17}
18
19create dataset DBLP(DBLPType) primary key id;
20
21create index ngram_index on DBLP(title) type ngram(3);
22
23write output to nc1:"rttest/inverted-index-join_ngram-contains.adm";
24
25drop dataverse test if exists;
26create dataverse test;
27use dataverse test;
28
29create type DBLPType as closed {
30 id: int32,
31 dblpid: string,
32 title: string,
33 authors: string,
34 misc: string
35}
36
37create dataset DBLP(DBLPType) primary key id;
38
39create index ngram_index on DBLP(title) type ngram(3);
40
41write output to nc1:"rttest/inverted-index-join_ngram-contains.adm";
42
43for $o1 in dataset('DBLP')
44for $o2 in dataset('DBLP')
45where contains($o1.title, $o2.title) and $o1.id < $o2.id
46order by $o1.id, $o2.id
47return {"title1":$o1.title, "title2":$o2.title}