blob: 778232aa01d776ba5be96fa9cc39340d2c778f15 [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001drop dataverse rares03 if exists;
2
3create dataverse rares03;
4
5use dataverse rares03;
6
7create type UserType as open {
8 uid: int32,
9 name: string,
10 lottery_numbers: {{int32}}
11}
12
13create type VisitorType as open {
14 vid: int32,
15 name: string,
16 lottery_numbers: {{int32}}
17}
18
19create nodegroup group1 if not exists on nc1, nc2;
20
21create dataset Users(UserType)
22 partitioned by key uid on group1;
23
24create dataset Visitors(VisitorType)
25 partitioned by key vid on group1;
26
27
28// set simfunction "jaccard";
29// set simthreshold ".8";
30
31write output to nc1:"/tmp/rares03.adm";
32
33for $user in dataset('Users')
34let $tokens :=
35 for $lottery_number in $user.lottery_numbers
36 for $token at $i in
37 for $user in dataset('Users')
38 for $lottery_number in $user.lottery_numbers
39 group by $item := $lottery_number with $user
40 let $count := count($user)
41 order by $count desc
42 return $item
43 where $lottery_number = $token
44 order by $token
45 return $i
46return {"uid": $user.uid, "tokens": $tokens}