blob: 5b2be0c75ca727c1d1d15e5c5a5bbcab20be582a [file] [log] [blame]
alexander.behm954083a2012-11-15 04:01:23 +00001/*
2 * Description : Fuzzy joins two datasets, DBLP and CSX, based on ~= using Jaccard 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.
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
8drop dataverse test if exists;
9create dataverse test;
10use dataverse test;
ramangrover29a3211202013-05-19 11:56:49 -070011set import-private-functions 'true';
alexander.behm954083a2012-11-15 04:01:23 +000012
13create type DBLPType as closed {
14 id: int32,
15 dblpid: string,
16 title: string,
17 authors: string,
18 misc: string
19}
20
21create type CSXType as closed {
22 id: int32,
23 csxid: string,
24 title: string,
25 authors: string,
26 misc: string
27}
28
ramangrover29669d8f62013-02-11 06:03:32 +000029create dataset DBLP(DBLPType) primary key id;
alexander.behm954083a2012-11-15 04:01:23 +000030
ramangrover29669d8f62013-02-11 06:03:32 +000031create dataset CSX(CSXType) primary key id;
alexander.behm954083a2012-11-15 04:01:23 +000032
33create index ngram_index on DBLP(title) type ngram(3);
34
35write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-fuzzyeq-jaccard.adm";
36
37set simfunction 'jaccard';
38set simthreshold '0.5f';
39
40for $a in dataset('DBLP')
41for $b in dataset('CSX')
42where gram-tokens($a.title, 3, false) ~= gram-tokens($b.title, 3, false) and $a.id < $b.id
ramangrover29a3211202013-05-19 11:56:49 -070043return {"atitle": $a.title, "btitle": $b.title}