khfaraaz82@gmail.com | ca3d41f | 2013-02-04 22:10:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Description : Notice the query hint to use an indexed nested-loops join plan. |
| 3 | * : We expect a plan that hash-exchanges internal dataset DsTwo, then probes internal dataset DsOne’s primary index. |
| 4 | * Expected Res : Success |
| 5 | * Date : 29th November 2012 |
| 6 | */ |
| 7 | |
| 8 | drop dataverse test1 if exists; |
| 9 | create dataverse test1; |
| 10 | |
| 11 | create type test1.TestType as open { |
| 12 | key1: int32, |
| 13 | key2: int32, |
| 14 | fname : string, |
| 15 | lname : string |
| 16 | } |
| 17 | |
| 18 | create dataset test1.DsOne(TestType) partitioned by key key1; |
| 19 | create dataset test1.DsTwo(TestType) partitioned by key key1; |
| 20 | |
| 21 | // Please note content enclosed in the comment in the predicate is the HINT to the optimizer |
| 22 | |
| 23 | for $x in dataset('test1.DsOne') |
| 24 | for $y in dataset('test1.DsTwo') |
| 25 | where $x.key1 /*+ indexnl */ > $y.key2 |
| 26 | return $x |
| 27 | |