blob: 1979201e1867f00fde6335f2778e628607b0f1ac [file] [log] [blame]
alexander.behmc576c602012-07-06 02:41:15 +00001/*
2 * Description : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens.
3 * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join.
alexander.behm954083a2012-11-15 04:01:23 +00004 * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
alexander.behmc576c602012-07-06 02:41:15 +00005 * Success : Yes
6 */
7
8drop dataverse test if exists;
9create dataverse test;
10use dataverse test;
11
12create type DBLPType as closed {
13 id: int32,
14 dblpid: string,
15 title: string,
16 authors: string,
17 misc: string
18}
19
20create type CSXType as closed {
21 id: int32,
22 csxid: string,
23 title: string,
24 authors: string,
25 misc: string
26}
27
28create dataset DBLP(DBLPType) partitioned by key id;
29
30create dataset CSX(CSXType) partitioned by key id;
31
alexander.behmc576c602012-07-06 02:41:15 +000032create index ngram_index on DBLP(title) type ngram(3);
33
alexander.behm954083a2012-11-15 04:01:23 +000034write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-jaccard.adm";
alexander.behmc576c602012-07-06 02:41:15 +000035
36for $a in dataset('DBLP')
37for $b in dataset('CSX')
alexander.behm954083a2012-11-15 04:01:23 +000038where similarity-jaccard(gram-tokens($a.title, 3, false), gram-tokens($b.title, 3, false)) >= 0.5f
alexander.behmc576c602012-07-06 02:41:15 +000039 and $a.id < $b.id
alexander.behm954083a2012-11-15 04:01:23 +000040return {"atitle": $a.title, "btitle": $b.title}