vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 1 | drop dataverse test if exists; |
| 2 | create dataverse test; |
| 3 | use dataverse test; |
| 4 | |
| 5 | create type UserType as open { |
| 6 | uid: int32, |
| 7 | name: string, |
| 8 | lottery_numbers: [int32], |
| 9 | interests: {{string}} |
| 10 | } |
| 11 | |
| 12 | create type VisitorType as open { |
| 13 | vid: int32, |
| 14 | name: string, |
| 15 | lottery_numbers: [int32], |
| 16 | interests: {{string}} |
| 17 | } |
| 18 | |
khfaraaz82@gmail.com | 31086b5 | 2012-05-02 21:33:58 +0000 | [diff] [blame] | 19 | create dataset Users(UserType) partitioned by key uid; |
| 20 | create dataset Visitors(VisitorType) partitioned by key vid; |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 21 | |
| 22 | |
| 23 | load dataset Users |
| 24 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 25 | (("path"="nc1://data/users-visitors-small/users.json"),("format"="adm")); |
| 26 | |
| 27 | load dataset Visitors |
| 28 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 29 | (("path"="nc1://data/users-visitors-small/visitors.json"),("format"="adm")); |
| 30 | |
| 31 | write output to nc1:'rttest/nested-loop-join_01.adm'; |
| 32 | |
| 33 | for $user in dataset('Users') |
| 34 | for $visitor in dataset('Visitors') |
| 35 | where len($user.lottery_numbers) = len($visitor.lottery_numbers) |
| 36 | order by $user.uid, $visitor.vid |
| 37 | return {'user': $user, 'visitor': $visitor, 'user-lottery_numbers-len': len($user.lottery_numbers), 'visitor-lottery_numbers-len': len($visitor.lottery_numbers)} |