Steven Jacobs | b557191 | 2015-02-03 10:19:29 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Description : This test case is to verify the fix for issue838 |
| 3 | * https://code.google.com/p/asterixdb/issues/detail?id=838 |
| 4 | * Expected Res : SUCCESS |
| 5 | * Date : 18 Dec. 2014 |
| 6 | */ |
| 7 | drop dataverse twitter if exists; |
| 8 | create dataverse twitter; |
| 9 | use dataverse twitter; |
| 10 | |
| 11 | create type TweetMessageType as closed { |
| 12 | tweetid: int64, |
| 13 | sender-location: point, |
| 14 | text: string |
| 15 | } |
| 16 | |
| 17 | create type TweetHistorySubscription as open{ |
| 18 | subscription-id: int32, |
| 19 | location: point |
| 20 | } |
| 21 | |
| 22 | create dataset TweetHistorySubscriptions(TweetHistorySubscription) |
| 23 | primary key subscription-id; |
| 24 | create index testa on TweetHistorySubscriptions(location) type rtree; |
| 25 | |
| 26 | create dataset TweetMessages(TweetMessageType) |
| 27 | primary key tweetid; |
| 28 | create index locationIdx on TweetMessages(sender-location) type rtree; |
| 29 | |
| 30 | write output to nc1:"rttest/query-issue838.adm"; |
| 31 | |
| 32 | for $sub in dataset TweetHistorySubscriptions |
| 33 | let $location := $sub.location |
| 34 | for $text in ( |
| 35 | for $tweet in dataset TweetMessages |
| 36 | let $circle := create-circle($location,30.0) |
| 37 | where spatial-intersect($tweet.sender-location, $circle) |
| 38 | return $tweet |
| 39 | ) |
| 40 | return { |
| 41 | "subscription-id":$sub.subscription-id, |
| 42 | "changeSet":1, |
| 43 | "execution-time":current-datetime(), |
| 44 | "message-text":$text |
| 45 | } |