Young-Seok | be353dd | 2014-05-22 20:30:45 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Description : Test that left-outer-join may use an available rtree index in index subtree. |
| 3 | * Issue : 730 |
| 4 | * Expected Res : Success |
| 5 | * Date : 8th May 2014 |
| 6 | */ |
| 7 | |
| 8 | drop dataverse test if exists; |
| 9 | create dataverse test; |
| 10 | use dataverse test; |
| 11 | |
| 12 | create type TwitterUserType as { |
| 13 | screen_name: string, |
| 14 | lang: string, |
| 15 | friends_count: int32, |
| 16 | statuses_count: int32, |
| 17 | name: string, |
| 18 | followers_count: int32 |
| 19 | } |
| 20 | |
| 21 | create type TweetMessageType as { |
| 22 | tweetid: int64, |
| 23 | user: TwitterUserType, |
| 24 | sender_location: point?, |
| 25 | send_time: datetime, |
| 26 | referred_topics: {{ string }}, |
| 27 | message_text: string |
| 28 | } |
| 29 | |
| 30 | create dataset TweetMessages(TweetMessageType) primary key tweetid; |
| 31 | |
| 32 | create index twmSndLocIx on TweetMessages(sender_location) type rtree; |
| 33 | |
| 34 | write output to nc1:"rttest/rtree-index-join_issue730.adm"; |
| 35 | |
| 36 | for $t1 in dataset('TweetMessages') |
| 37 | where $t1.send_time >= datetime('2011-06-18T14:10:17') and $t1.send_time < datetime('2011-06-18T15:10:17') |
| 38 | let $n := create-circle($t1.sender_location, 5.0) |
| 39 | return { |
| 40 | "message": $t1.tweetid, |
| 41 | "nearby-message": for $t2 in dataset('TweetMessages') |
| 42 | where spatial-intersect($t2.sender_location, $n) |
| 43 | return $t2.tweetid |
| 44 | } |